Search in sources :

Example 6 with DidChangeConfigurationParams

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

the class ManifestYamlLanguageServerTest method changeCfClientParams.

@Test
public void changeCfClientParams() throws Exception {
    MockCloudfoundry cloudfoundry = new MockCloudfoundry();
    ManifestYamlLanguageServer manifestYamlLanguageServer = new ManifestYamlLanguageServer(cloudfoundry.factory, cloudfoundry.defaultParamsProvider);
    LanguageServerHarness harness = new LanguageServerHarness(() -> manifestYamlLanguageServer, LanguageId.CF_MANIFEST);
    harness.intialize(null);
    assertEquals(1, manifestYamlLanguageServer.getCfClientConfig().getClientParamsProvider().getParams().size());
    assertEquals(Arrays.asList("test.io"), manifestYamlLanguageServer.getCfTargets());
    DidChangeConfigurationParams params = new DidChangeConfigurationParams();
    JsonParser parser = new JsonParser();
    params.setSettings(parser.parse(new InputStreamReader(getClass().getResourceAsStream("/cf-targets1.json"))));
    manifestYamlLanguageServer.getWorkspaceService().didChangeConfiguration(params);
    assertEquals(3, manifestYamlLanguageServer.getCfClientConfig().getClientParamsProvider().getParams().size());
    assertEquals(Arrays.asList("test.io", "api.system.demo-gcp.springapps.io", "api.run.pivotal.io"), manifestYamlLanguageServer.getCfTargets());
}
Also used : InputStreamReader(java.io.InputStreamReader) LanguageServerHarness(org.springframework.ide.vscode.languageserver.testharness.LanguageServerHarness) DidChangeConfigurationParams(org.eclipse.lsp4j.DidChangeConfigurationParams) JsonParser(com.google.gson.JsonParser) Test(org.junit.Test)

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