Search in sources :

Example 1 with DocumentSymbolCapabilities

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());
}
Also used : DocumentSymbolCapabilities(org.eclipse.lsp4j.DocumentSymbolCapabilities) SymbolTagSupportCapabilities(org.eclipse.lsp4j.SymbolTagSupportCapabilities) Test(org.junit.Test)

Example 2 with DocumentSymbolCapabilities

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());
}
Also used : DocumentSymbolCapabilities(org.eclipse.lsp4j.DocumentSymbolCapabilities) Test(org.junit.Test)

Example 3 with DocumentSymbolCapabilities

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;
}
Also used : DocumentSymbolCapabilities(org.eclipse.lsp4j.DocumentSymbolCapabilities) ClientCapabilities(org.eclipse.lsp4j.ClientCapabilities) WorkspaceClientCapabilities(org.eclipse.lsp4j.WorkspaceClientCapabilities) TextDocumentClientCapabilities(org.eclipse.lsp4j.TextDocumentClientCapabilities) TextDocumentClientCapabilities(org.eclipse.lsp4j.TextDocumentClientCapabilities)

Example 4 with DocumentSymbolCapabilities

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);
    }
}
Also used : InitializeResult(org.eclipse.lsp4j.InitializeResult) DocumentSymbolCapabilities(org.eclipse.lsp4j.DocumentSymbolCapabilities) ClientCapabilities(org.eclipse.lsp4j.ClientCapabilities) TextDocumentClientCapabilities(org.eclipse.lsp4j.TextDocumentClientCapabilities) InitializeParams(org.eclipse.lsp4j.InitializeParams) TextDocumentClientCapabilities(org.eclipse.lsp4j.TextDocumentClientCapabilities) WorkspaceFolder(org.eclipse.lsp4j.WorkspaceFolder)

Aggregations

DocumentSymbolCapabilities (org.eclipse.lsp4j.DocumentSymbolCapabilities)4 ClientCapabilities (org.eclipse.lsp4j.ClientCapabilities)2 TextDocumentClientCapabilities (org.eclipse.lsp4j.TextDocumentClientCapabilities)2 Test (org.junit.Test)2 InitializeParams (org.eclipse.lsp4j.InitializeParams)1 InitializeResult (org.eclipse.lsp4j.InitializeResult)1 SymbolTagSupportCapabilities (org.eclipse.lsp4j.SymbolTagSupportCapabilities)1 WorkspaceClientCapabilities (org.eclipse.lsp4j.WorkspaceClientCapabilities)1 WorkspaceFolder (org.eclipse.lsp4j.WorkspaceFolder)1