vscode-json-languageservice 5.3.5 → 5.3.6

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.
@@ -25,6 +25,7 @@ export declare enum ErrorCode {
25
25
  TrailingComma = 519,
26
26
  DuplicateKey = 520,
27
27
  CommentNotPermitted = 521,
28
+ PropertyKeysMustBeDoublequoted = 528,
28
29
  SchemaResolveError = 768,
29
30
  SchemaUnsupportedFeature = 769
30
31
  }
@@ -28,6 +28,7 @@ export var ErrorCode;
28
28
  ErrorCode[ErrorCode["TrailingComma"] = 519] = "TrailingComma";
29
29
  ErrorCode[ErrorCode["DuplicateKey"] = 520] = "DuplicateKey";
30
30
  ErrorCode[ErrorCode["CommentNotPermitted"] = 521] = "CommentNotPermitted";
31
+ ErrorCode[ErrorCode["PropertyKeysMustBeDoublequoted"] = 528] = "PropertyKeysMustBeDoublequoted";
31
32
  ErrorCode[ErrorCode["SchemaResolveError"] = 768] = "SchemaResolveError";
32
33
  ErrorCode[ErrorCode["SchemaUnsupportedFeature"] = 769] = "SchemaUnsupportedFeature";
33
34
  })(ErrorCode || (ErrorCode = {}));
@@ -1091,7 +1091,7 @@ export function parse(textDocument, config) {
1091
1091
  if (!key) {
1092
1092
  if (scanner.getToken() === 16 /* Json.SyntaxKind.Unknown */) {
1093
1093
  // give a more helpful error message
1094
- _error(l10n.t('Property keys must be doublequoted'), ErrorCode.Undefined);
1094
+ _error(l10n.t('Property keys must be doublequoted'), ErrorCode.PropertyKeysMustBeDoublequoted);
1095
1095
  const keyNode = new StringASTNodeImpl(node, scanner.getTokenOffset(), scanner.getTokenLength());
1096
1096
  keyNode.value = scanner.getTokenValue();
1097
1097
  key = keyNode;
@@ -6,10 +6,6 @@ import * as l10n from '@vscode/l10n';
6
6
  export const schemaContributions = {
7
7
  schemaAssociations: [],
8
8
  schemas: {
9
- // refer to the latest schema
10
- 'http://json-schema.org/schema#': {
11
- $ref: 'http://json-schema.org/draft-07/schema#'
12
- },
13
9
  // bundle the schema-schema to include (localized) descriptions
14
10
  'http://json-schema.org/draft-04/schema#': {
15
11
  '$schema': 'http://json-schema.org/draft-04/schema#',
@@ -686,13 +686,18 @@ export class JSONCompletion {
686
686
  }
687
687
  addDollarSchemaCompletions(separatorAfter, collector) {
688
688
  const schemaIds = this.schemaService.getRegisteredSchemaIds(schema => schema === 'http' || schema === 'https');
689
- schemaIds.forEach(schemaId => collector.add({
690
- kind: CompletionItemKind.Module,
691
- label: this.getLabelForValue(schemaId),
692
- filterText: this.getFilterTextForValue(schemaId),
693
- insertText: this.getInsertTextForValue(schemaId, separatorAfter),
694
- insertTextFormat: InsertTextFormat.Snippet, documentation: ''
695
- }));
689
+ schemaIds.forEach(schemaId => {
690
+ if (schemaId.startsWith('http://json-schema.org/draft-')) {
691
+ schemaId = schemaId + '#';
692
+ }
693
+ collector.add({
694
+ kind: CompletionItemKind.Module,
695
+ label: this.getLabelForValue(schemaId),
696
+ filterText: this.getFilterTextForValue(schemaId),
697
+ insertText: this.getInsertTextForValue(schemaId, separatorAfter),
698
+ insertTextFormat: InsertTextFormat.Snippet, documentation: ''
699
+ });
700
+ });
696
701
  }
697
702
  getLabelForValue(value) {
698
703
  return JSON.stringify(value);
@@ -25,6 +25,7 @@ export declare enum ErrorCode {
25
25
  TrailingComma = 519,
26
26
  DuplicateKey = 520,
27
27
  CommentNotPermitted = 521,
28
+ PropertyKeysMustBeDoublequoted = 528,
28
29
  SchemaResolveError = 768,
29
30
  SchemaUnsupportedFeature = 769
30
31
  }
@@ -75,9 +75,10 @@
75
75
  ErrorCode[ErrorCode["TrailingComma"] = 519] = "TrailingComma";
76
76
  ErrorCode[ErrorCode["DuplicateKey"] = 520] = "DuplicateKey";
77
77
  ErrorCode[ErrorCode["CommentNotPermitted"] = 521] = "CommentNotPermitted";
78
+ ErrorCode[ErrorCode["PropertyKeysMustBeDoublequoted"] = 528] = "PropertyKeysMustBeDoublequoted";
78
79
  ErrorCode[ErrorCode["SchemaResolveError"] = 768] = "SchemaResolveError";
79
80
  ErrorCode[ErrorCode["SchemaUnsupportedFeature"] = 769] = "SchemaUnsupportedFeature";
80
- })(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));
81
+ })(ErrorCode || (exports.ErrorCode = ErrorCode = {}));
81
82
  var SchemaDraft;
82
83
  (function (SchemaDraft) {
83
84
  SchemaDraft[SchemaDraft["v3"] = 3] = "v3";
@@ -86,7 +87,7 @@
86
87
  SchemaDraft[SchemaDraft["v7"] = 7] = "v7";
87
88
  SchemaDraft[SchemaDraft["v2019_09"] = 19] = "v2019_09";
88
89
  SchemaDraft[SchemaDraft["v2020_12"] = 20] = "v2020_12";
89
- })(SchemaDraft = exports.SchemaDraft || (exports.SchemaDraft = {}));
90
+ })(SchemaDraft || (exports.SchemaDraft = SchemaDraft = {}));
90
91
  var ClientCapabilities;
