org.eclipse.lsp4j.DidChangeConfigurationParams Java Examples

The following examples show how to use org.eclipse.lsp4j.DidChangeConfigurationParams. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TeiidDdlWorkspaceService.java    From syndesis with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public void didChangeConfiguration(DidChangeConfigurationParams params) {

    if (!(params.getSettings() instanceof JsonObject)) {
        return;
    }

    JsonObject settings = (JsonObject) params.getSettings();

    if (settings.has(VIRTUALIZATION_NAME_ID)) {
        JsonElement element = settings.get(VIRTUALIZATION_NAME_ID);
        String virtualizationName = element.getAsString();
        if (virtualizationName != null) {
            LOGGER.info("Setting language server metadata scope to the virtualization: " + virtualizationName);
            this.currentVirtualizationName = virtualizationName;
        }
    }
}
 
Example #2
Source File: YAMLLanguageServer.java    From wildwebdeveloper with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void handleMessage(Message message, LanguageServer languageServer, URI rootUri) {
	IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
	String schemaStr = preferenceStore.getString(YAMLPreferenceInitializer.YAML_SCHEMA_PREFERENCE);
	if (cachedSchema == null || !schemaStr.equals(cachedSchema)) {
		cachedSchema = schemaStr;
		Map<String, Object> schemas = new Gson().fromJson(schemaStr, new TypeToken<HashMap<String, Object>>() {}.getType());
		Map<String, Object> yaml = new HashMap<>();
		yaml.put("schemas", schemas);
		yaml.put("validate", true);
		yaml.put("completion", true);
		yaml.put("hover", true);
		
		Map<String, Object> settings = new HashMap<>();
		settings.put("yaml", yaml);
		
		DidChangeConfigurationParams params = new DidChangeConfigurationParams(settings);
		languageServer.getWorkspaceService().didChangeConfiguration(params);
	}
}
 
Example #3
Source File: HTMLLanguageServer.java    From wildwebdeveloper with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void handleMessage(Message message, LanguageServer languageServer, URI rootUri) {
	if (message instanceof ResponseMessage) {
		ResponseMessage responseMessage = (ResponseMessage) message;
		if (responseMessage.getResult() instanceof InitializeResult) {
			Map<String, Object> htmlOptions = new HashMap<>();

			Map<String, Object> validateOptions = new HashMap<>();
			validateOptions.put("scripts", true);
			validateOptions.put("styles", true);
			htmlOptions.put("validate", validateOptions);

			htmlOptions.put("format", Collections.singletonMap("enable", Boolean.TRUE));

			Map<String, Object> html = new HashMap<>();
			html.put("html", htmlOptions);

			DidChangeConfigurationParams params = new DidChangeConfigurationParams(html);
			languageServer.getWorkspaceService().didChangeConfiguration(params);
		}
	}
}
 
Example #4
Source File: GroovyServices.java    From groovy-language-server with Apache License 2.0 5 votes vote down vote up
@Override
public void didChangeConfiguration(DidChangeConfigurationParams params) {
	if (!(params.getSettings() instanceof JsonObject)) {
		return;
	}
	JsonObject settings = (JsonObject) params.getSettings();
	this.updateClasspath(settings);
}
 
Example #5
Source File: LanguageServerImpl.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void didChangeConfiguration(DidChangeConfigurationParams params) {
	requestManager.runWrite(() -> {
		workspaceManager.refreshWorkspaceConfig(CancelIndicator.NullImpl);
		return null;
	}, (a, b) -> null);
}
 
Example #6
Source File: ActionScriptServices.java    From vscode-as3mxml with Apache License 2.0 5 votes vote down vote up
@Override
public void didChangeConfiguration(DidChangeConfigurationParams params)
{
	if(!(params.getSettings() instanceof JsonObject))
	{
		return;
	}
	JsonObject settings = (JsonObject) params.getSettings();
	this.updateSDK(settings);
	this.updateRealTimeProblems(settings);
       this.updateSourcePathWarning(settings);
       this.updateJVMArgs(settings);
}
 
Example #7
Source File: JDTLanguageServerTest.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
@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);
	}
}
 
