Search in sources :

Example 1 with InitializeResult

use of org.eclipse.lsp4j.InitializeResult in project eclipse.jdt.ls by eclipse.

the class InitHandlerTest method testRegisterDelayedCapability.

@Test
public void testRegisterDelayedCapability() throws Exception {
    ClientPreferences mockCapabilies = mock(ClientPreferences.class);
    when(preferenceManager.getClientPreferences()).thenReturn(mockCapabilies);
    when(mockCapabilies.isDocumentSymbolDynamicRegistered()).thenReturn(Boolean.TRUE);
    when(mockCapabilies.isWorkspaceSymbolDynamicRegistered()).thenReturn(Boolean.TRUE);
    when(mockCapabilies.isDocumentSymbolDynamicRegistered()).thenReturn(Boolean.TRUE);
    when(mockCapabilies.isCodeActionDynamicRegistered()).thenReturn(Boolean.TRUE);
    when(mockCapabilies.isDefinitionDynamicRegistered()).thenReturn(Boolean.TRUE);
    when(mockCapabilies.isHoverDynamicRegistered()).thenReturn(Boolean.TRUE);
    when(mockCapabilies.isReferencesDynamicRegistered()).thenReturn(Boolean.TRUE);
    when(mockCapabilies.isDocumentHighlightDynamicRegistered()).thenReturn(Boolean.TRUE);
    InitializeResult result = initialize(true);
    assertNull(result.getCapabilities().getDocumentSymbolProvider());
    server.initialized(new InitializedParams());
    verify(client, times(7)).registerCapability(any());
}
Also used : InitializeResult(org.eclipse.lsp4j.InitializeResult) ClientPreferences(org.eclipse.jdt.ls.core.internal.preferences.ClientPreferences) InitializedParams(org.eclipse.lsp4j.InitializedParams) AbstractProjectsManagerBasedTest(org.eclipse.jdt.ls.core.internal.managers.AbstractProjectsManagerBasedTest) Test(org.junit.Test)

Example 2 with InitializeResult

use of org.eclipse.lsp4j.InitializeResult in project freemarker-languageserver by angelozerr.

the class FreemarkerLanguageServer method initialize.

@Override
public CompletableFuture<InitializeResult> initialize(InitializeParams params) {
    ServerCapabilities capabilities = new ServerCapabilities();
    capabilities.setTextDocumentSync(TextDocumentSyncKind.Full);
    capabilities.setDocumentSymbolProvider(true);
    InitializeResult result = new InitializeResult(capabilities);
    return CompletableFuture.completedFuture(result);
}
Also used : InitializeResult(org.eclipse.lsp4j.InitializeResult) ServerCapabilities(org.eclipse.lsp4j.ServerCapabilities)

Example 3 with InitializeResult

use of org.eclipse.lsp4j.InitializeResult in project sts4 by spring-projects.

the class DelegatingStreamConnectionProvider method handleMessage.

@Override
public void handleMessage(Message message, LanguageServer languageServer, URI rootURI) {
    if (message instanceof ResponseMessage) {
        ResponseMessage responseMessage = (ResponseMessage) message;
        if (responseMessage.getResult() instanceof InitializeResult) {
            this.languageServer = languageServer;
            sendConfiguration();
            // Add config listener
            BootLanguageServerPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(configListener);
            // Add resource listener
            ResourcesPlugin.getWorkspace().addResourceChangeListener(fResourceListener = new ResourceListener(languageServer, Arrays.asList(FileSystems.getDefault().getPathMatcher("glob:**/pom.xml"), FileSystems.getDefault().getPathMatcher("glob:**/*.gradle"), FileSystems.getDefault().getPathMatcher("glob:**/*.java"))));
        }
    }
}
Also used : InitializeResult(org.eclipse.lsp4j.InitializeResult) ResponseMessage(org.eclipse.lsp4j.jsonrpc.messages.ResponseMessage)

Example 4 with InitializeResult

use of org.eclipse.lsp4j.InitializeResult in project sts4 by spring-projects.

the class CloudFoundryManifestLanguageServer method handleMessage.

