@spyglassmc/language-server 0.4.42 → 0.4.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/server.js +7 -2
- package/package.json +21 -7
package/lib/server.js
CHANGED
|
@@ -104,8 +104,6 @@ connection.onInitialize(async (params) => {
|
|
|
104
104
|
declarationProvider: {},
|
|
105
105
|
definitionProvider: {},
|
|
106
106
|
implementationProvider: {},
|
|
107
|
-
// TODO: re-enable this
|
|
108
|
-
// documentFormattingProvider: {},
|
|
109
107
|
referencesProvider: {},
|
|
110
108
|
typeDefinitionProvider: {},
|
|
111
109
|
documentHighlightProvider: {},
|
|
@@ -132,6 +130,9 @@ connection.onInitialize(async (params) => {
|
|
|
132
130
|
return ans;
|
|
133
131
|
});
|
|
134
132
|
connection.onInitialized(async () => {
|
|
133
|
+
if (capabilities.textDocument?.formatting?.dynamicRegistration) {
|
|
134
|
+
void connection.client.register(ls.DocumentFormattingRequest.type, { documentSelector: [{ language: 'mcdoc' }] });
|
|
135
|
+
}
|
|
135
136
|
await service.project.ready();
|
|
136
137
|
if (capabilities.workspace?.workspaceFolders) {
|
|
137
138
|
connection.workspace.onDidChangeWorkspaceFolders(async () => {
|
|
@@ -325,6 +326,10 @@ connection.onDocumentFormatting(async ({ textDocument: { uri }, options }) => {
|
|
|
325
326
|
return undefined;
|
|
326
327
|
}
|
|
327
328
|
const { doc, node } = docAndNode;
|
|
329
|
+
if (node.parserErrors.length !== 0) {
|
|
330
|
+
// Don't format if there are errors.
|
|
331
|
+
return undefined;
|
|
332
|
+
}
|
|
328
333
|
let text = service.format(node, doc, options.tabSize, options.insertSpaces);
|
|
329
334
|
if (options.insertFinalNewline && text.charAt(text.length - 1) !== '\n') {
|
|
330
335
|
text += '\n';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spyglassmc/language-server",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.44",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "lib/server.js",
|
|
6
6
|
"types": "lib/server.d.ts",
|
|
@@ -11,20 +11,34 @@
|
|
|
11
11
|
"test": "test"
|
|
12
12
|
},
|
|
13
13
|
"bin": {
|
|
14
|
-
"spyglassmc-language-server": "
|
|
14
|
+
"spyglassmc-language-server": "bin/server.js"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"release": "npm publish",
|
|
18
|
-
"release:dry": "npm publish --dry-run"
|
|
18
|
+
"release:dry": "npm publish --dry-run",
|
|
19
|
+
"build": "wireit",
|
|
20
|
+
"build:dev": "wireit"
|
|
21
|
+
},
|
|
22
|
+
"wireit": {
|
|
23
|
+
"build": {
|
|
24
|
+
"dependencies": [
|
|
25
|
+
"../..:build:packages"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"build:dev": {
|
|
29
|
+
"dependencies": [
|
|
30
|
+
"../..:build:packages"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
19
33
|
},
|
|
20
34
|
"dependencies": {
|
|
21
35
|
"env-paths": "^2.2.1",
|
|
22
36
|
"vscode-languageserver": "^9.0.1",
|
|
23
37
|
"vscode-languageserver-textdocument": "^1.0.11",
|
|
24
|
-
"@spyglassmc/core": "0.4.
|
|
25
|
-
"@spyglassmc/java-edition": "0.3.
|
|
26
|
-
"@spyglassmc/locales": "0.3.
|
|
27
|
-
"@spyglassmc/mcdoc": "0.3.
|
|
38
|
+
"@spyglassmc/core": "0.4.33",
|
|
39
|
+
"@spyglassmc/java-edition": "0.3.44",
|
|
40
|
+
"@spyglassmc/locales": "0.3.17",
|
|
41
|
+
"@spyglassmc/mcdoc": "0.3.37"
|
|
28
42
|
},
|
|
29
43
|
"publishConfig": {
|
|
30
44
|
"access": "public"
|