Skip to content

Commit

Permalink
Update @vue/language-server to 2.0.19, use @vue/typescript-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
zulus authored and akurtakov committed May 22, 2024
1 parent 6634438 commit 5ec1965
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 33 deletions.
5 changes: 3 additions & 2 deletions org.eclipse.wildwebdeveloper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
"@angular/language-server": "17.3.2",
"firefox-debugadapter": "2.9.9",
"typescript": "5.4.5",
"typescript-language-server": "4.0.0",
"typescript-language-server": "4.3.3",
"typescript-lit-html-plugin": "0.9.0",
"typescript-plugin-css-modules": "5.1.0",
"yaml-language-server": "1.14.0",
"vscode-languageserver-types": "3.17.5",
"vscode-css-languageservice": "6.2.14",
"vscode-html-languageservice": "5.2.0",
"vscode-json-languageservice": "5.3.11",
"@vue/language-server" : "1.8.27",
"@vue/language-server" : "2.0.19",
"@vue/typescript-plugin" : "2.0.19",
"fsevents" : "2.3.3",
"vscode-css-languageserver": "file:target/vscode-css-languageserver-1.0.0.tgz",
"vscode-html-languageserver": "file:target/vscode-html-languageserver-1.0.0.tgz",
Expand Down
15 changes: 5 additions & 10 deletions org.eclipse.wildwebdeveloper/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,11 @@
contentType="org.eclipse.wildwebdeveloper.tsx"
id="org.eclipse.wildwebdeveloper.jsts">
</contentTypeMapping>
<contentTypeMapping
languageId="vue"
contentType="org.eclipse.wildwebdeveloper.vue"
id="org.eclipse.wildwebdeveloper.jsts">
</contentTypeMapping>
<server
class="org.eclipse.wildwebdeveloper.eslint.ESLintLanguageServer"
id="org.eclipse.wildwebdeveloper.eslint"
Expand Down Expand Up @@ -714,16 +719,6 @@
label="VUE Language Server"/>
<contentTypeMapping contentType="org.eclipse.wildwebdeveloper.vue" languageId="vue" id="org.eclipse.wildwebdeveloper.vue"/>
</extension>
<extension point="org.eclipse.lsp4e.languageServer">
<server
class="org.eclipse.wildwebdeveloper.vue.VueLanguageServer"
clientImpl="org.eclipse.wildwebdeveloper.vue.VueClientImpl"
serverInterface="org.eclipse.wildwebdeveloper.vue.VueLanguageServerAPI"
id="org.eclipse.wildwebdeveloper.vue.syntax"
singleton="true"
label="VUE Language Server Syntax"/>
<contentTypeMapping contentType="org.eclipse.wildwebdeveloper.vue" languageId="vue" id="org.eclipse.wildwebdeveloper.vue.syntax"/>
</extension>
<extension
point="org.eclipse.tm4e.registry.grammars">
<grammar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ public JSTSLanguageServer() {
commands.add(new File(url.getPath()).getAbsolutePath());
commands.add("--stdio");
setCommands(commands);
URL nodeDependencies = FileLocator.toFileURL(getClass().getResource("/"));
setWorkingDirectory(nodeDependencies.getPath()); // Required for typescript-eslint-language-service to find
//URL nodeDependencies = FileLocator.toFileURL(getClass().getResource("/"));
//setWorkingDirectory(nodeDependencies.getPath()); // Required for typescript-eslint-language-service to find
// it's dependencies

} catch (IOException e) {
Expand All @@ -77,13 +77,15 @@ public Object getInitializationOptions(URI rootUri) {
// plugins.add(new TypeScriptPlugin("@angular/language-service"));
plugins.add(new TypeScriptPlugin("typescript-plugin-css-modules"));
plugins.add(new TypeScriptPlugin("typescript-lit-html-plugin"));
plugins.add(new TypeScriptPlugin("@vue/typescript-plugin", new String[] {"vue"}));
options.put("plugins", plugins.stream().map(TypeScriptPlugin::toMap).toArray());

// If the tsserver path is not explicitly specified, tsserver will use the local
// TypeScript version installed as part of the project's dependencies, if found.
if (!TYPESCRIPT_PREFERENCES_TSSERVER_TYPESCRIPT_VERSION_PROJECT.equals(getTypeScriptVersion())) {
Map<String, String> tsServer = new HashMap<>();
tsServer.put("path", tsserverPath);
tsServer.put("nodePath", NodeJSManager.getNodeJsLocation().getAbsolutePath());
options.put("tsserver", tsServer);
}
} catch (IOException e) {
Expand All @@ -93,6 +95,11 @@ public Object getInitializationOptions(URI rootUri) {
if (maxTsServerMemory != null) {
options.put("maxTsServerMemory", maxTsServerMemory);
}

options.put("disableAutomaticTypingAcquisition", true); // not working on mac/linux
options.put("hostInfo", "Eclipse");
options.put("watchOptions", new HashMap<>());

return options;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,24 @@
public class TypeScriptPlugin {
private String pluginName;
private String pluginProbeLocation;
private String[] pluginLanguages;

public TypeScriptPlugin(String name) throws IOException {
this(name, null);
}

public TypeScriptPlugin(String name, String[] languages) throws IOException {
pluginName = name;
URL fileURL = FileLocator.toFileURL(getClass().getResource("/node_modules/" + name));
pluginProbeLocation = new File(fileURL.getPath()).getAbsolutePath();
pluginLanguages = languages;
}

public Map<String, String> toMap() {
Map<String, String> tsPlugin = new HashMap<>();
public Map<String, Object> toMap() {
Map<String, Object> tsPlugin = new HashMap<>();
tsPlugin.put("name", pluginName);
tsPlugin.put("location", pluginProbeLocation);
tsPlugin.put("languages", pluginLanguages);
return tsPlugin;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,14 @@
import java.util.List;
import java.util.Map;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExecutableExtension;
import org.eclipse.core.runtime.ILog;
import org.eclipse.lsp4e.server.ProcessStreamConnectionProvider;
import org.eclipse.wildwebdeveloper.embedder.node.NodeJSManager;

public class VueLanguageServer extends ProcessStreamConnectionProvider implements IExecutableExtension {
public class VueLanguageServer extends ProcessStreamConnectionProvider {
private static String tsserverPath = null;
private static String vuePath = null;
private int mode = 1;

public VueLanguageServer() {

Expand Down Expand Up @@ -74,16 +70,19 @@ public Object getInitializationOptions(URI rootUri) {
setWorkingDirectory(rootUri.getRawPath());

options.put("typescript", Collections.singletonMap("tsdk", tsserverPath));
options.put("fullCompletionList", false);
options.put("serverMode", mode);
options.put("diagnosticModel", 1);
options.put("diagnosticModel", 0);
options.put("additionalExtensions", new String[] {});

Map<String, Object> legend = new HashMap<>();
legend.put("tokenTypes", new String[] {"compontent"} );
legend.put("tokenTypes", new String[] {"component"} );
legend.put("tokenModifiers", new String[] {} );
options.put("semanticTokensLegend", legend);

Map<String, Object> vue = new HashMap<>();
vue.put("hybridMode", false);

options.put("vue", vue);

return options;
}

Expand All @@ -92,12 +91,5 @@ public String toString() {
return "VUE Language Server: " + super.toString();
}

@Override
public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
throws CoreException {
if (config.getAttribute("id").contains("syntax")) {
mode = 2;
}

}

}

0 comments on commit 5ec1965

Please sign in to comment.