@Override
public void handleMessage(Message message, LanguageServer languageServer, URI rootPath) {
    if (message instanceof ResponseMessage) {
        ResponseMessage responseMessage = (ResponseMessage) message;
        if (responseMessage.getResult() instanceof InitializeResult) {
            this.languageServer = languageServer;
            this.rootPath = rootPath;
            updateLanguageServer();
            addLanguageServer(this);
        }
    }
}
Also used : InitializeResult(org.eclipse.lsp4j.InitializeResult) ResponseMessage(org.eclipse.lsp4j.jsonrpc.messages.ResponseMessage)

Example 5 with InitializeResult

use of org.eclipse.lsp4j.InitializeResult in project vscode-nextgenas by BowlerHatLLC.

the class ActionScriptLanguageServer method initialize.

/**
     * Tells Visual Studio Code about the language server's capabilities.
     */
@Override
public CompletableFuture<InitializeResult> initialize(InitializeParams params) {
    Path workspaceRoot = Paths.get(params.getRootPath()).toAbsolutePath().normalize();
    projectConfigStrategy.setASConfigPath(workspaceRoot.resolve(ASCONFIG_JSON));
    textDocumentService.setWorkspaceRoot(workspaceRoot);
    InitializeResult result = new InitializeResult();
    ServerCapabilities serverCapabilities = new ServerCapabilities();
    serverCapabilities.setTextDocumentSync(TextDocumentSyncKind.Incremental);
    serverCapabilities.setCodeActionProvider(true);
    CompletionOptions completionOptions = new CompletionOptions();
    completionOptions.setTriggerCharacters(Arrays.asList(".", ":", " ", "<"));
    serverCapabilities.setCompletionProvider(completionOptions);
    serverCapabilities.setDefinitionProvider(true);
    serverCapabilities.setDocumentSymbolProvider(true);
    serverCapabilities.setDocumentHighlightProvider(false);
    serverCapabilities.setDocumentRangeFormattingProvider(false);
    serverCapabilities.setHoverProvider(true);
    serverCapabilities.setReferencesProvider(true);
    serverCapabilities.setRenameProvider(true);
    SignatureHelpOptions signatureHelpOptions = new SignatureHelpOptions();
    signatureHelpOptions.setTriggerCharacters(Arrays.asList("(", ","));
    serverCapabilities.setSignatureHelpProvider(signatureHelpOptions);
    serverCapabilities.setWorkspaceSymbolProvider(true);
    result.setCapabilities(serverCapabilities);
    return CompletableFuture.completedFuture(result);
}
Also used : Path(java.nio.file.Path) CompletionOptions(org.eclipse.lsp4j.CompletionOptions) SignatureHelpOptions(org.eclipse.lsp4j.SignatureHelpOptions) InitializeResult(org.eclipse.lsp4j.InitializeResult) ServerCapabilities(org.eclipse.lsp4j.ServerCapabilities)

Aggregations

InitializeResult (org.eclipse.lsp4j.InitializeResult)15 ServerCapabilities (org.eclipse.lsp4j.ServerCapabilities)7 AbstractProjectsManagerBasedTest (org.eclipse.jdt.ls.core.internal.managers.AbstractProjectsManagerBasedTest)4 ClientPreferences (org.eclipse.jdt.ls.core.internal.preferences.ClientPreferences)4 ClientCapabilities (org.eclipse.lsp4j.ClientCapabilities)4 CompletionOptions (org.eclipse.lsp4j.CompletionOptions)4 ExecuteCommandOptions (org.eclipse.lsp4j.ExecuteCommandOptions)4 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)3 InitializeParams (org.eclipse.lsp4j.InitializeParams)3 SignatureHelpOptions (org.eclipse.lsp4j.SignatureHelpOptions)3 TextDocumentSyncOptions (org.eclipse.lsp4j.TextDocumentSyncOptions)3 URI (java.net.URI)2 Map (java.util.Map)2 CodeLensOptions (org.eclipse.lsp4j.CodeLensOptions)2 ExecuteCommandCapabilities (org.eclipse.lsp4j.ExecuteCommandCapabilities)2 SaveOptions (org.eclipse.lsp4j.SaveOptions)2 WorkspaceClientCapabilities (org.eclipse.lsp4j.WorkspaceClientCapabilities)2 WorkspaceServerCapabilities (org.eclipse.lsp4j.WorkspaceServerCapabilities)2 ResponseMessage (org.eclipse.lsp4j.jsonrpc.messages.ResponseMessage)2