diff --git a/plugins/plugin-json/che-plugin-json-server/pom.xml b/plugins/plugin-json/che-plugin-json-server/pom.xml
index 899b7f0df1c..9962ba1aec8 100644
--- a/plugins/plugin-json/che-plugin-json-server/pom.xml
+++ b/plugins/plugin-json/che-plugin-json-server/pom.xml
@@ -32,6 +32,10 @@
com.google.inject.extensions
guice-multibindings
+
+ io.typefox.lsapi
+ io.typefox.lsapi
+
io.typefox.lsapi
io.typefox.lsapi.services
diff --git a/plugins/plugin-json/che-plugin-json-server/src/main/java/org/eclipse/che/plugin/json/languageserver/JsonLanguageServer.java b/plugins/plugin-json/che-plugin-json-server/src/main/java/org/eclipse/che/plugin/json/languageserver/JsonLanguageServer.java
new file mode 100644
index 00000000000..3035a62d582
--- /dev/null
+++ b/plugins/plugin-json/che-plugin-json-server/src/main/java/org/eclipse/che/plugin/json/languageserver/JsonLanguageServer.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2012-2016 Codenvy, S.A.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Codenvy, S.A. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.che.plugin.json.languageserver;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.che.api.languageserver.registry.ServerInitializerObserver;
+import org.eclipse.che.api.languageserver.shared.model.LanguageDescription;
+
+import io.typefox.lsapi.ServerCapabilities;
+import io.typefox.lsapi.services.LanguageServer;
+import io.typefox.lsapi.services.json.JsonBasedLanguageServer;
+
+/**
+ * Implements the specifics related to the JSON language server.
+ *
+ * After the Initialize Request the client must send a 'json/schemaAssociations'
+ * notification in order to associate JSON schemas to popular JSON files. This
+ * automatically enables code completion, validation, hover, etc. capabilities
+ * for these files without the need of adding a "$schema" key.
+ *
+ * @author Kaloyan Raev
+ */
+public class JsonLanguageServer extends JsonBasedLanguageServer implements ServerInitializerObserver {
+
+ private final static String JSON_SCHEMA_ASSOCIATIONS = "json/schemaAssociations";
+
+ @Override
+ public void onServerInitialized(LanguageServer server, ServerCapabilities capabilities,
+ LanguageDescription languageDescription, String projectPath) {
+ registerSchemaAssociations();
+ }
+
+ private void registerSchemaAssociations() {
+ Map associations = new HashMap<>();
+ associations.put("/*.schema.json", new String[] { "http://json-schema.org/draft-04/schema#" });
+ associations.put("/bower.json", new String[] { "http://json.schemastore.org/bower" });
+ associations.put("/.bower.json", new String[] { "http://json.schemastore.org/bower" });
+ associations.put("/.bowerrc", new String[] { "http://json.schemastore.org/bowerrc" });
+ associations.put("/composer.json", new String[] { "https://getcomposer.org/schema.json" });
+ associations.put("/package.json", new String[] { "http://json.schemastore.org/package" });
+ associations.put("/jsconfig.json", new String[] { "http://json.schemastore.org/jsconfig" });
+ associations.put("/tsconfig.json", new String[] { "http://json.schemastore.org/tsconfig" });
+
+ sendNotification(JSON_SCHEMA_ASSOCIATIONS, associations);
+ }
+
+}
\ No newline at end of file
diff --git a/plugins/plugin-json/che-plugin-json-server/src/main/java/org/eclipse/che/plugin/json/languageserver/JsonLanguageServerLauncher.java b/plugins/plugin-json/che-plugin-json-server/src/main/java/org/eclipse/che/plugin/json/languageserver/JsonLanguageServerLauncher.java
index 24948ecbd52..71960ae0748 100644
--- a/plugins/plugin-json/che-plugin-json-server/src/main/java/org/eclipse/che/plugin/json/languageserver/JsonLanguageServerLauncher.java
+++ b/plugins/plugin-json/che-plugin-json-server/src/main/java/org/eclipse/che/plugin/json/languageserver/JsonLanguageServerLauncher.java
@@ -64,7 +64,7 @@ public boolean isAbleToLaunch() {
}
protected JsonBasedLanguageServer connectToLanguageServer(Process languageServerProcess) {
- JsonBasedLanguageServer languageServer = new JsonBasedLanguageServer();
+ JsonBasedLanguageServer languageServer = new JsonLanguageServer();
languageServer.connect(languageServerProcess.getInputStream(), languageServerProcess.getOutputStream());
return languageServer;
}
diff --git a/wsagent/che-core-api-languageserver/src/main/java/org/eclipse/che/api/languageserver/registry/ServerInitializerImpl.java b/wsagent/che-core-api-languageserver/src/main/java/org/eclipse/che/api/languageserver/registry/ServerInitializerImpl.java
index 16c6db44f9f..0e78f25053e 100644
--- a/wsagent/che-core-api-languageserver/src/main/java/org/eclipse/che/api/languageserver/registry/ServerInitializerImpl.java
+++ b/wsagent/che-core-api-languageserver/src/main/java/org/eclipse/che/api/languageserver/registry/ServerInitializerImpl.java
@@ -139,6 +139,10 @@ protected void registerCallbacks(LanguageServer server) {
server.getTextDocumentService().onPublishDiagnostics(publishDiagnosticsParamsMessenger::onEvent);
server.getWindowService().onLogMessage(messageParams -> LOG.error(messageParams.getType() + " " + messageParams.getMessage()));
server.onTelemetryEvent(o -> LOG.error(o.toString()));
+
+ if (server instanceof ServerInitializerObserver) {
+ addObserver((ServerInitializerObserver) server);
+ }
}
protected InitializeParamsImpl prepareInitializeParams(String projectPath) {