@valbuild/language-server 0.126.0 → 0.128.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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @valbuild/language-server
2
2
 
3
+ ## 0.128.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`8b52b33`](https://github.com/valbuild/val/commit/8b52b33e1f629f14f66cc71dcc7cf415d210c7d4), [`362fb49`](https://github.com/valbuild/val/commit/362fb49f30d2b04c4ff78d54dca2bf5ad978a05c), [`c595799`](https://github.com/valbuild/val/commit/c59579977a436ec530c6c69f2b340ab9829d97ab)]:
8
+ - @valbuild/core@0.128.0
9
+ - @valbuild/server@0.128.0
10
+ - @valbuild/shared@0.128.0
11
+
12
+ ## 0.127.0
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [[`7fa8699`](https://github.com/valbuild/val/commit/7fa869974bc895af992a7d5c18b76253636d7d65), [`5b7fe05`](https://github.com/valbuild/val/commit/5b7fe05cec6365f9cd1de9ba31e65ed4a87edb63), [`88262ac`](https://github.com/valbuild/val/commit/88262ac8db068650a664981ef73556457d87741a), [`7072e07`](https://github.com/valbuild/val/commit/7072e07623c953a09ac14388ae22dada0b431ce3), [`29811c3`](https://github.com/valbuild/val/commit/29811c3f8c7e001a950e6f4833af6888e6a4efea)]:
17
+ - @valbuild/core@0.127.0
18
+ - @valbuild/shared@0.127.0
19
+ - @valbuild/server@0.127.0
20
+
3
21
  ## 0.126.0
4
22
 
5
23
  ### Patch Changes
package/README.md CHANGED
@@ -154,7 +154,7 @@ shape, or changed semantics an older client would misread.
154
154
  | `fix/download-remote` | Download a remote file back into the project. |
155
155
  | `login` | The `val.login` command (device flow; writes `.val/pat.json`, the same file the CLI uses). |
156
156
  | `completions/mediaPath` | The `path` of an image or file, with `width`/`height`/`mimeType` filled in on accept. |
157
- | `completions/galleryKey` | Keys of an `s.images()` / `s.files()` collection. |
157
+ | `completions/galleryKey` | Keys of an `s.imageset()` / `s.fileset()` collection. |
158
158
  | `completions/keyOf` | Keys of the record or object an `s.keyOf()` field points at. |
159
159
  | `completions/route` | Routes the project defines. |
160
160
  | `completions/richtextLink` | Route completion inside a richtext inline link's `href`. |
@@ -206,7 +206,7 @@ export type GalleryMembership = {
206
206
  /** Module path of the gallery this field points at. */
207
207
  referencedModule: string;
208
208
  /** The gallery's directory, when it declares one. */
209
- directory?: string;
209
+ dir?: string;
210
210
  /** The path the field currently holds. */
211
211
  path: string;
212
212
  /** `image` or `file`, for wording and for which metadata to read. */
@@ -183,7 +183,7 @@ var packageJson = {
183
183
  "lsp",
184
184
  "language-server"
185
185
  ],
186
- version: "0.126.0",
186
+ version: "0.128.0",
187
187
  bin: {
188
188
  "val-language-server": "./bin.js"
189
189
  },
@@ -1707,7 +1707,7 @@ function longestResolvedPrefixRange(modulePath, modulePathMap) {
1707
1707
  /**
1708
1708
  * Gallery checks core emits unconditionally.
1709
1709
  *
1710
- * `RecordSchema.validate` attaches these to every `s.images()` / `s.files()`
1710
+ * `RecordSchema.validate` attaches these to every `s.imageset()` / `s.fileset()`
1711
1711
  * module whether or not anything is actually wrong (see
1712
1712
  * `packages/core/src/schema/record.ts`): they are placeholders asking someone to
1713
1713
  * go and look. `val validate` looks by running the matching fix handler, which
@@ -1786,8 +1786,17 @@ function galleryCheckKey(sourcePath, error) {
1786
1786
  return `${sourcePath}|${(error.fixes ?? []).join(",")}`;
1787
1787
  }
1788
1788
 
1789
- /** Fixes core cannot resolve without a project-wide snapshot. */
1790
- const DEFERRED_FIXES = ["keyof:check-keys", "router:check-route"];
1789
+ /**
1790
+ * Fixes core cannot resolve without a project-wide snapshot.
1791
+ *
1792
+ * The shared list, not a copy: this had its own and fell behind by two, so a
1793
+ * locale field and a declared-key record each put the marker's developer-facing
1794
+ * placeholder — "should typically be processed by Val internally … version
1795
+ * mismatch" — into the editor's diagnostics whenever the snapshot was missing.
1796
+ * Every caller that recognises some of these has to recognise all of them; see
1797
+ * `SCHEMA_SOURCE_FIXES`.
1798
+ */
1799
+ const DEFERRED_FIXES = internal.SCHEMA_SOURCE_FIXES;
1791
1800
 
1792
1801
  /**
1793
1802
  * Fallback for when no snapshot is available: drop the placeholders rather than
@@ -1847,7 +1856,7 @@ function galleryMembershipAt({
1847
1856
  return undefined;
1848
1857
  }
1849
1858
  const gallery = snapshot?.schemas[referencedModule];
1850
- const directory = gallery?.type === "record" && typeof gallery.directory === "string" ? gallery.directory : undefined;
1859
+ const dir = gallery?.type === "record" && typeof gallery.dir === "string" ? gallery.dir : undefined;
1851
1860
  // Core emits TWO fixless errors on a gallery-backed field: this one, and "an
1852
1861
  // image from a gallery must not carry its own width, height...". Both look
1853
1862
  // identical from here, and offering "add it to the gallery" for the second
@@ -1862,8 +1871,8 @@ function galleryMembershipAt({
1862
1871
  }
1863
1872
  return {
1864
1873
  referencedModule,
1865
- ...(directory !== undefined ? {
1866
- directory
1874
+ ...(dir !== undefined ? {
1875
+ dir
1867
1876
  } : {}),
1868
1877
  path: currentPath,
1869
1878
  mediaType: schema.type
@@ -3446,7 +3455,7 @@ function createSchemaDrivenCompletions({
3446
3455
  if (!container || typeof container !== "object" || !("type" in container) || container.type !== "record" || !("mediaType" in container) || !container.mediaType) {
3447
3456
  return [];
3448
3457
  }
3449
- const directory = "directory" in container && typeof container.directory === "string" ? container.directory : undefined;
3458
+ const directory = "dir" in container && typeof container.dir === "string" ? container.dir : undefined;
3450
3459
  const galleryFiles = container.mediaType === "images" ? files.images(directory) : files.list(directory);
3451
3460
  return items(galleryFiles.map(file => file.ref), vscodeLanguageserver.CompletionItemKind.File, range);
3452
3461
  }
@@ -3512,11 +3521,11 @@ function mediaPathItems({
3512
3521
  }) {
3513
3522
  const referencedModule = typeof container.referencedModule === "string" ? container.referencedModule : undefined;
3514
3523
  const options = container.options;
3515
- let directory = typeof options?.directory === "string" ? options.directory : undefined;
3524
+ let directory = typeof options?.dir === "string" ? options.dir : undefined;
3516
3525
  if (directory === undefined && referencedModule) {
3517
3526
  const gallery = snapshot.schemas[referencedModule];
3518
- if (gallery?.type === "record" && typeof gallery.directory === "string") {
3519
- directory = gallery.directory;
3527
+ if (gallery?.type === "record" && typeof gallery.dir === "string") {
3528
+ directory = gallery.dir;
3520
3529
  }
3521
3530
  }
3522
3531
  const candidates = container.type === "image" ? files.images(directory) : files.list(directory);
@@ -3702,7 +3711,7 @@ async function createGalleryMembershipActions({
3702
3711
  if (register) {
3703
3712
  actions.push(register);
3704
3713
  }
3705
- if (allowRename && gallery.directory && onDisk) {
3714
+ if (allowRename && gallery.dir && onDisk) {
3706
3715
  const move = createMoveIntoGalleryDirectoryAction({
3707
3716
  document,
3708
3717
  gallery,
@@ -3727,7 +3736,7 @@ async function createRegisterInGalleryAction({
3727
3736
  // a "file does not exist" one.
3728
3737
  return undefined;
3729
3738
  }
3730
- if (gallery.directory && !gallery.path.startsWith(`${gallery.directory}/`)) {
3739
+ if (gallery.dir && !gallery.path.startsWith(`${gallery.dir}/`)) {
3731
3740
  // Outside the gallery's directory: registering it would break the gallery's
3732
3741
  // own directory check. Moving is the remedy, not registering.
3733
3742
  return undefined;
@@ -3768,7 +3777,7 @@ function createMoveIntoGalleryDirectoryAction({
3768
3777
  gallery,
3769
3778
  valRoot
3770
3779
  }) {
3771
- const directory = gallery.directory;
3780
+ const directory = gallery.dir;
3772
3781
  if (!directory || gallery.path.startsWith(`${directory}/`)) {
3773
3782
  return undefined;
3774
3783
  }
@@ -183,7 +183,7 @@ var packageJson = {
183
183
  "lsp",
184
184
  "language-server"
185
185
  ],
186
- version: "0.126.0",
186
+ version: "0.128.0",
187
187
  bin: {
188
188
  "val-language-server": "./bin.js"
189
189
  },
@@ -1707,7 +1707,7 @@ function longestResolvedPrefixRange(modulePath, modulePathMap) {
1707
1707
  /**
1708
1708
  * Gallery checks core emits unconditionally.
1709
1709
  *
1710
- * `RecordSchema.validate` attaches these to every `s.images()` / `s.files()`
1710
+ * `RecordSchema.validate` attaches these to every `s.imageset()` / `s.fileset()`
1711
1711
  * module whether or not anything is actually wrong (see
1712
1712
  * `packages/core/src/schema/record.ts`): they are placeholders asking someone to
1713
1713
  * go and look. `val validate` looks by running the matching fix handler, which
@@ -1786,8 +1786,17 @@ function galleryCheckKey(sourcePath, error) {
1786
1786
  return `${sourcePath}|${(error.fixes ?? []).join(",")}`;
1787
1787
  }
1788
1788
 
1789
- /** Fixes core cannot resolve without a project-wide snapshot. */
1790
- const DEFERRED_FIXES = ["keyof:check-keys", "router:check-route"];
1789
+ /**
1790
+ * Fixes core cannot resolve without a project-wide snapshot.
1791
+ *
1792
+ * The shared list, not a copy: this had its own and fell behind by two, so a
1793
+ * locale field and a declared-key record each put the marker's developer-facing
1794
+ * placeholder — "should typically be processed by Val internally … version
1795
+ * mismatch" — into the editor's diagnostics whenever the snapshot was missing.
1796
+ * Every caller that recognises some of these has to recognise all of them; see
1797
+ * `SCHEMA_SOURCE_FIXES`.
1798
+ */
1799
+ const DEFERRED_FIXES = internal.SCHEMA_SOURCE_FIXES;
1791
1800
 
1792
1801
  /**
1793
1802
  * Fallback for when no snapshot is available: drop the placeholders rather than
@@ -1847,7 +1856,7 @@ function galleryMembershipAt({
1847
1856
  return undefined;
1848
1857
  }
1849
1858
  const gallery = snapshot?.schemas[referencedModule];
1850
- const directory = gallery?.type === "record" && typeof gallery.directory === "string" ? gallery.directory : undefined;
1859
+ const dir = gallery?.type === "record" && typeof gallery.dir === "string" ? gallery.dir : undefined;
1851
1860
  // Core emits TWO fixless errors on a gallery-backed field: this one, and "an
1852
1861
  // image from a gallery must not carry its own width, height...". Both look
1853
1862
  // identical from here, and offering "add it to the gallery" for the second
@@ -1862,8 +1871,8 @@ function galleryMembershipAt({
1862
1871
  }
1863
1872
  return {
1864
1873
  referencedModule,
1865
- ...(directory !== undefined ? {
1866
- directory
1874
+ ...(dir !== undefined ? {
1875
+ dir
1867
1876
  } : {}),
1868
1877
  path: currentPath,
1869
1878
  mediaType: schema.type
@@ -3446,7 +3455,7 @@ function createSchemaDrivenCompletions({
3446
3455
  if (!container || typeof container !== "object" || !("type" in container) || container.type !== "record" || !("mediaType" in container) || !container.mediaType) {
3447
3456
  return [];
3448
3457
  }
3449
- const directory = "directory" in container && typeof container.directory === "string" ? container.directory : undefined;
3458
+ const directory = "dir" in container && typeof container.dir === "string" ? container.dir : undefined;
3450
3459
  const galleryFiles = container.mediaType === "images" ? files.images(directory) : files.list(directory);
3451
3460
  return items(galleryFiles.map(file => file.ref), vscodeLanguageserver.CompletionItemKind.File, range);
3452
3461
  }
@@ -3512,11 +3521,11 @@ function mediaPathItems({
3512
3521
  }) {
3513
3522
  const referencedModule = typeof container.referencedModule === "string" ? container.referencedModule : undefined;
3514
3523
  const options = container.options;
3515
- let directory = typeof options?.directory === "string" ? options.directory : undefined;
3524
+ let directory = typeof options?.dir === "string" ? options.dir : undefined;
3516
3525
  if (directory === undefined && referencedModule) {
3517
3526
  const gallery = snapshot.schemas[referencedModule];
3518
- if (gallery?.type === "record" && typeof gallery.directory === "string") {
3519
- directory = gallery.directory;
3527
+ if (gallery?.type === "record" && typeof gallery.dir === "string") {
3528
+ directory = gallery.dir;
3520
3529
  }
3521
3530
  }
3522
3531
  const candidates = container.type === "image" ? files.images(directory) : files.list(directory);
@@ -3702,7 +3711,7 @@ async function createGalleryMembershipActions({
3702
3711
  if (register) {
3703
3712
  actions.push(register);
3704
3713
  }
3705
- if (allowRename && gallery.directory && onDisk) {
3714
+ if (allowRename && gallery.dir && onDisk) {
3706
3715
  const move = createMoveIntoGalleryDirectoryAction({
3707
3716
  document,
3708
3717
  gallery,
@@ -3727,7 +3736,7 @@ async function createRegisterInGalleryAction({
3727
3736
  // a "file does not exist" one.
3728
3737
  return undefined;
3729
3738
  }
3730
- if (gallery.directory && !gallery.path.startsWith(`${gallery.directory}/`)) {
3739
+ if (gallery.dir && !gallery.path.startsWith(`${gallery.dir}/`)) {
3731
3740
  // Outside the gallery's directory: registering it would break the gallery's
3732
3741
  // own directory check. Moving is the remedy, not registering.
3733
3742
  return undefined;
@@ -3768,7 +3777,7 @@ function createMoveIntoGalleryDirectoryAction({
3768
3777
  gallery,
3769
3778
  valRoot
3770
3779
  }) {
3771
- const directory = gallery.directory;
3780
+ const directory = gallery.dir;
3772
3781
  if (!directory || gallery.path.startsWith(`${directory}/`)) {
3773
3782
  return undefined;
3774
3783
  }
@@ -8,7 +8,7 @@ import { TextDocuments, TextDocumentSyncKind, createConnection, ProposedFeatures
8
8
  import { TextDocument } from 'vscode-languageserver-textdocument';
9
9
  import crypto from 'crypto';
10
10
  import { createRequire } from 'node:module';
11
- import { resolveSchemaSourceFixes, getRoutesWithModulePaths } from '@valbuild/shared/internal';
11
+ import { resolveSchemaSourceFixes, SCHEMA_SOURCE_FIXES, getRoutesWithModulePaths } from '@valbuild/shared/internal';
12
12
  import { result } from '@valbuild/core/fp';
13
13
  import { JSONOps, applyPatch, deepClone } from '@valbuild/core/patch';
14
14
 
@@ -172,7 +172,7 @@ var packageJson = {
172
172
  "lsp",
173
173
  "language-server"
174
174
  ],
175
- version: "0.126.0",
175
+ version: "0.128.0",
176
176
  bin: {
177
177
  "val-language-server": "./bin.js"
178
178
  },
@@ -1696,7 +1696,7 @@ function longestResolvedPrefixRange(modulePath, modulePathMap) {
1696
1696
  /**
1697
1697
  * Gallery checks core emits unconditionally.
1698
1698
  *
1699
- * `RecordSchema.validate` attaches these to every `s.images()` / `s.files()`
1699
+ * `RecordSchema.validate` attaches these to every `s.imageset()` / `s.fileset()`
1700
1700
  * module whether or not anything is actually wrong (see
1701
1701
  * `packages/core/src/schema/record.ts`): they are placeholders asking someone to
1702
1702
  * go and look. `val validate` looks by running the matching fix handler, which
@@ -1775,8 +1775,17 @@ function galleryCheckKey(sourcePath, error) {
1775
1775
  return `${sourcePath}|${(error.fixes ?? []).join(",")}`;
1776
1776
  }
1777
1777
 
1778
- /** Fixes core cannot resolve without a project-wide snapshot. */
1779
- const DEFERRED_FIXES = ["keyof:check-keys", "router:check-route"];
1778
+ /**
1779
+ * Fixes core cannot resolve without a project-wide snapshot.
1780
+ *
1781
+ * The shared list, not a copy: this had its own and fell behind by two, so a
1782
+ * locale field and a declared-key record each put the marker's developer-facing
1783
+ * placeholder — "should typically be processed by Val internally … version
1784
+ * mismatch" — into the editor's diagnostics whenever the snapshot was missing.
1785
+ * Every caller that recognises some of these has to recognise all of them; see
1786
+ * `SCHEMA_SOURCE_FIXES`.
1787
+ */
1788
+ const DEFERRED_FIXES = SCHEMA_SOURCE_FIXES;
1780
1789
 
1781
1790
  /**
1782
1791
  * Fallback for when no snapshot is available: drop the placeholders rather than
@@ -1836,7 +1845,7 @@ function galleryMembershipAt({
1836
1845
  return undefined;
1837
1846
  }
1838
1847
  const gallery = snapshot?.schemas[referencedModule];
1839
- const directory = gallery?.type === "record" && typeof gallery.directory === "string" ? gallery.directory : undefined;
1848
+ const dir = gallery?.type === "record" && typeof gallery.dir === "string" ? gallery.dir : undefined;
1840
1849
  // Core emits TWO fixless errors on a gallery-backed field: this one, and "an
1841
1850
  // image from a gallery must not carry its own width, height...". Both look
1842
1851
  // identical from here, and offering "add it to the gallery" for the second
@@ -1851,8 +1860,8 @@ function galleryMembershipAt({
1851
1860
  }
1852
1861
  return {
1853
1862
  referencedModule,
1854
- ...(directory !== undefined ? {
1855
- directory
1863
+ ...(dir !== undefined ? {
1864
+ dir
1856
1865
  } : {}),
1857
1866
  path: currentPath,
1858
1867
  mediaType: schema.type
@@ -3435,7 +3444,7 @@ function createSchemaDrivenCompletions({
3435
3444
  if (!container || typeof container !== "object" || !("type" in container) || container.type !== "record" || !("mediaType" in container) || !container.mediaType) {
3436
3445
  return [];
3437
3446
  }
3438
- const directory = "directory" in container && typeof container.directory === "string" ? container.directory : undefined;
3447
+ const directory = "dir" in container && typeof container.dir === "string" ? container.dir : undefined;
3439
3448
  const galleryFiles = container.mediaType === "images" ? files.images(directory) : files.list(directory);
3440
3449
  return items(galleryFiles.map(file => file.ref), CompletionItemKind.File, range);
3441
3450
  }
@@ -3501,11 +3510,11 @@ function mediaPathItems({
3501
3510
  }) {
3502
3511
  const referencedModule = typeof container.referencedModule === "string" ? container.referencedModule : undefined;
3503
3512
  const options = container.options;
3504
- let directory = typeof options?.directory === "string" ? options.directory : undefined;
3513
+ let directory = typeof options?.dir === "string" ? options.dir : undefined;
3505
3514
  if (directory === undefined && referencedModule) {
3506
3515
  const gallery = snapshot.schemas[referencedModule];
3507
- if (gallery?.type === "record" && typeof gallery.directory === "string") {
3508
- directory = gallery.directory;
3516
+ if (gallery?.type === "record" && typeof gallery.dir === "string") {
3517
+ directory = gallery.dir;
3509
3518
  }
3510
3519
  }
3511
3520
  const candidates = container.type === "image" ? files.images(directory) : files.list(directory);
@@ -3691,7 +3700,7 @@ async function createGalleryMembershipActions({
3691
3700
  if (register) {
3692
3701
  actions.push(register);
3693
3702
  }
3694
- if (allowRename && gallery.directory && onDisk) {
3703
+ if (allowRename && gallery.dir && onDisk) {
3695
3704
  const move = createMoveIntoGalleryDirectoryAction({
3696
3705
  document,
3697
3706
  gallery,
@@ -3716,7 +3725,7 @@ async function createRegisterInGalleryAction({
3716
3725
  // a "file does not exist" one.
3717
3726
  return undefined;
3718
3727
  }
3719
- if (gallery.directory && !gallery.path.startsWith(`${gallery.directory}/`)) {
3728
+ if (gallery.dir && !gallery.path.startsWith(`${gallery.dir}/`)) {
3720
3729
  // Outside the gallery's directory: registering it would break the gallery's
3721
3730
  // own directory check. Moving is the remedy, not registering.
3722
3731
  return undefined;
@@ -3757,7 +3766,7 @@ function createMoveIntoGalleryDirectoryAction({
3757
3766
  gallery,
3758
3767
  valRoot
3759
3768
  }) {
3760
- const directory = gallery.directory;
3769
+ const directory = gallery.dir;
3761
3770
  if (!directory || gallery.path.startsWith(`${directory}/`)) {
3762
3771
  return undefined;
3763
3772
  }
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "lsp",
12
12
  "language-server"
13
13
  ],
14
- "version": "0.126.0",
14
+ "version": "0.128.0",
15
15
  "bin": {
16
16
  "val-language-server": "./bin.js"
17
17
  },
@@ -29,9 +29,9 @@
29
29
  "typescript": "^6.0.3",
30
30
  "vscode-languageserver": "^10.1.0",
31
31
  "vscode-languageserver-textdocument": "^1.0.14",
32
- "@valbuild/core": "0.126.0",
33
- "@valbuild/server": "0.126.0",
34
- "@valbuild/shared": "0.126.0"
32
+ "@valbuild/server": "0.128.0",
33
+ "@valbuild/shared": "0.128.0",
34
+ "@valbuild/core": "0.128.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/jest": "^30.0.0",