vscode-json-languageservice 5.6.0 → 5.6.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.
@@ -24,7 +24,7 @@ export interface LanguageService {
24
24
  getSelectionRanges(document: TextDocument, positions: Position[], doc: JSONDocument): SelectionRange[];
25
25
  findDefinition(document: TextDocument, position: Position, doc: JSONDocument): PromiseLike<DefinitionLink[]>;
26
26
  findLinks(document: TextDocument, doc: JSONDocument): PromiseLike<DocumentLink[]>;
27
- format(document: TextDocument, range: Range, options: FormattingOptions): TextEdit[];
27
+ format(document: TextDocument, range: Range | undefined, options: FormattingOptions): TextEdit[];
28
28
  sort(document: TextDocument, options: SortOptions): TextEdit[];
29
29
  }
30
30
  export declare function getLanguageService(params: LanguageServiceParams): LanguageService;
@@ -586,7 +586,7 @@ function validate(n, schema, validationResult, matchingSchemas, context) {
586
586
  }
587
587
  if (isString(schema.pattern)) {
588
588
  const regex = extendedRegExp(schema.pattern);
589
- if (!(regex?.test(node.value))) {
589
+ if (regex && !(regex.test(node.value))) {
590
590
  validationResult.problems.push({
591
591
  location: { offset: node.offset, length: node.length },
592
592
  message: schema.patternErrorMessage || schema.errorMessage || l10n.t('String does not match the pattern of "{0}".', schema.pattern)
@@ -258,6 +258,11 @@ export class JSONCompletion {
258
258
  propertyNameCompletionItem(schemaPropertyNames.enum[i], enumDescription, enumDetails, enumSortText);
259
259
  }
260
260
  }
261
+ if (schemaPropertyNames.examples) {
262
+ for (let i = 0; i < schemaPropertyNames.examples.length; i++) {
263
+ propertyNameCompletionItem(schemaPropertyNames.examples[i], undefined, undefined, undefined);
264
+ }
265
+ }
261
266
  if (schemaPropertyNames.const) {
262
267
  propertyNameCompletionItem(schemaPropertyNames.const, undefined, schemaPropertyNames.completionDetail, schemaPropertyNames.suggestSortText);
263
268
  }
@@ -24,7 +24,7 @@ export interface LanguageService {
24
24
  getSelectionRanges(document: TextDocument, positions: Position[], doc: JSONDocument): SelectionRange[];
25
25
  findDefinition(document: TextDocument, position: Position, doc: JSONDocument): PromiseLike<DefinitionLink[]>;
26
26
  findLinks(document: TextDocument, doc: JSONDocument): PromiseLike<DocumentLink[]>;
27
- format(document: TextDocument, range: Range, options: FormattingOptions): TextEdit[];
27
+ format(document: TextDocument, range: Range | undefined, options: FormattingOptions): TextEdit[];
28
28
  sort(document: TextDocument, options: SortOptions): TextEdit[];
29
29
  }
30
30
  export declare function getLanguageService(params: LanguageServiceParams): LanguageService;
@@ -616,7 +616,7 @@
616
616
  }
617
617
  if ((0, objects_1.isString)(schema.pattern)) {
618
618
  const regex = (0, strings_1.extendedRegExp)(schema.pattern);
619
- if (!(regex?.test(node.value))) {
619
+ if (regex && !(regex.test(node.value))) {
620
620
  validationResult.problems.push({
621
621
  location: { offset: node.offset, length: node.length },
622
622
  message: schema.patternErrorMessage || schema.errorMessage || l10n.t('String does not match the pattern of "{0}".', schema.pattern)
@@ -270,6 +270,11 @@
270
270
  propertyNameCompletionItem(schemaPropertyNames.enum[i], enumDescription, enumDetails, enumSortText);
271
271
  }
272
272
  }
273
+ if (schemaPropertyNames.examples) {
274
+ for (let i = 0; i < schemaPropertyNames.examples.length; i++) {
275
+ propertyNameCompletionItem(schemaPropertyNames.examples[i], undefined, undefined, undefined);
276
+ }
277
+ }
273
278
  if (schemaPropertyNames.const) {
274
279
  propertyNameCompletionItem(schemaPropertyNames.const, undefined, schemaPropertyNames.completionDetail, schemaPropertyNames.suggestSortText);
275
280
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vscode-json-languageservice",
3
- "version": "5.6.0",
3
+ "version": "5.6.2",
4
4
  "description": "Language service for JSON",
5
5
  "main": "./lib/umd/jsonLanguageService.js",
6
6
  "typings": "./lib/umd/jsonLanguageService",
@@ -16,14 +16,14 @@
16
16
  },
17
17
  "devDependencies": {
18
18
  "@types/mocha": "^10.0.10",
19
- "@types/node": "18.x",
20
- "@typescript-eslint/eslint-plugin": "^8.33.0",
21
- "@typescript-eslint/parser": "^8.33.0",
22
- "eslint": "^9.27.0",
19
+ "@types/node": "22.x",
20
+ "@typescript-eslint/eslint-plugin": "^8.45.0",
21
+ "@typescript-eslint/parser": "^8.45.0",
22
+ "eslint": "^9.36.0",
23
23
  "json-schema-test-suite": "https://github.com/json-schema-org/JSON-Schema-Test-Suite.git#69acf52990b004240839ae19b4bec8fb01d50876",
24
- "mocha": "^11.1.0",
24
+ "mocha": "^11.7.2",
25
25
  "rimraf": "^6.0.1",
26
- "typescript": "^5.8.3"
26
+ "typescript": "^5.9.2"
27
27
  },
28
28
  "dependencies": {
29
29
  "jsonc-parser": "^3.3.1",