|
29 | 29 | import org.eclipse.core.runtime.FileLocator; |
30 | 30 | import org.eclipse.core.runtime.IStatus; |
31 | 31 | import org.eclipse.core.runtime.Status; |
32 | | -import org.eclipse.lsp4j.DidChangeConfigurationParams; |
33 | | -import org.eclipse.lsp4j.InitializeResult; |
34 | | -import org.eclipse.lsp4j.jsonrpc.messages.Message; |
35 | | -import org.eclipse.lsp4j.jsonrpc.messages.ResponseMessage; |
36 | | -import org.eclipse.lsp4j.services.LanguageServer; |
| 32 | +import org.eclipse.lsp4e.server.ProcessStreamConnectionProvider; |
37 | 33 | import org.eclipse.wildwebdeveloper.Activator; |
38 | 34 | import org.eclipse.wildwebdeveloper.embedder.node.NodeJSManager; |
39 | | -import org.eclipse.wildwebdeveloper.jsts.ui.preferences.javascript.JavaScriptPreferenceServerConstants; |
40 | | -import org.eclipse.wildwebdeveloper.jsts.ui.preferences.typescript.TypeScriptPreferenceServerConstants; |
41 | | -import org.eclipse.wildwebdeveloper.ui.preferences.ProcessStreamConnectionProviderWithPreference; |
42 | 35 |
|
43 | | -public class JSTSLanguageServer extends ProcessStreamConnectionProviderWithPreference { |
44 | | - |
45 | | - private static final String JSTS_LANGUAGE_SERVER_ID = "org.eclipse.wildwebdeveloper.jsts"; |
46 | | - |
47 | | - private static final String[] SUPPORTED_SECTIONS = { "typescript", "javascript" }; |
| 36 | +public class JSTSLanguageServer extends ProcessStreamConnectionProvider { |
48 | 37 |
|
49 | 38 | private static String tsserverPath; |
50 | 39 |
|
51 | 40 | public JSTSLanguageServer() { |
52 | | - super(JSTS_LANGUAGE_SERVER_ID, Activator.getDefault().getPreferenceStore(), SUPPORTED_SECTIONS); |
| 41 | + super(); |
53 | 42 | List<String> commands = new ArrayList<>(); |
54 | 43 | commands.add(NodeJSManager.getNodeJsLocation().getAbsolutePath()); |
55 | 44 | try { |
@@ -99,24 +88,4 @@ public Object getInitializationOptions(URI rootUri) { |
99 | 88 | return options; |
100 | 89 | } |
101 | 90 |
|
102 | | - @Override |
103 | | - protected Object createSettings() { |
104 | | - Map<String, Object> settings = new HashMap<>(); |
105 | | - // javascript |
106 | | - settings.putAll(JavaScriptPreferenceServerConstants.getGlobalSettings()); |
107 | | - // typescript |
108 | | - settings.putAll(TypeScriptPreferenceServerConstants.getGlobalSettings()); |
109 | | - return settings; |
110 | | - } |
111 | | - |
112 | | - @Override |
113 | | - public void handleMessage(Message message, LanguageServer languageServer, URI rootUri) { |
114 | | - if (message instanceof ResponseMessage responseMessage) { |
115 | | - if (responseMessage.getResult() instanceof InitializeResult) { |
116 | | - // enable validation: so far, no better way found than changing conf after init. |
117 | | - DidChangeConfigurationParams params = new DidChangeConfigurationParams(createSettings()); |
118 | | - languageServer.getWorkspaceService().didChangeConfiguration(params); |
119 | | - } |
120 | | - } |
121 | | - } |
122 | 91 | } |
0 commit comments