@spyglassmc/language-server 0.3.0 → 0.4.0

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 CHANGED
@@ -73,15 +73,12 @@ connection.onInitialize(async (params) => {
73
73
  },
74
74
  });
75
75
  service.project
76
- .on('documentErrorred', ({ doc, errors }) => {
76
+ .on('documentErrored', ({ errors, uri, version }) => {
77
77
  connection.sendDiagnostics({
78
- diagnostics: toLS.diagnostics(errors, doc),
79
- uri: doc.uri,
80
- version: doc.version,
78
+ diagnostics: toLS.diagnostics(errors),
79
+ uri: uri,
80
+ version: version,
81
81
  });
82
- })
83
- .on('documentRemoved', ({ uri }) => {
84
- connection.sendDiagnostics({ uri, diagnostics: [] });
85
82
  })
86
83
  .on('ready', () => {
87
84
  progressReporter?.done();
@@ -278,8 +275,7 @@ connection.onRequest('spyglassmc/inlayHints', async ({ textDocument: { uri }, ra
278
275
  return toLS.inlayHints(hints, doc);
279
276
  });
280
277
  connection.onRequest('spyglassmc/resetProjectCache', async () => {
281
- service.project.resetCache();
282
- return service.project.restart();
278
+ return service.project.resetCache();
283
279
  });
284
280
  connection.onRequest('spyglassmc/showCacheRoot', async () => {
285
281
  return service.project.showCacheRoot();
@@ -7,8 +7,8 @@ export declare function colorInformation(info: core.ColorInfo, doc: TextDocument
7
7
  export declare function colorInformationArray(info: core.ColorInfo[], doc: TextDocument): ls.ColorInformation[];
8
8
  export declare function colorPresentation(presentation: core.ColorPresentation, doc: TextDocument): ls.ColorPresentation;
9
9
  export declare function colorPresentationArray(presentation: core.ColorPresentation[], doc: TextDocument): ls.ColorPresentation[];
10
- export declare function diagnostic(error: core.LanguageError, doc: TextDocument): ls.Diagnostic;
11
- export declare function diagnostics(errors: readonly core.LanguageError[], doc: TextDocument): ls.Diagnostic[];
10
+ export declare function diagnostic(error: core.PosRangeLanguageError): ls.Diagnostic;
11
+ export declare function diagnostics(errors: readonly core.PosRangeLanguageError[]): ls.Diagnostic[];
12
12
  export declare function diagnosticSeverity(severity: core.ErrorSeverity): ls.DiagnosticSeverity;
13
13
  export declare function documentHighlight(locations: core.SymbolLocations | undefined): ls.DocumentHighlight[] | undefined;
14
14
  export declare function documentSelector(meta: core.MetaRegistry): ls.DocumentSelector;
package/lib/util/toLS.js CHANGED
@@ -24,8 +24,8 @@ export function colorPresentation(presentation, doc) {
24
24
  export function colorPresentationArray(presentation, doc) {
25
25
  return presentation.map(p => colorPresentation(p, doc));
26
26
  }
27
- export function diagnostic(error, doc) {
28
- const ans = ls.Diagnostic.create(range(error.range, doc), error.message, diagnosticSeverity(error.severity), undefined, 'spyglassmc');
27
+ export function diagnostic(error) {
28
+ const ans = ls.Diagnostic.create(error.posRange, error.message, diagnosticSeverity(error.severity), undefined, 'spyglassmc');
29
29
  if (error.info?.deprecated) {
30
30
  (ans.tags ??= [])?.push(ls.DiagnosticTag.Deprecated);
31
31
  }
@@ -45,8 +45,8 @@ export function diagnostic(error, doc) {
45
45
  }
46
46
  return ans;
47
47
  }
48
- export function diagnostics(errors, doc) {
49
- return errors.map(e => diagnostic(e, doc));
48
+ export function diagnostics(errors) {
49
+ return errors.map(e => diagnostic(e));
50
50
  }
51
51
  export function diagnosticSeverity(severity) {
52
52
  switch (severity) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spyglassmc/language-server",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "main": "lib/server.js",
6
6
  "types": "lib/server.d.ts",
@@ -21,10 +21,10 @@
21
21
  "env-paths": "^2.2.1",
22
22
  "vscode-languageserver": "^7.0.0",
23
23
  "vscode-languageserver-textdocument": "^1.0.1",
24
- "@spyglassmc/core": "0.3.0",
25
- "@spyglassmc/java-edition": "0.3.0",
24
+ "@spyglassmc/core": "0.4.0",
25
+ "@spyglassmc/java-edition": "0.3.1",
26
26
  "@spyglassmc/locales": "0.3.0",
27
- "@spyglassmc/mcdoc": "0.3.0"
27
+ "@spyglassmc/mcdoc": "0.3.1"
28
28
  },
29
29
  "publishConfig": {
30
30
  "access": "public"