Skip to content

Commit c88af4e

Browse files
committed
Add workspace/configuration for Yaml Language Server
Yaml LS requires it to be properly configured, or it fails are many things (eg retrieving schemas)
1 parent 8885ff6 commit c88af4e

File tree

7 files changed

+31
-11
lines changed

7 files changed

+31
-11
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
source.. = src/,\
2-
resources/
1+
source.. = src/
32
output.. = bin/
43
bin.includes = META-INF/,\
54
testProjects/,\
5+
resources/,\
66
.,\
77
plugin.xml

org.eclipse.wildwebdeveloper.tests/plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</schema>
1010
<schema
1111
pattern="depp.yml"
12-
url="platform:/plugin/org.eclipse.wildwebdeveloper.tests/dependabot.json">
12+
url="platform:/plugin/org.eclipse.wildwebdeveloper.tests/resources/dependabot.json">
1313
</schema>
1414
</extension>
1515
</plugin>

org.eclipse.wildwebdeveloper/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ target/
22
bin/
33
language-servers/
44
node_modules/
5+
package.json
56
package-lock.json

org.eclipse.wildwebdeveloper/plugin.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@
485485
point="org.eclipse.lsp4e.languageServer">
486486
<server
487487
class="org.eclipse.wildwebdeveloper.yaml.YAMLLanguageServer"
488+
clientImpl="org.eclipse.wildwebdeveloper.yaml.YamlLanguageClientImpl"
488489
id="org.eclipse.wildwebdeveloper.yaml"
489490
label="YAML Language Server (VSCode)"
490491
singleton="true">

org.eclipse.wildwebdeveloper/pom.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,6 @@
151151
<arg>${project.build.directory}/vscode-css-languageserver-1.0.0.tgz</arg>
152152
<arg>${project.build.directory}/vscode-html-languageserver-1.0.0.tgz</arg>
153153
<arg>${project.build.directory}/vscode-json-languageserver-1.3.4.tgz</arg>
154-
<!--
155-
A try to update yaml-language-server to any version up to v.0.22.0
156-
breaks the validation (error markers aren't set on resources):
157-
Failures:
158-
TestYaml.testSchemaExtensionPoint:91->testErrorFile:85 expected: <true> but was: <false>
159-
TestYaml.testSchemaExtensionPointUsingPlatformURL:96->testErrorFile:85 expected: <true> but was: <false>
160-
-->
161154
<arg>[email protected]</arg>
162155
<arg>[email protected]</arg>
163156
<arg>${project.build.directory}/debugger-for-chrome-4.12.12.tgz</arg>

org.eclipse.wildwebdeveloper/src/org/eclipse/wildwebdeveloper/yaml/YAMLLanguageServer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,13 @@ public void handleMessage(Message message, LanguageServer languageServer, URI ro
102102
}
103103
}
104104

105-
private static Map<String, Object> getYamlConfigurationOptions() {
105+
static Map<String, Object> getYamlConfigurationOptions() {
106106
Map<String, Object> yaml = new HashMap<>();
107107
yaml.put(SCHEMAS_KEY, getSchemaAssociations());
108108
yaml.put(VALIDATE_KEY, true);
109109
yaml.put(COMPLETION_KEY, true);
110110
yaml.put(HOVER_KEY, true);
111+
yaml.put("schemaStore.enable", true);
111112
return yaml;
112113
}
113114

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2019 Red Hat Inc. and others.
3+
*
4+
* This program and the accompanying materials are made
5+
* available under the terms of the Eclipse Public License 2.0
6+
* which is available at https://www.eclipse.org/legal/epl-2.0/
7+
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*******************************************************************************/
10+
package org.eclipse.wildwebdeveloper.yaml;
11+
12+
import java.util.List;
13+
import java.util.concurrent.CompletableFuture;
14+
15+
import org.eclipse.lsp4e.LanguageClientImpl;
16+
import org.eclipse.lsp4j.ConfigurationParams;
17+
18+
public class YamlLanguageClientImpl extends LanguageClientImpl {
19+
20+
@Override
21+
public CompletableFuture<List<Object>> configuration(ConfigurationParams configurationParams) {
22+
return CompletableFuture.completedFuture(List.of(YAMLLanguageServer.getYamlConfigurationOptions()));
23+
}
24+
}

0 commit comments

Comments
 (0)