mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-15 08:18:55 +00:00
[eclipse/xtext-core#1059] updated to lsp4j 0.7.0
Signed-off-by: Christian Dietrich <christian.dietrich@itemis.de>
This commit is contained in:
parent
1de011e416
commit
9b38d565e0
16 changed files with 76 additions and 32 deletions
|
@ -14,8 +14,8 @@ Require-Bundle: org.eclipse.xtext;visibility:=reexport,
|
|||
org.eclipse.core.runtime;bundle-version="3.13.0",
|
||||
org.eclipse.xtext.ide,
|
||||
org.junit;bundle-version="4.12.0",
|
||||
org.eclipse.lsp4j;bundle-version="[0.6.0,0.7.0)";resolution:=optional,
|
||||
org.eclipse.lsp4j.jsonrpc;bundle-version="[0.6.0,0.7.0)";resolution:=optional,
|
||||
org.eclipse.lsp4j;bundle-version="[0.7.0,0.8.0)";resolution:=optional,
|
||||
org.eclipse.lsp4j.jsonrpc;bundle-version="[0.7.0,0.8.0)";resolution:=optional,
|
||||
org.eclipse.xtext.testlanguages,
|
||||
org.eclipse.xtext.testlanguages.ide
|
||||
Import-Package: org.apache.log4j;version="1.2.15"
|
||||
|
|
|
@ -20,6 +20,8 @@ import org.junit.Before
|
|||
import org.junit.Test
|
||||
|
||||
import static org.junit.Assert.*
|
||||
import org.eclipse.lsp4j.Range
|
||||
import org.eclipse.lsp4j.Position
|
||||
|
||||
class SemanticHighlightingTest extends AbstractTestLangLanguageServerTest {
|
||||
|
||||
|
@ -101,10 +103,10 @@ class SemanticHighlightingTest extends AbstractTestLangLanguageServerTest {
|
|||
int a
|
||||
op foo(a: A): string {}
|
||||
}'''
|
||||
range = new Range(new Position(0, 0), new Position(4, 1))
|
||||
]
|
||||
];
|
||||
]);
|
||||
|
||||
fileUri.assertInfos('''0 : [5:1:[typeDeclaration]]
|
||||
1 : [2:3:[primitiveType], 6:1:[identifier]]
|
||||
2 : [5:3:[identifier], 9:1:[parameterName], 12:1:[type], 16:6:[primitiveType]]
|
||||
|
@ -123,6 +125,7 @@ class SemanticHighlightingTest extends AbstractTestLangLanguageServerTest {
|
|||
type A {
|
||||
int a
|
||||
}'''
|
||||
range = new Range(new Position(0, 0), new Position(3, 1))
|
||||
]
|
||||
];
|
||||
]);
|
||||
|
@ -145,6 +148,7 @@ class SemanticHighlightingTest extends AbstractTestLangLanguageServerTest {
|
|||
op foo() {}
|
||||
op foo(a: A): string {}
|
||||
}'''
|
||||
range = new Range(new Position(0, 0), new Position(2, 1))
|
||||
]
|
||||
];
|
||||
]);
|
||||
|
|
|
@ -54,7 +54,7 @@ class SignatureHelpServiceImpl implements ISignatureHelpService {
|
|||
var result = left.parameters.size - right.parameters.size;
|
||||
if (result === 0) {
|
||||
for (var i = 0, var size = left.parameters.size; i < size; i++) {
|
||||
result = left.parameters.get(i).label.compareTo(right.parameters.get(i).label);
|
||||
result = left.parameters.get(i).label.getLeft().compareTo(right.parameters.get(i).label.getLeft());
|
||||
if (result != 0) {
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ import java.util.Map;
|
|||
import org.eclipse.lsp4j.ClientCapabilities;
|
||||
import org.eclipse.lsp4j.DidChangeTextDocumentParams;
|
||||
import org.eclipse.lsp4j.InitializeParams;
|
||||
import org.eclipse.lsp4j.Position;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
import org.eclipse.lsp4j.SemanticHighlightingCapabilities;
|
||||
import org.eclipse.lsp4j.SemanticHighlightingInformation;
|
||||
import org.eclipse.lsp4j.TextDocumentClientCapabilities;
|
||||
|
@ -187,6 +189,10 @@ public class SemanticHighlightingTest extends AbstractTestLangLanguageServerTest
|
|||
_builder_2.newLine();
|
||||
_builder_2.append("}");
|
||||
it_1.setText(_builder_2.toString());
|
||||
Position _position = new Position(0, 0);
|
||||
Position _position_1 = new Position(4, 1);
|
||||
Range _range = new Range(_position, _position_1);
|
||||
it_1.setRange(_range);
|
||||
};
|
||||
TextDocumentContentChangeEvent _doubleArrow_1 = ObjectExtensions.<TextDocumentContentChangeEvent>operator_doubleArrow(_textDocumentContentChangeEvent, _function_2);
|
||||
it.setContentChanges(Collections.<TextDocumentContentChangeEvent>unmodifiableList(CollectionLiterals.<TextDocumentContentChangeEvent>newArrayList(_doubleArrow_1)));
|
||||
|
@ -222,6 +228,10 @@ public class SemanticHighlightingTest extends AbstractTestLangLanguageServerTest
|
|||
_builder_3.newLine();
|
||||
_builder_3.append("}");
|
||||
it_1.setText(_builder_3.toString());
|
||||
Position _position = new Position(0, 0);
|
||||
Position _position_1 = new Position(3, 1);
|
||||
Range _range = new Range(_position, _position_1);
|
||||
it_1.setRange(_range);
|
||||
};
|
||||
TextDocumentContentChangeEvent _doubleArrow_2 = ObjectExtensions.<TextDocumentContentChangeEvent>operator_doubleArrow(_textDocumentContentChangeEvent, _function_3);
|
||||
it.setContentChanges(Collections.<TextDocumentContentChangeEvent>unmodifiableList(CollectionLiterals.<TextDocumentContentChangeEvent>newArrayList(_doubleArrow_2)));
|
||||
|
@ -261,6 +271,10 @@ public class SemanticHighlightingTest extends AbstractTestLangLanguageServerTest
|
|||
_builder_4.newLine();
|
||||
_builder_4.append("}");
|
||||
it_1.setText(_builder_4.toString());
|
||||
Position _position = new Position(0, 0);
|
||||
Position _position_1 = new Position(2, 1);
|
||||
Range _range = new Range(_position, _position_1);
|
||||
it_1.setRange(_range);
|
||||
};
|
||||
TextDocumentContentChangeEvent _doubleArrow_3 = ObjectExtensions.<TextDocumentContentChangeEvent>operator_doubleArrow(_textDocumentContentChangeEvent, _function_4);
|
||||
it.setContentChanges(Collections.<TextDocumentContentChangeEvent>unmodifiableList(CollectionLiterals.<TextDocumentContentChangeEvent>newArrayList(_doubleArrow_3)));
|
||||
|
|
|
@ -78,7 +78,7 @@ public class SignatureHelpServiceImpl implements ISignatureHelpService {
|
|||
boolean _while = (i < size);
|
||||
while (_while) {
|
||||
{
|
||||
result = left.getParameters().get(i).getLabel().compareTo(right.getParameters().get(i).getLabel());
|
||||
result = left.getParameters().get(i).getLabel().getLeft().compareTo(right.getParameters().get(i).getLabel().getLeft());
|
||||
if ((result != 0)) {
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@ Require-Bundle: org.eclipse.xtext;visibility:=reexport,
|
|||
org.eclipse.xtend.lib,
|
||||
org.eclipse.core.runtime;bundle-version="3.13.0";resolution:=optional;x-installation:=greedy,
|
||||
org.eclipse.equinox.common;bundle-version="3.9.0",
|
||||
org.eclipse.lsp4j;bundle-version="[0.6.0,0.7.0)";resolution:=optional,
|
||||
org.eclipse.lsp4j.jsonrpc;bundle-version="[0.6.0,0.7.0)";resolution:=optional,
|
||||
org.eclipse.lsp4j;bundle-version="[0.7.0,0.8.0)";resolution:=optional,
|
||||
org.eclipse.lsp4j.jsonrpc;bundle-version="[0.7.0,0.8.0)";resolution:=optional,
|
||||
org.eclipse.emf.ecore.change;bundle-version="[2.10.0,3)"
|
||||
Import-Package: org.apache.log4j;version="1.2.15"
|
||||
Export-Package: org.eclipse.xtext.ide;x-friends:="org.eclipse.xtend.ide,
|
||||
|
|
|
@ -376,7 +376,7 @@ import org.eclipse.xtext.findReferences.IReferenceFinder.IResourceAccess
|
|||
// end completion stuff
|
||||
// symbols
|
||||
override definition(TextDocumentPositionParams params) {
|
||||
return requestManager.runRead[cancelIndicator|definition(cancelIndicator, params)]
|
||||
return requestManager.runRead[cancelIndicator|Either.forLeft(definition(cancelIndicator, params))]
|
||||
}
|
||||
|
||||
protected def List<? extends Location> definition(CancelIndicator cancelIndicator, TextDocumentPositionParams params) {
|
||||
|
|
|
@ -48,10 +48,22 @@ class DocumentSymbolMapper {
|
|||
*/
|
||||
def DocumentSymbol toDocumentSymbol(EObject object) {
|
||||
return new DocumentSymbol => [
|
||||
name = nameProvider.getName(object);
|
||||
kind = kindProvider.getSymbolKind(object);
|
||||
range = rangeProvider.getRange(object);
|
||||
selectionRange = rangeProvider.getSelectionRange(object);
|
||||
val objectName = nameProvider.getName(object)
|
||||
if (objectName !== null) {
|
||||
name = objectName;
|
||||
}
|
||||
val objectKind = kindProvider.getSymbolKind(object);
|
||||
if (objectKind !== null) {
|
||||
kind = objectKind
|
||||
}
|
||||
val objectRange = rangeProvider.getRange(object);
|
||||
if (objectRange !== null) {
|
||||
range = objectRange
|
||||
}
|
||||
val objectSelectionRange = rangeProvider.getSelectionRange(object);
|
||||
if (objectSelectionRange !== null) {
|
||||
selectionRange = objectSelectionRange
|
||||
}
|
||||
detail = detailsProvider.getDetails(object);
|
||||
deprecated = deprecationInfoProvider.isDeprecated(object);
|
||||
children = newArrayList;
|
||||
|
|
|
@ -65,6 +65,7 @@ import org.eclipse.lsp4j.InitializeParams;
|
|||
import org.eclipse.lsp4j.InitializeResult;
|
||||
import org.eclipse.lsp4j.InitializedParams;
|
||||
import org.eclipse.lsp4j.Location;
|
||||
import org.eclipse.lsp4j.LocationLink;
|
||||
import org.eclipse.lsp4j.Position;
|
||||
import org.eclipse.lsp4j.PublishDiagnosticsParams;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
|
@ -585,11 +586,11 @@ public class LanguageServerImpl implements LanguageServer, WorkspaceService, Tex
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<List<? extends Location>> definition(final TextDocumentPositionParams params) {
|
||||
final Function1<CancelIndicator, List<? extends Location>> _function = (CancelIndicator cancelIndicator) -> {
|
||||
return this.definition(cancelIndicator, params);
|
||||
public CompletableFuture<Either<List<? extends Location>, List<? extends LocationLink>>> definition(final TextDocumentPositionParams params) {
|
||||
final Function1<CancelIndicator, Either<List<? extends Location>, List<? extends LocationLink>>> _function = (CancelIndicator cancelIndicator) -> {
|
||||
return Either.<List<? extends Location>, List<? extends LocationLink>>forLeft(this.definition(cancelIndicator, params));
|
||||
};
|
||||
return this.requestManager.<List<? extends Location>>runRead(_function);
|
||||
return this.requestManager.<Either<List<? extends Location>, List<? extends LocationLink>>>runRead(_function);
|
||||
}
|
||||
|
||||
protected List<? extends Location> definition(final CancelIndicator cancelIndicator, final TextDocumentPositionParams params) {
|
||||
|
|
|
@ -191,10 +191,22 @@ public class DocumentSymbolMapper {
|
|||
public DocumentSymbol toDocumentSymbol(final EObject object) {
|
||||
DocumentSymbol _documentSymbol = new DocumentSymbol();
|
||||
final Procedure1<DocumentSymbol> _function = (DocumentSymbol it) -> {
|
||||
it.setName(this.nameProvider.getName(object));
|
||||
it.setKind(this.kindProvider.getSymbolKind(object));
|
||||
it.setRange(this.rangeProvider.getRange(object));
|
||||
it.setSelectionRange(this.rangeProvider.getSelectionRange(object));
|
||||
final String objectName = this.nameProvider.getName(object);
|
||||
if ((objectName != null)) {
|
||||
it.setName(objectName);
|
||||
}
|
||||
final SymbolKind objectKind = this.kindProvider.getSymbolKind(object);
|
||||
if ((objectKind != null)) {
|
||||
it.setKind(objectKind);
|
||||
}
|
||||
final Range objectRange = this.rangeProvider.getRange(object);
|
||||
if ((objectRange != null)) {
|
||||
it.setRange(objectRange);
|
||||
}
|
||||
final Range objectSelectionRange = this.rangeProvider.getSelectionRange(object);
|
||||
if ((objectSelectionRange != null)) {
|
||||
it.setSelectionRange(objectSelectionRange);
|
||||
}
|
||||
it.setDetail(this.detailsProvider.getDetails(object));
|
||||
it.setDeprecated(Boolean.valueOf(this.deprecationInfoProvider.isDeprecated(object)));
|
||||
it.setChildren(CollectionLiterals.<DocumentSymbol>newArrayList());
|
||||
|
|
|
@ -319,7 +319,7 @@ abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
}
|
||||
Assert.assertNotNull('Active signature index must not be null when signatures are available.', activeSignature);
|
||||
val param = if(activeParameter === null) '<empty>' else signatures.get(activeSignature).parameters.get(
|
||||
activeParameter).label;
|
||||
activeParameter).label.getLeft();
|
||||
'''«signatures.map[label].join(' | ')» | «param»''';
|
||||
}
|
||||
|
||||
|
@ -498,7 +498,7 @@ abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
])
|
||||
val definitions = definitionsFuture.get
|
||||
if (configuration.assertDefinitions !== null) {
|
||||
configuration.assertDefinitions.apply(definitions)
|
||||
configuration.assertDefinitions.apply(definitions.getLeft())
|
||||
} else {
|
||||
val actualDefinitions = definitions.toExpectation
|
||||
assertEquals(expectedDefinitions, actualDefinitions)
|
||||
|
|
|
@ -55,6 +55,7 @@ import org.eclipse.lsp4j.Hover;
|
|||
import org.eclipse.lsp4j.InitializeParams;
|
||||
import org.eclipse.lsp4j.InitializeResult;
|
||||
import org.eclipse.lsp4j.Location;
|
||||
import org.eclipse.lsp4j.LocationLink;
|
||||
import org.eclipse.lsp4j.Position;
|
||||
import org.eclipse.lsp4j.PublishDiagnosticsParams;
|
||||
import org.eclipse.lsp4j.Range;
|
||||
|
@ -694,7 +695,7 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
_xifexpression = "<empty>";
|
||||
} else {
|
||||
_xifexpression = it.getSignatures().get((it.getActiveSignature()).intValue()).getParameters().get(
|
||||
(it.getActiveParameter()).intValue()).getLabel();
|
||||
(it.getActiveParameter()).intValue()).getLabel().getLeft();
|
||||
}
|
||||
final String param = _xifexpression;
|
||||
StringConcatenation _builder_1 = new StringConcatenation();
|
||||
|
@ -1061,12 +1062,12 @@ public abstract class AbstractLanguageServerTest implements Endpoint {
|
|||
it.setPosition(_position);
|
||||
};
|
||||
TextDocumentPositionParams _doubleArrow = ObjectExtensions.<TextDocumentPositionParams>operator_doubleArrow(_textDocumentPositionParams, _function);
|
||||
final CompletableFuture<List<? extends Location>> definitionsFuture = this.languageServer.definition(_doubleArrow);
|
||||
final List<? extends Location> definitions = definitionsFuture.get();
|
||||
final CompletableFuture<Either<List<? extends Location>, List<? extends LocationLink>>> definitionsFuture = this.languageServer.definition(_doubleArrow);
|
||||
final Either<List<? extends Location>, List<? extends LocationLink>> definitions = definitionsFuture.get();
|
||||
Procedure1<? super List<? extends Location>> _assertDefinitions = configuration.getAssertDefinitions();
|
||||
boolean _tripleNotEquals = (_assertDefinitions != null);
|
||||
if (_tripleNotEquals) {
|
||||
configuration.getAssertDefinitions().apply(definitions);
|
||||
configuration.getAssertDefinitions().apply(definitions.getLeft());
|
||||
} else {
|
||||
final String actualDefinitions = this.toExpectation(definitions);
|
||||
this.assertEquals(configuration.getExpectedDefinitions(), actualDefinitions);
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<dependency>
|
||||
<groupId>org.eclipse.lsp4j</groupId>
|
||||
<artifactId>org.eclipse.lsp4j</artifactId>
|
||||
<version>0.6.0</version>
|
||||
<version>0.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.ow2.asm</groupId>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<dependency>
|
||||
<groupId>org.eclipse.lsp4j</groupId>
|
||||
<artifactId>org.eclipse.lsp4j</artifactId>
|
||||
<version>0.6.0</version>
|
||||
<version>0.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.ow2.asm</groupId>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others.
|
||||
* Copyright (c) 2015, 2019 itemis AG (http://www.itemis.eu) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -55,7 +55,7 @@ class IdeProjectDescriptor extends ProjectDescriptor {
|
|||
<dependency>
|
||||
<groupId>org.eclipse.lsp4j</groupId>
|
||||
<artifactId>org.eclipse.lsp4j</artifactId>
|
||||
<version>0.6.0</version>
|
||||
<version>0.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.ow2.asm</groupId>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright (c) 2015, 2017 itemis AG (http://www.itemis.eu) and others.
|
||||
* Copyright (c) 2015, 2019 itemis AG (http://www.itemis.eu) and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
|
@ -107,7 +107,7 @@ public class IdeProjectDescriptor extends ProjectDescriptor {
|
|||
_builder.append("<artifactId>org.eclipse.lsp4j</artifactId>");
|
||||
_builder.newLine();
|
||||
_builder.append("\t\t");
|
||||
_builder.append("<version>0.6.0</version>");
|
||||
_builder.append("<version>0.7.0</version>");
|
||||
_builder.newLine();
|
||||
_builder.append("\t");
|
||||
_builder.append("</dependency>");
|
||||
|
|
Loading…
Reference in a new issue