vscode-json-languageservice 6.0.0-next.1 → 6.0.0-next.2

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,3 +1,8 @@
1
+ 6.0.0-next.2 / 2026-07-11
2
+ ================
3
+ - Support $dynamicRef / $dynamicAnchor (JSON Schema 2020-12)
4
+ - Support JSON Schema 2019-09
5
+
1
6
  6.0.0-next.1 / 2026-03-04
2
7
  ================
3
8
  * Breaking: the package is now ESM-only (`"type": "module"`) and exposes ESM entry points through `exports`.
@@ -3,6 +3,14 @@ import { JSONSchema } from './jsonSchema.js';
3
3
  import { Range, Position, DocumentUri, MarkupContent, MarkupKind, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, CompletionItemTag, InsertTextFormat, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString, FormattingOptions as LSPFormattingOptions, DefinitionLink, CodeActionContext, Command, CodeAction, DocumentHighlight, DocumentLink, WorkspaceEdit, TextEdit, CodeActionKind, TextDocumentEdit, VersionedTextDocumentIdentifier, DocumentHighlightKind } from 'vscode-languageserver-types';
4
4
  import { TextDocument, TextDocumentContentChangeEvent } from 'vscode-languageserver-textdocument';
5
5
  export { TextDocument, TextDocumentContentChangeEvent, Range, Position, DocumentUri, MarkupContent, MarkupKind, JSONSchema, JSONWorkerContribution, JSONPath, Segment, CompletionsCollector, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, CompletionItemTag, InsertTextFormat, DefinitionLink, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString, CodeActionContext, Command, CodeAction, DocumentHighlight, DocumentLink, WorkspaceEdit, TextEdit, CodeActionKind, TextDocumentEdit, VersionedTextDocumentIdentifier, DocumentHighlightKind };
6
+ /**
7
+ * Represents active JSON Schema vocabularies with their required/optional status.
8
+ * Key = vocabulary URI, Value = true if required, false if optional.
9
+ * Both required and optional vocabularies are active; the boolean indicates
10
+ * whether the validator must understand it (true) or should understand it (false).
11
+ * @since 2019-09
12
+ */
13
+ export type Vocabularies = Map<string, boolean>;
6
14
  /**
7
15
  * Error codes used by diagnostics
8
16
  */
@@ -61,8 +61,10 @@ export interface JSONSchema {
61
61
  };
62
62
  $anchor?: string;
63
63
  $recursiveRef?: string;
64
- $recursiveAnchor?: string;
65
- $vocabulary?: any;
64
+ $recursiveAnchor?: boolean;
65
+ $vocabulary?: {
66
+ [uri: string]: boolean;
67
+ };
66
68
  prefixItems?: JSONSchemaRef[];
67
69
  $dynamicRef?: string;
68
70
  $dynamicAnchor?: string;
@@ -90,3 +92,70 @@ export interface JSONSchema {
90
92
  export interface JSONSchemaMap {
91
93
  [name: string]: JSONSchemaRef;
92
94
  }
95
+ /**
96
+ * Internal extension of {@link JSONSchema} used when one schema is merged into
97
+ * another (e.g. when resolving `$ref`). The `$originalId` field preserves the
98
+ * `$id`/`id` of the referenced schema so features like `$recursiveRef` can
99
+ * still identify schema resource roots after the merge.
100
+ *
101
+ * `$originalId` is set as a non-enumerable property to keep it out of
102
+ * `for..in` iteration and JSON serialization.
103
+ */
104
+ export interface MergedJSONSchema extends JSONSchema {
105
+ $originalId?: string;
106
+ /**
107
+ * Non-enumerable metadata attached to a `$dynamicRef` node while resolving it.
108
+ * Held off the enumerable keywords so it stays invisible to schema traversal,
109
+ * merging and consumers, but available to the validator.
110
+ */
111
+ $dynamicRefInfo?: DynamicRefInfo;
112
+ /**
113
+ * Non-enumerable per-resource anchor maps, attached to resource-root schemas
114
+ * (a node with its own `$id`, or the document root) for 2020-12 `$dynamicRef`
115
+ * resolution.
116
+ */
117
+ $anchorMaps?: AnchorMaps;
118
+ }
119
+ /**
120
+ * Internal, non-enumerable metadata recorded for a single `$dynamicRef` occurrence.
121
+ */
122
+ export interface DynamicRefInfo {
123
+ /**
124
+ * The statically resolved initial target (resolved like a plain `$ref`, against
125
+ * the reference's own base URI).
126
+ */
127
+ target?: JSONSchema;
128
+ /**
129
+ * The plain-name fragment of the `$dynamicRef` (set whenever the fragment is a
130
+ * plain name rather than a JSON pointer). The validator uses it, together with
131
+ * the initial target, to decide at validation time whether the 2020-12
132
+ * "bookending" requirement holds (i.e. the initial target is a `$dynamicAnchor`
133
+ * of that name) and therefore whether to perform dynamic-scope resolution
134
+ * instead of behaving like a plain `$ref`.
135
+ */
136
+ name?: string;
137
+ /**
138
+ * The schema resource (nearest enclosing `$id` scope) that lexically contains
139
+ * the `$dynamicRef`. Recorded before `$ref` merging flattens resource
140
+ * boundaries so an internal `#name` reference resolves against its own
141
+ * resource's anchors, not a sibling's.
142
+ */
143
+ scope?: MergedJSONSchema;
144
+ }
145
+ /**
146
+ * Internal, non-enumerable per-resource anchor maps used for 2020-12 `$dynamicRef`
147
+ * resolution. Attached to resource-root schemas.
148
+ */
149
+ export interface AnchorMaps {
150
+ /**
151
+ * `$dynamicAnchor` names → sub-schemas within the resource, used by the
152
+ * validator to walk the dynamic scope (outermost resource first).
153
+ */
154
+ dynamic: Map<string, JSONSchema>;
155
+ /**
156
+ * Both `$anchor` and `$dynamicAnchor` names → sub-schemas within the resource,
157
+ * used to resolve an internal `$dynamicRef`'s initial target within its own
158
+ * resource.
159
+ */
160
+ local: Map<string, JSONSchema>;
161
+ }