@valbuild/language-server 0.107.0 → 0.108.1

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.
@@ -7,12 +7,6 @@ import type { ValModuleContent } from "./ValProject.js";
7
7
  import { minimalTextEdit } from "./textEdit.js";
8
8
  export { minimalTextEdit };
9
9
  export declare function isLocalFix(fix: string): fix is ValidationFix;
10
- /**
11
- * Build quick fixes for the diagnostics the client sent back.
12
- *
13
- * The client returns our `Diagnostic.data` verbatim, which is where the source
14
- * path and available fixes come from — no re-deriving them from a code string.
15
- */
16
10
  export declare function createValCodeActions({ document, diagnostics, content, valRoot, moduleFilePath, remoteHost, }: {
17
11
  document: TextDocument;
18
12
  diagnostics: Diagnostic[];
@@ -1904,6 +1904,15 @@ function isLocalFix(fix) {
1904
1904
  * The client returns our `Diagnostic.data` verbatim, which is where the source
1905
1905
  * path and available fixes come from — no re-deriving them from a code string.
1906
1906
  */
1907
+ /**
1908
+ * LSP 10 widened `Diagnostic.message` to `string | MarkupContent`. Every
1909
+ * diagnostic this server produces carries a plain string (see `diagnostics.ts`),
1910
+ * but the type no longer says so, and both the remote-fix command arguments and
1911
+ * `ValidationError.message` are strings.
1912
+ */
1913
+ function diagnosticMessage(message) {
1914
+ return vscodeLanguageserver.MarkupContent.is(message) ? message.value : message;
1915
+ }
1907
1916
  async function createValCodeActions({
1908
1917
  document,
1909
1918
  diagnostics,
@@ -1932,7 +1941,7 @@ async function createValCodeActions({
1932
1941
  moduleFilePath,
1933
1942
  sourcePath: data.sourcePath,
1934
1943
  fix,
1935
- message: diagnostic.message,
1944
+ message: diagnosticMessage(diagnostic.message),
1936
1945
  ...(data.value !== undefined ? {
1937
1946
  value: data.value
1938
1947
  } : {})
@@ -1959,7 +1968,7 @@ async function createValCodeActions({
1959
1968
  // createFixPatch works one fix at a time; give it exactly this one so a
1960
1969
  // failing sibling fix cannot suppress this action.
1961
1970
  validationError: {
1962
- message: diagnostic.message,
1971
+ message: diagnosticMessage(diagnostic.message),
1963
1972
  value: data.value,
1964
1973
  fixes: [fix]
1965
1974
  },
@@ -1904,6 +1904,15 @@ function isLocalFix(fix) {
1904
1904
  * The client returns our `Diagnostic.data` verbatim, which is where the source
1905
1905
  * path and available fixes come from — no re-deriving them from a code string.
1906
1906
  */
1907
+ /**
1908
+ * LSP 10 widened `Diagnostic.message` to `string | MarkupContent`. Every
1909
+ * diagnostic this server produces carries a plain string (see `diagnostics.ts`),
1910
+ * but the type no longer says so, and both the remote-fix command arguments and
1911
+ * `ValidationError.message` are strings.
1912
+ */
1913
+ function diagnosticMessage(message) {
1914
+ return vscodeLanguageserver.MarkupContent.is(message) ? message.value : message;
1915
+ }
1907
1916
  async function createValCodeActions({
1908
1917
  document,
1909
1918
  diagnostics,
@@ -1932,7 +1941,7 @@ async function createValCodeActions({
1932
1941
  moduleFilePath,
1933
1942
  sourcePath: data.sourcePath,
1934
1943
  fix,
1935
- message: diagnostic.message,
1944
+ message: diagnosticMessage(diagnostic.message),
1936
1945
  ...(data.value !== undefined ? {
1937
1946
  value: data.value
1938
1947
  } : {})
@@ -1959,7 +1968,7 @@ async function createValCodeActions({
1959
1968
  // createFixPatch works one fix at a time; give it exactly this one so a
1960
1969
  // failing sibling fix cannot suppress this action.
1961
1970
  validationError: {
1962
- message: diagnostic.message,
1971
+ message: diagnosticMessage(diagnostic.message),
1963
1972
  value: data.value,
1964
1973
  fixes: [fix]
1965
1974
  },
@@ -3,7 +3,7 @@ import path from 'path';
3
3
  import ts from 'typescript';
4
4
  import { Internal, DEFAULT_VAL_REMOTE_HOST, DEFAULT_CONTENT_HOST } from '@valbuild/core';
5
5
  import { fixHandlers, createService, analyzeValModule, parsePersonalAccessTokenFile, getPersonalAccessTokenPath, startValLogin, awaitValLoginConfirmation, persistPersonalAccessToken, ValLoginError, findAndEvalValConfigFile, createFixPatch, patchSourceFile, getSettings, uploadRemoteFile, extractImageMetadata, extractFileMetadata } from '@valbuild/server';
6
- import { DiagnosticSeverity, ShowDocumentRequest, ApplyWorkspaceEditRequest, CodeActionKind, CodeAction, CompletionItemKind, DidChangeWatchedFilesNotification } from 'vscode-languageserver';
6
+ import { DiagnosticSeverity, ShowDocumentRequest, ApplyWorkspaceEditRequest, CodeActionKind, CodeAction, MarkupContent, CompletionItemKind, DidChangeWatchedFilesNotification } from 'vscode-languageserver';
7
7
  import { TextDocuments, TextDocumentSyncKind, createConnection, ProposedFeatures } from 'vscode-languageserver/node';
8
8
  import { TextDocument } from 'vscode-languageserver-textdocument';
9
9
  import crypto from 'crypto';
@@ -1893,6 +1893,15 @@ function isLocalFix(fix) {
1893
1893
  * The client returns our `Diagnostic.data` verbatim, which is where the source
1894
1894
  * path and available fixes come from — no re-deriving them from a code string.
1895
1895
  */
1896
+ /**
1897
+ * LSP 10 widened `Diagnostic.message` to `string | MarkupContent`. Every
1898
+ * diagnostic this server produces carries a plain string (see `diagnostics.ts`),
1899
+ * but the type no longer says so, and both the remote-fix command arguments and
1900
+ * `ValidationError.message` are strings.
1901
+ */
1902
+ function diagnosticMessage(message) {
1903
+ return MarkupContent.is(message) ? message.value : message;
1904
+ }
1896
1905
  async function createValCodeActions({
1897
1906
  document,
1898
1907
  diagnostics,
@@ -1921,7 +1930,7 @@ async function createValCodeActions({
1921
1930
  moduleFilePath,
1922
1931
  sourcePath: data.sourcePath,
1923
1932
  fix,
1924
- message: diagnostic.message,
1933
+ message: diagnosticMessage(diagnostic.message),
1925
1934
  ...(data.value !== undefined ? {
1926
1935
  value: data.value
1927
1936
  } : {})
@@ -1948,7 +1957,7 @@ async function createValCodeActions({
1948
1957
  // createFixPatch works one fix at a time; give it exactly this one so a
1949
1958
  // failing sibling fix cannot suppress this action.
1950
1959
  validationError: {
1951
- message: diagnostic.message,
1960
+ message: diagnosticMessage(diagnostic.message),
1952
1961
  value: data.value,
1953
1962
  fixes: [fix]
1954
1963
  },
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "lsp",
12
12
  "language-server"
13
13
  ],
14
- "version": "0.107.0",
14
+ "version": "0.108.1",
15
15
  "bin": {
16
16
  "val-language-server": "./bin.js"
17
17
  },
@@ -26,19 +26,19 @@
26
26
  },
27
27
  "types": "dist/valbuild-language-server.cjs.d.ts",
28
28
  "dependencies": {
29
- "typescript": "^5.9.3",
30
- "vscode-languageserver": "^9.0.1",
31
- "vscode-languageserver-textdocument": "^1.0.11",
29
+ "typescript": "^6.0.3",
30
+ "vscode-languageserver": "^10.1.0",
31
+ "vscode-languageserver-textdocument": "^1.0.14",
32
32
  "@valbuild/core": "0.106.0",
33
- "@valbuild/server": "0.107.0",
34
- "@valbuild/shared": "0.107.0"
33
+ "@valbuild/server": "0.108.1",
34
+ "@valbuild/shared": "0.108.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/jest": "^30.0.0",
38
- "vscode-jsonrpc": "^8.2.0"
38
+ "vscode-jsonrpc": "^9.0.2"
39
39
  },
40
40
  "engines": {
41
- "node": ">=18.17.0"
41
+ "node": "^20.19.0 || >=22"
42
42
  },
43
43
  "files": [
44
44
  "dist",