Search in sources :

Example 1 with DidChangeConfigurationParams

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

the class JDTLanguageServerTest method testRegisterDynamicCapabilities.

@Test
public void testRegisterDynamicCapabilities() throws Exception {
    setDynamicCapabilities(true);
    Map<String, Object> map = new HashMap<>();
    map.put(Preferences.REFERENCES_CODE_LENS_ENABLED_KEY, true);
    map.put(Preferences.JAVA_FORMAT_ENABLED_KEY, true);
    map.put(Preferences.SIGNATURE_HELP_ENABLED_KEY, true);
    map.put(Preferences.EXECUTE_COMMAND_ENABLED_KEY, true);
    DidChangeConfigurationParams params = new DidChangeConfigurationParams(map);
    server.didChangeConfiguration(params);
    verify(client, times(5)).registerCapability(any());
    // On 2nd call, no registration call should be emitted
    reset(client);
    server.didChangeConfiguration(params);
    verify(client, never()).registerCapability(any());
    // unregister capabilities
    reset(client);
    map.put(Preferences.REFERENCES_CODE_LENS_ENABLED_KEY, false);
    map.put(Preferences.JAVA_FORMAT_ENABLED_KEY, false);
    map.put(Preferences.SIGNATURE_HELP_ENABLED_KEY, false);
    map.put(Preferences.EXECUTE_COMMAND_ENABLED_KEY, false);
    params = new DidChangeConfigurationParams(map);
    server.didChangeConfiguration(params);
    verify(client, times(5)).unregisterCapability(any());
    // On 2nd call, no unregistration calls should be emitted
    reset(client);
    server.didChangeConfiguration(params);
    verify(client, never()).unregisterCapability(any());
}
Also used : HashMap(java.util.HashMap) DidChangeConfigurationParams(org.eclipse.lsp4j.DidChangeConfigurationParams) Test(org.junit.Test)

Example 2 with DidChangeConfigurationParams

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

the class JDTLanguageServerTest method testNoDynamicCapabilities.

@Test
public void testNoDynamicCapabilities() throws Exception {
    setDynamicCapabilities(false);
    Map<String, Object> map = new HashMap<>();
    map.put(Preferences.REFERENCES_CODE_LENS_ENABLED_KEY, true);
    map.put(Preferences.JAVA_FORMAT_ENABLED_KEY, true);
    map.put(Preferences.SIGNATURE_HELP_ENABLED_KEY, true);
    map.put(Preferences.EXECUTE_COMMAND_ENABLED_KEY, true);
    DidChangeConfigurationParams params = new DidChangeConfigurationParams(map);
    server.didChangeConfiguration(params);
    verify(client, never()).registerCapability(any());
    // unregister capabilities
    map.put(Preferences.REFERENCES_CODE_LENS_ENABLED_KEY, false);
    map.put(Preferences.JAVA_FORMAT_ENABLED_KEY, false);
    map.put(Preferences.SIGNATURE_HELP_ENABLED_KEY, false);
    map.put(Preferences.EXECUTE_COMMAND_ENABLED_KEY, false);
    params = new DidChangeConfigurationParams(map);
    server.didChangeConfiguration(params);
    verify(client, never()).unregisterCapability(any());
}
Also used : HashMap(java.util.HashMap) DidChangeConfigurationParams(org.eclipse.lsp4j.DidChangeConfigurationParams) Test(org.junit.Test)

Example 3 with DidChangeConfigurationParams

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

the class JDTLanguageServerTest method testAutobuilding.

@Test
public void testAutobuilding() throws Exception {
    boolean enabled = isAutoBuilding();
    try {
        assertTrue("Autobuilding is off", isAutoBuilding());
        Map<String, Object> map = new HashMap<>();
        map.put(Preferences.AUTOBUILD_ENABLED_KEY, false);
        DidChangeConfigurationParams params = new DidChangeConfigurationParams(map);
        server.didChangeConfiguration(params);
        assertFalse("Autobuilding is on", isAutoBuilding());
    } finally {
        projManager.setAutoBuilding(enabled);
    }
}
Also used : HashMap(java.util.HashMap) DidChangeConfigurationParams(org.eclipse.lsp4j.DidChangeConfigurationParams) Test(org.junit.Test)

Example 4 with DidChangeConfigurationParams

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

the class CloudFoundryManifestLanguageServer method updateLanguageServer.

protected void updateLanguageServer() {
    DidChangeConfigurationParams params = new DidChangeConfigurationParams(getInitializationOptions(rootPath));
    languageServer.getWorkspaceService().didChangeConfiguration(params);
}
Also used : DidChangeConfigurationParams(org.eclipse.lsp4j.DidChangeConfigurationParams)

Example 5 with DidChangeConfigurationParams

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

the class DelegatingStreamConnectionProvider method sendConfiguration.

private void sendConfiguration() {
    Map<String, Object> settings = new HashMap<>();
    Map<String, Object> bootJavaObj = new HashMap<>();
    Map<String, Object> bootHint = new HashMap<>();
    bootHint.put("on", BootLanguageServerPlugin.getDefault().getPreferenceStore().getBoolean(Constants.PREF_BOOT_HINTS));
    bootJavaObj.put("boot-hints", bootHint);
    settings.put("boot-java", bootJavaObj);
    this.languageServer.getWorkspaceService().didChangeConfiguration(new DidChangeConfigurationParams(settings));
}
Also used : HashMap(java.util.HashMap) DidChangeConfigurationParams(org.eclipse.lsp4j.DidChangeConfigurationParams)

Aggregations

DidChangeConfigurationParams (org.eclipse.lsp4j.DidChangeConfigurationParams)6 HashMap (java.util.HashMap)4 Test (org.junit.Test)4 JsonParser (com.google.gson.JsonParser)1 InputStreamReader (java.io.InputStreamReader)1 LanguageServerHarness (org.springframework.ide.vscode.languageserver.testharness.LanguageServerHarness)1