91
92
  (function (ClientCapabilities) {
92
93
  ClientCapabilities.LATEST = {
@@ -100,5 +101,5 @@
100
101
  }
101
102
  }
102
103
  };
103
- })(ClientCapabilities = exports.ClientCapabilities || (exports.ClientCapabilities = {}));
104
+ })(ClientCapabilities || (exports.ClientCapabilities = ClientCapabilities = {}));
104
105
  });
@@ -121,7 +121,7 @@
121
121
  (function (EnumMatch) {
122
122
  EnumMatch[EnumMatch["Key"] = 0] = "Key";
123
123
  EnumMatch[EnumMatch["Enum"] = 1] = "Enum";
124
- })(EnumMatch = exports.EnumMatch || (exports.EnumMatch = {}));
124
+ })(EnumMatch || (exports.EnumMatch = EnumMatch = {}));
125
125
  const schemaDraftFromId = {
126
126
  'http://json-schema.org/draft-03/schema#': jsonLanguageTypes_1.SchemaDraft.v3,
127
127
  'http://json-schema.org/draft-04/schema#': jsonLanguageTypes_1.SchemaDraft.v4,
@@ -1118,7 +1118,7 @@
1118
1118
  if (!key) {
1119
1119
  if (scanner.getToken() === 16 /* Json.SyntaxKind.Unknown */) {
1120
1120
  // give a more helpful error message
1121
- _error(l10n.t('Property keys must be doublequoted'), jsonLanguageTypes_1.ErrorCode.Undefined);
1121
+ _error(l10n.t('Property keys must be doublequoted'), jsonLanguageTypes_1.ErrorCode.PropertyKeysMustBeDoublequoted);
1122
1122
  const keyNode = new StringASTNodeImpl(node, scanner.getTokenOffset(), scanner.getTokenLength());
1123
1123
  keyNode.value = scanner.getTokenValue();
1124
1124
  key = keyNode;
@@ -18,10 +18,6 @@
18
18
  exports.schemaContributions = {
19
19
  schemaAssociations: [],
20
20
  schemas: {
21
- // refer to the latest schema
22
- 'http://json-schema.org/schema#': {
23
- $ref: 'http://json-schema.org/draft-07/schema#'
24
- },
25
21
  // bundle the schema-schema to include (localized) descriptions
26
22
  'http://json-schema.org/draft-04/schema#': {
27
23
  '$schema': 'http://json-schema.org/draft-04/schema#',
@@ -698,13 +698,18 @@
698
698
  }
699
699
  addDollarSchemaCompletions(separatorAfter, collector) {
700
700
  const schemaIds = this.schemaService.getRegisteredSchemaIds(schema => schema === 'http' || schema === 'https');
701
- schemaIds.forEach(schemaId => collector.add({
702
- kind: jsonLanguageTypes_1.CompletionItemKind.Module,
703
- label: this.getLabelForValue(schemaId),
704
- filterText: this.getFilterTextForValue(schemaId),
705
- insertText: this.getInsertTextForValue(schemaId, separatorAfter),
706
- insertTextFormat: jsonLanguageTypes_1.InsertTextFormat.Snippet, documentation: ''
707
- }));
701
+ schemaIds.forEach(schemaId => {
702
+ if (schemaId.startsWith('http://json-schema.org/draft-')) {
703
+ schemaId = schemaId + '#';
704
+ }
705
+ collector.add({
706
+ kind: jsonLanguageTypes_1.CompletionItemKind.Module,
707
+ label: this.getLabelForValue(schemaId),
708
+ filterText: this.getFilterTextForValue(schemaId),
709
+ insertText: this.getInsertTextForValue(schemaId, separatorAfter),
710
+ insertTextFormat: jsonLanguageTypes_1.InsertTextFormat.Snippet, documentation: ''
711
+ });
712
+ });
708
713
  }
709
714
  getLabelForValue(value) {
710
715
  return JSON.stringify(value);
@@ -18,7 +18,7 @@
18
18
  (function (Container) {
19
19
  Container[Container["Object"] = 0] = "Object";
20
20
  Container[Container["Array"] = 1] = "Array";
21
- })(Container = exports.Container || (exports.Container = {}));
21
+ })(Container || (exports.Container = Container = {}));
22
22
  class PropertyTree {
23
23
  constructor(propertyName, beginningLineNumber) {
24
24
  this.propertyName = propertyName ?? '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vscode-json-languageservice",
3
- "version": "5.3.5",
3
+ "version": "5.3.6",
4
4
  "description": "Language service for JSON",
5
5
  "main": "./lib/umd/jsonLanguageService.js",
6
6
  "typings": "./lib/umd/jsonLanguageService",
@@ -17,20 +17,20 @@
17
17
  "devDependencies": {
18
18
  "@types/mocha": "^10.0.1",
19
19
  "@types/node": "16.x",
20
- "@typescript-eslint/eslint-plugin": "^5.59.1",
21
- "@typescript-eslint/parser": "^5.59.1",
22
- "eslint": "^8.39.0",
20
+ "@typescript-eslint/eslint-plugin": "^6.5.0",
21
+ "@typescript-eslint/parser": "^6.5.0",
22
+ "eslint": "^8.48.0",
23
23
  "json-schema-test-suite": "https://github.com/json-schema-org/JSON-Schema-Test-Suite.git#69acf52990b004240839ae19b4bec8fb01d50876",
24
24
  "mocha": "^10.2.0",
25
- "rimraf": "^5.0.0",
26
- "typescript": "^5.0.4"
25
+ "rimraf": "^5.0.1",
26
+ "typescript": "^5.2.2"
27
27
  },
28
28
  "dependencies": {
29
29
  "jsonc-parser": "^3.2.0",
30
30
  "vscode-languageserver-textdocument": "^1.0.8",
31
31
  "vscode-languageserver-types": "^3.17.3",
32
32
  "vscode-uri": "^3.0.7",
33
- "@vscode/l10n": "^0.0.13"
33
+ "@vscode/l10n": "^0.0.16"
34
34
  },
35
35
  "scripts": {
36
36
  "prepack": "npm run clean && npm run compile-esm && npm run test && npm run remove-sourcemap-refs",