use of org.eclipse.lsp4j.DocumentSymbolCapabilities in project eclipse.jdt.ls by eclipse.
the class ClientPreferencesTest method testIsSymbolTagSupported.
@Test
public void testIsSymbolTagSupported() throws Exception {
assertFalse(prefs.isSymbolTagSupported());
DocumentSymbolCapabilities capabilities = new DocumentSymbolCapabilities();
when(text.getDocumentSymbol()).thenReturn(capabilities);
capabilities.setTagSupport(new SymbolTagSupportCapabilities());
assertTrue(prefs.isSymbolTagSupported());
}
use of org.eclipse.lsp4j.DocumentSymbolCapabilities in project eclipse.jdt.ls by eclipse.
the class ClientPreferencesTest method testIsHierarchicalDocumentSymbolSupported.
@Test
public void testIsHierarchicalDocumentSymbolSupported() throws Exception {
DocumentSymbolCapabilities capabilities = new DocumentSymbolCapabilities();
assertFalse(prefs.isHierarchicalDocumentSymbolSupported());
when(text.getDocumentSymbol()).thenReturn(capabilities);
assertFalse(prefs.isHierarchicalDocumentSymbolSupported());
capabilities.setHierarchicalDocumentSymbolSupport(false);
when(text.getDocumentSymbol()).thenReturn(capabilities);
assertFalse(prefs.isHierarchicalDocumentSymbolSupported());
capabilities.setHierarchicalDocumentSymbolSupport(true);
when(text.getDocumentSymbol()).thenReturn(capabilities);
assertTrue(prefs.isHierarchicalDocumentSymbolSupported());
}
use of org.eclipse.lsp4j.DocumentSymbolCapabilities in project xtext-core by eclipse.
the class LanguageServerImpl method isHierarchicalDocumentSymbolSupport.
/**
* {@code true} if the {@code TextDocumentClientCapabilities} explicitly declares the hierarchical document symbol
* support at LS initialization time. Otherwise, false.
*/
protected boolean isHierarchicalDocumentSymbolSupport() {
ClientCapabilities capabilities = initializeParams.getCapabilities();
if (capabilities == null) {
return false;
}
TextDocumentClientCapabilities textDocument = capabilities.getTextDocument();
if (textDocument == null) {
return false;
}
DocumentSymbolCapabilities documentSymbol = textDocument.getDocumentSymbol();
if (documentSymbol == null) {
return false;
}
Boolean hierarchicalDocumentSymbolSupport = documentSymbol.getHierarchicalDocumentSymbolSupport();
if (hierarchicalDocumentSymbolSupport == null) {
return false;
}
return hierarchicalDocumentSymbolSupport;
}
use of org.eclipse.lsp4j.DocumentSymbolCapabilities in project xtext-core by eclipse.
the class AbstractLanguageServerTest method initialize.
protected InitializeResult initialize(final Procedure1<? super InitializeParams> initializer, final boolean callInitialized) {
try {
InitializeParams _initializeParams = new InitializeParams();
final Procedure1<InitializeParams> _function = (InitializeParams it) -> {
it.setProcessId(Integer.valueOf(1));
String _uriString = this._uriExtensions.toUriString(this.root.toURI().normalize());
WorkspaceFolder _workspaceFolder = new WorkspaceFolder(_uriString, "");
it.setWorkspaceFolders(Collections.<WorkspaceFolder>unmodifiableList(CollectionLiterals.<WorkspaceFolder>newArrayList(_workspaceFolder)));
};
final InitializeParams params = ObjectExtensions.<InitializeParams>operator_doubleArrow(_initializeParams, _function);
if (initializer != null) {
initializer.apply(params);
}
Boolean _elvis = null;
ClientCapabilities _capabilities = params.getCapabilities();
TextDocumentClientCapabilities _textDocument = null;
if (_capabilities != null) {
_textDocument = _capabilities.getTextDocument();
}
DocumentSymbolCapabilities _documentSymbol = null;
if (_textDocument != null) {
_documentSymbol = _textDocument.getDocumentSymbol();
}
Boolean _hierarchicalDocumentSymbolSupport = null;
if (_documentSymbol != null) {
_hierarchicalDocumentSymbolSupport = _documentSymbol.getHierarchicalDocumentSymbolSupport();
}
if (_hierarchicalDocumentSymbolSupport != null) {
_elvis = _hierarchicalDocumentSymbolSupport;
} else {
_elvis = Boolean.valueOf(false);
}
this.hierarchicalDocumentSymbolSupport = (_elvis).booleanValue();
final InitializeResult result = this.languageServer.initialize(params).get();
if (callInitialized) {
this.languageServer.initialized(null);
}
return result;
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
Aggregations