use of org.eclipse.lsp4j.TextDocumentItem in project vscode-nextgenas by BowlerHatLLC.
the class ActionScriptTextDocumentService method didOpen.
/**
* Called whan a file is opened for editing in Visual Studio Code. We store
* the file's contents in a String since any changes that have been made to
* it may not have been saved yet. This method will not be called again if
* the user simply switches to a different tab for another file and then
* switched back to this one, without every closing it completely. In
* other words, the language server does not usually know which file is
* currently visible to the user in VSCode.
*/
@Override
public void didOpen(DidOpenTextDocumentParams params) {
TextDocumentItem textDocument = params.getTextDocument();
String textDocumentUri = textDocument.getUri();
if (!textDocumentUri.endsWith(AS_EXTENSION) && !textDocumentUri.endsWith(MXML_EXTENSION)) {
return;
}
Path path = LanguageServerUtils.getPathFromLanguageServerURI(textDocumentUri);
if (path != null) {
String text = textDocument.getText();
sourceByPath.put(path, text);
//we need to check for problems when opening a new file because it
//may not have been in the workspace before.
checkFilePathForProblems(path, false);
}
}
use of org.eclipse.lsp4j.TextDocumentItem in project xtext-core by eclipse.
the class UnknownProjectConfigTest method testCompletionWithInmemoryScheme_01.
@Test
public void testCompletionWithInmemoryScheme_01() {
final Procedure1<InitializeParams> _function = (InitializeParams it) -> {
it.setRootUri(null);
};
this.initialize(_function);
final String inmemoryUri = "inmemory:/mydoc.testlang";
DidOpenTextDocumentParams _didOpenTextDocumentParams = new DidOpenTextDocumentParams();
final Procedure1<DidOpenTextDocumentParams> _function_1 = (DidOpenTextDocumentParams it) -> {
TextDocumentItem _textDocumentItem = new TextDocumentItem();
final Procedure1<TextDocumentItem> _function_2 = (TextDocumentItem it_1) -> {
it_1.setUri(inmemoryUri);
StringConcatenation _builder = new StringConcatenation();
_builder.append("type Foo {}");
_builder.newLine();
it_1.setText(_builder.toString());
};
TextDocumentItem _doubleArrow = ObjectExtensions.<TextDocumentItem>operator_doubleArrow(_textDocumentItem, _function_2);
it.setTextDocument(_doubleArrow);
};
DidOpenTextDocumentParams _doubleArrow = ObjectExtensions.<DidOpenTextDocumentParams>operator_doubleArrow(_didOpenTextDocumentParams, _function_1);
this.languageServer.didOpen(_doubleArrow);
this.checkCompletion(inmemoryUri);
}
use of org.eclipse.lsp4j.TextDocumentItem in project xtext-core by eclipse.
the class AbstractLanguageServerTest method open.
protected void open(final String fileUri, final String langaugeId, final String model) {
DidOpenTextDocumentParams _didOpenTextDocumentParams = new DidOpenTextDocumentParams();
final Procedure1<DidOpenTextDocumentParams> _function = (DidOpenTextDocumentParams it) -> {
TextDocumentItem _textDocumentItem = new TextDocumentItem();
final Procedure1<TextDocumentItem> _function_1 = (TextDocumentItem it_1) -> {
it_1.setUri(fileUri);
it_1.setLanguageId(langaugeId);
it_1.setVersion(1);
it_1.setText(model);
};
TextDocumentItem _doubleArrow = ObjectExtensions.<TextDocumentItem>operator_doubleArrow(_textDocumentItem, _function_1);
it.setTextDocument(_doubleArrow);
};
DidOpenTextDocumentParams _doubleArrow = ObjectExtensions.<DidOpenTextDocumentParams>operator_doubleArrow(_didOpenTextDocumentParams, _function);
this.languageServer.didOpen(_doubleArrow);
}
use of org.eclipse.lsp4j.TextDocumentItem in project xtext-core by eclipse.
the class UnknownProjectConfigTest method testCompletionWithInmemoryScheme_02.
@Test
public void testCompletionWithInmemoryScheme_02() {
this.initialize();
final String inmemoryUri = "inmemory:/mydoc.testlang";
DidOpenTextDocumentParams _didOpenTextDocumentParams = new DidOpenTextDocumentParams();
final Procedure1<DidOpenTextDocumentParams> _function = (DidOpenTextDocumentParams it) -> {
TextDocumentItem _textDocumentItem = new TextDocumentItem();
final Procedure1<TextDocumentItem> _function_1 = (TextDocumentItem it_1) -> {
it_1.setUri(inmemoryUri);
StringConcatenation _builder = new StringConcatenation();
_builder.append("type Foo {}");
_builder.newLine();
it_1.setText(_builder.toString());
};
TextDocumentItem _doubleArrow = ObjectExtensions.<TextDocumentItem>operator_doubleArrow(_textDocumentItem, _function_1);
it.setTextDocument(_doubleArrow);
};
DidOpenTextDocumentParams _doubleArrow = ObjectExtensions.<DidOpenTextDocumentParams>operator_doubleArrow(_didOpenTextDocumentParams, _function);
this.languageServer.didOpen(_doubleArrow);
this.checkCompletion(inmemoryUri);
}
use of org.eclipse.lsp4j.TextDocumentItem in project xtext-core by eclipse.
the class UnknownProjectConfigTest method testCompletionWithFileScheme_02.
@Test
public void testCompletionWithFileScheme_02() {
this.initialize();
final String fileUri = "file:/home/test/workspace/mydoc.testlang";
DidOpenTextDocumentParams _didOpenTextDocumentParams = new DidOpenTextDocumentParams();
final Procedure1<DidOpenTextDocumentParams> _function = (DidOpenTextDocumentParams it) -> {
TextDocumentItem _textDocumentItem = new TextDocumentItem();
final Procedure1<TextDocumentItem> _function_1 = (TextDocumentItem it_1) -> {
it_1.setUri(fileUri);
StringConcatenation _builder = new StringConcatenation();
_builder.append("type Foo {}");
_builder.newLine();
it_1.setText(_builder.toString());
};
TextDocumentItem _doubleArrow = ObjectExtensions.<TextDocumentItem>operator_doubleArrow(_textDocumentItem, _function_1);
it.setTextDocument(_doubleArrow);
};
DidOpenTextDocumentParams _doubleArrow = ObjectExtensions.<DidOpenTextDocumentParams>operator_doubleArrow(_didOpenTextDocumentParams, _function);
this.languageServer.didOpen(_doubleArrow);
this.checkCompletion(fileUri);
}
Aggregations