use of org.eclipse.lsp4j.TextDocumentPositionParams in project vscode-nextgenas by BowlerHatLLC.
the class ActionScriptTextDocumentService method getEmbeddedActionScriptNodeInMXMLTag.
private IASNode getEmbeddedActionScriptNodeInMXMLTag(IMXMLTagData tag, int offset, TextDocumentIdentifier textDocument, Position position) {
TextDocumentPositionParams textDocumentPosition = new TextDocumentPositionParams();
textDocumentPosition.setTextDocument(textDocument);
textDocumentPosition.setPosition(position);
return getEmbeddedActionScriptNodeInMXMLTag(tag, offset, textDocumentPosition);
}
use of org.eclipse.lsp4j.TextDocumentPositionParams in project xtext-core by eclipse.
the class ServerTest method testMissingInitialize.
@Test
public void testMissingInitialize() {
try {
try {
TextDocumentPositionParams _textDocumentPositionParams = new TextDocumentPositionParams();
final Procedure1<TextDocumentPositionParams> _function = (TextDocumentPositionParams it) -> {
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier();
final Procedure1<TextDocumentIdentifier> _function_1 = (TextDocumentIdentifier it_1) -> {
it_1.setUri("file:/home/test/workspace/mydoc.testlang");
};
TextDocumentIdentifier _doubleArrow = ObjectExtensions.<TextDocumentIdentifier>operator_doubleArrow(_textDocumentIdentifier, _function_1);
it.setTextDocument(_doubleArrow);
};
TextDocumentPositionParams _doubleArrow = ObjectExtensions.<TextDocumentPositionParams>operator_doubleArrow(_textDocumentPositionParams, _function);
this.languageServer.definition(_doubleArrow).get();
Assert.fail("Expected a ResponseErrorException");
} catch (final Throwable _t) {
if (_t instanceof ExecutionException) {
final ExecutionException exception = (ExecutionException) _t;
Throwable _cause = exception.getCause();
Assert.assertEquals(ResponseErrorCode.serverNotInitialized.getValue(), ((ResponseErrorException) _cause).getResponseError().getCode());
} else {
throw Exceptions.sneakyThrow(_t);
}
}
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.lsp4j.TextDocumentPositionParams in project xtext-core by eclipse.
the class UnknownProjectConfigTest method checkCompletion.
protected void checkCompletion(final String uri) {
try {
TextDocumentPositionParams _textDocumentPositionParams = new TextDocumentPositionParams();
final Procedure1<TextDocumentPositionParams> _function = (TextDocumentPositionParams it) -> {
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(uri);
it.setTextDocument(_textDocumentIdentifier);
Position _position = new Position(0, 10);
it.setPosition(_position);
};
TextDocumentPositionParams _doubleArrow = ObjectExtensions.<TextDocumentPositionParams>operator_doubleArrow(_textDocumentPositionParams, _function);
final CompletableFuture<Either<List<CompletionItem>, CompletionList>> completionItems = this.languageServer.completion(_doubleArrow);
final Either<List<CompletionItem>, CompletionList> result = completionItems.get();
List<CompletionItem> _xifexpression = null;
boolean _isLeft = result.isLeft();
if (_isLeft) {
_xifexpression = result.getLeft();
} else {
_xifexpression = result.getRight().getItems();
}
final List<CompletionItem> items = _xifexpression;
final String actualCompletionItems = this.toExpectation(items);
StringConcatenation _builder = new StringConcatenation();
_builder.append("Foo (TypeDeclaration) -> Foo [[0, 10] .. [0, 10]]");
_builder.newLine();
_builder.append("boolean -> boolean [[0, 10] .. [0, 10]]");
_builder.newLine();
_builder.append("int -> int [[0, 10] .. [0, 10]]");
_builder.newLine();
_builder.append("op -> op [[0, 10] .. [0, 10]]");
_builder.newLine();
_builder.append("string -> string [[0, 10] .. [0, 10]]");
_builder.newLine();
_builder.append("void -> void [[0, 10] .. [0, 10]]");
_builder.newLine();
_builder.append("} -> } [[0, 10] .. [0, 10]]");
_builder.newLine();
_builder.append("{ -> { [[0, 9] .. [0, 10]]");
_builder.newLine();
final String expectedCompletionItems = _builder.toString();
this.assertEquals(expectedCompletionItems, actualCompletionItems);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.lsp4j.TextDocumentPositionParams in project xtext-core by eclipse.
the class AbstractLanguageServerTest method testSignatureHelp.
protected void testSignatureHelp(final Procedure1<? super SignatureHelpConfiguration> configurator) {
try {
@Extension final SignatureHelpConfiguration configuration = new SignatureHelpConfiguration();
configuration.setFilePath(("MyModel." + this.fileExtension));
configurator.apply(configuration);
final String fileUri = this.initializeContext(configuration).getUri();
TextDocumentPositionParams _textDocumentPositionParams = new TextDocumentPositionParams();
final Procedure1<TextDocumentPositionParams> _function = (TextDocumentPositionParams it) -> {
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(fileUri);
it.setTextDocument(_textDocumentIdentifier);
int _line = configuration.getLine();
int _column = configuration.getColumn();
Position _position = new Position(_line, _column);
it.setPosition(_position);
};
TextDocumentPositionParams _doubleArrow = ObjectExtensions.<TextDocumentPositionParams>operator_doubleArrow(_textDocumentPositionParams, _function);
final CompletableFuture<SignatureHelp> signatureHelpFuture = this.languageServer.signatureHelp(_doubleArrow);
final SignatureHelp signatureHelp = signatureHelpFuture.get();
Procedure1<? super SignatureHelp> _assertSignatureHelp = configuration.getAssertSignatureHelp();
boolean _tripleNotEquals = (_assertSignatureHelp != null);
if (_tripleNotEquals) {
configuration.getAssertSignatureHelp().apply(signatureHelp);
} else {
final String actualSignatureHelp = this.toExpectation(signatureHelp);
this.assertEquals(configuration.getExpectedSignatureHelp().trim(), actualSignatureHelp.trim());
}
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.lsp4j.TextDocumentPositionParams in project xtext-core by eclipse.
the class AbstractLanguageServerTest method testDocumentHighlight.
protected void testDocumentHighlight(final Procedure1<? super DocumentHighlightConfiguration> configurator) {
try {
DocumentHighlightConfiguration _documentHighlightConfiguration = new DocumentHighlightConfiguration();
final Procedure1<DocumentHighlightConfiguration> _function = (DocumentHighlightConfiguration it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("MyModel.");
_builder.append(this.fileExtension);
it.setFilePath(_builder.toString());
};
@Extension final DocumentHighlightConfiguration configuration = ObjectExtensions.<DocumentHighlightConfiguration>operator_doubleArrow(_documentHighlightConfiguration, _function);
configurator.apply(configuration);
final String fileUri = this.initializeContext(configuration).getUri();
TextDocumentPositionParams _textDocumentPositionParams = new TextDocumentPositionParams();
final Procedure1<TextDocumentPositionParams> _function_1 = (TextDocumentPositionParams it) -> {
TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(fileUri);
it.setTextDocument(_textDocumentIdentifier);
int _line = configuration.getLine();
int _column = configuration.getColumn();
Position _position = new Position(_line, _column);
it.setPosition(_position);
};
TextDocumentPositionParams _doubleArrow = ObjectExtensions.<TextDocumentPositionParams>operator_doubleArrow(_textDocumentPositionParams, _function_1);
final CompletableFuture<List<? extends DocumentHighlight>> highlights = this.languageServer.documentHighlight(_doubleArrow);
final Function1<DocumentHighlight, String> _function_2 = (DocumentHighlight it) -> {
return this.toExpectation(it);
};
final String actualDocumentHighlight = IterableExtensions.join(ListExtensions.map(highlights.get(), _function_2), " | ");
this.assertEquals(configuration.getExpectedDocumentHighlight(), actualDocumentHighlight);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
Aggregations