Skip to content

Commit

Permalink
Support for Syntactic and Semantic server modes for vue
Browse files Browse the repository at this point in the history
  • Loading branch information
zulus committed Oct 2, 2023
1 parent 33ab7ea commit 78c37cf
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
14 changes: 12 additions & 2 deletions org.eclipse.wildwebdeveloper/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -779,8 +779,19 @@
clientImpl="org.eclipse.wildwebdeveloper.vue.VueClientImpl"
serverInterface="org.eclipse.wildwebdeveloper.vue.VueLanguageServerAPI"
id="org.eclipse.wildwebdeveloper.vue"
singleton="true"
label="VUE Language Server"/>
<contentTypeMapping contentType="org.eclipse.wildwebdeveloper.vue" id="org.eclipse.wildwebdeveloper.vue"/>
<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">
Expand Down Expand Up @@ -809,7 +820,6 @@
path="grammars/vue/vue-sfc-style-variable-injection.json"
scopeName="vue.sfc.style.variable.injection">
</grammar>

</extension>

<extension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,20 @@
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.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.lsp4e.server.ProcessStreamConnectionProvider;
import org.eclipse.wildwebdeveloper.Activator;
import org.eclipse.wildwebdeveloper.embedder.node.NodeJSManager;

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

public VueLanguageServer() {

Expand Down Expand Up @@ -74,7 +78,7 @@ public Object getInitializationOptions(URI rootUri) {

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

Expand All @@ -90,4 +94,13 @@ public Object getInitializationOptions(URI rootUri) {
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 78c37cf

Please sign in to comment.