Java Code Examples for org.eclipse.lsp4j.jsonrpc.messages.ResponseMessage#getResult()

The following examples show how to use org.eclipse.lsp4j.jsonrpc.messages.ResponseMessage#getResult() . 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: 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 2
Source File: MessageHandler.java    From lsp4intellij with Apache License 2.0 5 votes vote down vote up
private void handleMessage(Message message) {
    if (message instanceof ResponseMessage) {
        ResponseMessage responseMessage = (ResponseMessage) message;
        if (responseMessage.getResult() instanceof InitializeResult) {
            listener.initialize(languageServer, (InitializeResult) responseMessage.getResult());
        }
    }
}
 
Example 3
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 4
Source File: JSonLanguageServer.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) {
			// Send json/schemaAssociations notification to register JSON Schema on JSON
			// Language server side.
			JSonLanguageServerInterface server = (JSonLanguageServerInterface) languageServer;
			Map<String, List<String>> schemaAssociations = getSchemaAssociations();
			server.sendJSonchemaAssociations(schemaAssociations);
		}
	}
}