Example #8
Source File: SyntaxLanguageServer.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void didChangeConfiguration(DidChangeConfigurationParams params) {
	logInfo(">> workspace/didChangeConfiguration");
	Object settings = JSONUtility.toModel(params.getSettings(), Map.class);
	if (settings instanceof Map) {
		Collection<IPath> rootPaths = preferenceManager.getPreferences().getRootPaths();
		@SuppressWarnings("unchecked")
		Preferences prefs = Preferences.createFrom((Map<String, Object>) settings);
		prefs.setRootPaths(rootPaths);
		preferenceManager.update(prefs);
	}
}
 
Example #9
Source File: RustManager.java    From corrosion with Eclipse Public License 2.0 5 votes vote down vote up
private static void sendDidChangeConfigurationsMessage(Map<String, String> updatedSettings) {
	DidChangeConfigurationParams params = new DidChangeConfigurationParams();
	params.setSettings(updatedSettings);
	LSPDocumentInfo info = infoFromOpenEditors();
	if (info != null) {
		info.getInitializedLanguageClient()
				.thenAccept(languageServer -> languageServer.getWorkspaceService().didChangeConfiguration(params));
	}
}
 
Example #10
Source File: XMLLanguageServer.java    From wildwebdeveloper with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void propertyChange(PropertyChangeEvent event) {
	// TODO Auto-generated method stub
	if (XMLPreferenceInitializer.XML_PREFERENCES_CATAGLOGS.equals(event.getProperty())) {
		Map<String, Object> config = mergeCustomInitializationOptions(extensionJarRegistry.getInitiatizationOptions());
		DidChangeConfigurationParams params = new DidChangeConfigurationParams(
				Collections.singletonMap(XML_KEY, ((Map)config.get(SETTINGS_KEY)).get(XML_KEY)));
		LanguageServiceAccessor.getActiveLanguageServers(null).stream().filter(server -> lemminxDefinition.equals(LanguageServiceAccessor.resolveServerDefinition(server).get()))
			.forEach(ls -> ls.getWorkspaceService().didChangeConfiguration(params));
	}
}
 
Example #11
Source File: CSSLanguageServer.java    From wildwebdeveloper with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void handleMessage(Message message, LanguageServer languageServer, URI rootUri) {
	if (message instanceof ResponseMessage) {
		ResponseMessage responseMessage = (ResponseMessage)message;
		if (responseMessage.getResult() instanceof InitializeResult) {
			// enable validation: so far, no better way found than changing conf after init.
			DidChangeConfigurationParams params = new DidChangeConfigurationParams(getInitializationOptions(rootUri));
			languageServer.getWorkspaceService().didChangeConfiguration(params);
		}
	}
}
 
Example #12
Source File: CamelExtraComponentTest.java    From camel-language-server with Apache License 2.0 5 votes vote down vote up
@Test
void testUpdateOfConfig() throws Exception {
	CamelLanguageServer camelLanguageServer = initializeLanguageServer("<from uri=\"\" xmlns=\"http://camel.apache.org/schema/blueprint\"></from>\n");
	CompletableFuture<Either<List<CompletionItem>, CompletionList>> completions = getCompletionFor(camelLanguageServer, new Position(0, 11));
	assertThat(completions.get().getLeft()).contains(createBasicExpectedCompletionItem());
	
	
	String component = "{\n" + 
			" \"component\": {\n" + 
			"    \"kind\": \"component\",\n" + 
			"    \"scheme\": \"aSecondcomponent\",\n" + 
			"    \"syntax\": \"aSecondcomponent:withsyntax\",\n" + 
			"    \"title\": \"A Second Component\",\n" + 
			"    \"description\": \"Description of my second component.\",\n" + 
			"    \"label\": \"\",\n" + 
			"    \"deprecated\": false,\n" + 
			"    \"deprecationNote\": \"\",\n" + 
			"    \"async\": false,\n" + 
			"    \"consumerOnly\": true,\n" + 
			"    \"producerOnly\": false,\n" + 
			"    \"lenientProperties\": false,\n" + 
			"    \"javaType\": \"org.test.ASecondComponent\",\n" + 
			"    \"firstVersion\": \"1.0.0\",\n" + 
			"    \"groupId\": \"org.test\",\n" + 
			"    \"artifactId\": \"camel-asecondcomponent\",\n" + 
			"    \"version\": \"3.0.0-RC3\"\n" + 
			"  },\n" + 
			"  \"componentProperties\": {\n" + 
			"  },\n" + 
			"  \"properties\": {\n" + 
			"  }\n" + 
			"}";
	DidChangeConfigurationParams params = new DidChangeConfigurationParams(createMapSettingsWithComponent(component));
	camelLanguageServer.getWorkspaceService().didChangeConfiguration(params);
	
	assertThat(getCompletionFor(camelLanguageServer, new Position(0, 11)).get().getLeft())
	.contains(createExpectedExtraComponentCompletionItem(0, 11, 0, 11, "aSecondcomponent:withsyntax", "Description of my second component."));
}
 
Example #13
Source File: RdfLintLanguageServer.java    From rdflint with MIT License 4 votes vote down vote up
@Override
public void didChangeConfiguration(DidChangeConfigurationParams params) {
}
 
Example #14
Source File: XLanguageServerImpl.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void didChangeConfiguration(DidChangeConfigurationParams params) {
	reinitWorkspace();
}
 
Example #15
Source File: WorkspaceServiceImpl.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public void didChangeConfiguration(DidChangeConfigurationParams arg0) {
    //TODO: no real configuration right now
}
 
Example #16
Source File: SettingsManager.java    From camel-language-server with Apache License 2.0 4 votes vote down vote up
public void apply(DidChangeConfigurationParams params) {
	applySettings(params.getSettings());
}
 
Example #17
Source File: CamelWorkspaceService.java    From camel-language-server with Apache License 2.0 4 votes vote down vote up
@Override
public void didChangeConfiguration(DidChangeConfigurationParams params) {
	Object settings = params.getSettings();
	settingsManager.apply(params);
	LOGGER.info("SERVER: changeConfig: settings -> {}", settings);
}
 
Example #18
Source File: XMLWorkspaceService.java    From lemminx with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void didChangeConfiguration(DidChangeConfigurationParams params) {
	xmlLanguageServer.updateSettings(params.getSettings());
	xmlLanguageServer.capabilityManager.syncDynamicCapabilitiesWithPreferences();
}
 
Example #19
Source File: IntellijLanguageClient.java    From lsp4intellij with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("unused")
public static void didChangeConfiguration(@NotNull DidChangeConfigurationParams params, @NotNull Project project) {
    final Set<LanguageServerWrapper> serverWrappers = IntellijLanguageClient.getProjectToLanguageWrappers()
            .get(FileUtils.projectToUri(project));
    serverWrappers.forEach(s -> s.getRequestManager().didChangeConfiguration(params));
}
 
Example #20
Source File: MockLanguageServer.java    From lsp4j with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void didChangeConfiguration(DidChangeConfigurationParams params) {
}
 
Example #21
Source File: WorkspaceServiceStub.java    From saros with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void didChangeConfiguration(DidChangeConfigurationParams params) {
  log.info("didChangeConfiguration");
}
 
Example #22
Source File: CamelCatalogVersionTest.java    From camel-language-server with Apache License 2.0 3 votes vote down vote up
@Test
void testUpdateOfConfig() throws Exception {
	camelCatalogVersion = "3.0.0-RC3";
	
	CamelLanguageServer camelLanguageServer = basicCompletionCheckBefore3_3();
	
	assertThat(camelLanguageServer.getTextDocumentService().getCamelCatalog().get().getLoadedVersion()).isEqualTo(camelCatalogVersion);
	
	DidChangeConfigurationParams params = new DidChangeConfigurationParams(createMapSettingsWithVersion("2.23.4"));
	camelLanguageServer.getWorkspaceService().didChangeConfiguration(params);
	
	checkLoadedCamelCatalogVersion(camelLanguageServer, "2.23.4");
}
 
Example #23
Source File: WorkspaceService.java    From lsp4j with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * A notification sent from the client to the server to signal the change of
 * configuration settings.
 */
@JsonNotification
void didChangeConfiguration(DidChangeConfigurationParams params);