vscode-json-languageservice 4.1.6 → 4.1.10

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.
@@ -1,8 +1,8 @@
1
1
  import { JSONWorkerContribution, JSONPath, Segment, CompletionsCollector } from './jsonContributions';
2
2
  import { JSONSchema } from './jsonSchema';
3
- import { Range, TextEdit, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, MarkupKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, Position, InsertTextFormat, MarkupContent, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString, FormattingOptions as LSPFormattingOptions, DefinitionLink } from 'vscode-languageserver-types';
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 } from 'vscode-languageserver-textdocument';
5
- export { TextDocument, Range, TextEdit, JSONSchema, JSONWorkerContribution, JSONPath, Segment, CompletionsCollector, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, Position, InsertTextFormat, MarkupContent, MarkupKind, DefinitionLink, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString };
5
+ export { TextDocument, 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
6
  /**
7
7
  * Error codes used by diagnostics
8
8
  */
@@ -2,9 +2,9 @@
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  * Licensed under the MIT License. See License.txt in the project root for license information.
4
4
  *--------------------------------------------------------------------------------------------*/
5
- import { Range, TextEdit, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, MarkupKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, Position, InsertTextFormat, MarkupContent, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString } from 'vscode-languageserver-types';
5
+ import { Range, Position, MarkupContent, MarkupKind, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, CompletionItemTag, InsertTextFormat, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString, CodeActionContext, Command, CodeAction, DocumentHighlight, DocumentLink, WorkspaceEdit, TextEdit, CodeActionKind, TextDocumentEdit, VersionedTextDocumentIdentifier, DocumentHighlightKind } from 'vscode-languageserver-types';
6
6
  import { TextDocument } from 'vscode-languageserver-textdocument';
7
- export { TextDocument, Range, TextEdit, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, Position, InsertTextFormat, MarkupContent, MarkupKind, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString };
7
+ export { TextDocument, Range, Position, MarkupContent, MarkupKind, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, CompletionItemTag, InsertTextFormat, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString, CodeActionContext, Command, CodeAction, DocumentHighlight, DocumentLink, WorkspaceEdit, TextEdit, CodeActionKind, TextDocumentEdit, VersionedTextDocumentIdentifier, DocumentHighlightKind };
8
8
  /**
9
9
  * Error codes used by diagnostics
10
10
  */
@@ -617,7 +617,7 @@ function validate(n, schema, validationResult, matchingSchemas) {
617
617
  }
618
618
  if (isString(schema.pattern)) {
619
619
  var regex = extendedRegExp(schema.pattern);
620
- if (!regex.test(node.value)) {
620
+ if (!(regex === null || regex === void 0 ? void 0 : regex.test(node.value))) {
621
621
  validationResult.problems.push({
622
622
  location: { offset: node.offset, length: node.length },
623
623
  message: schema.patternErrorMessage || schema.errorMessage || localize('patternWarning', 'String does not match the pattern of "{0}".', schema.pattern)
@@ -811,7 +811,7 @@ function validate(n, schema, validationResult, matchingSchemas) {
811
811
  var regex = extendedRegExp(propertyPattern);
812
812
  for (var _h = 0, _j = unprocessedProperties.slice(0); _h < _j.length; _h++) {
813
813
  var propertyName = _j[_h];
814
- if (regex.test(propertyName)) {
814
+ if (regex === null || regex === void 0 ? void 0 : regex.test(propertyName)) {
815
815
  propertyProcessed(propertyName);
816
816
  var child = seenKeys[propertyName];
817
817
  if (child) {
@@ -13,7 +13,6 @@ export var schemaContributions = {
13
13
  },
14
14
  // bundle the schema-schema to include (localized) descriptions
15
15
  'http://json-schema.org/draft-04/schema#': {
16
- 'title': localize('schema.json', 'Describes a JSON file using a schema. See json-schema.org for more info.'),
17
16
  '$schema': 'http://json-schema.org/draft-04/schema#',
18
17
  'definitions': {
19
18
  'schemaArray': {
@@ -297,7 +296,6 @@ export var schemaContributions = {
297
296
  'default': {}
298
297
  },
299
298
  'http://json-schema.org/draft-07/schema#': {
300
- 'title': localize('schema.json', 'Describes a JSON file using a schema. See json-schema.org for more info.'),
301
299
  'definitions': {
302
300
  'schemaArray': {
303
301
  'type': 'array',
@@ -440,7 +440,7 @@ var JSONCompletion = /** @class */ (function () {
440
440
  for (var _a = 0, _b = Object.keys(s.schema.patternProperties); _a < _b.length; _a++) {
441
441
  var pattern = _b[_a];
442
442
  var regex = extendedRegExp(pattern);
443
- if (regex.test(parentKey)) {
443
+ if (regex === null || regex === void 0 ? void 0 : regex.test(parentKey)) {
444
444
  propertyMatched = true;
445
445
  var propertySchema = s.schema.patternProperties[pattern];
446
446
  this.addSchemaValueCompletions(propertySchema, separatorAfter, collector, types);
@@ -119,7 +119,7 @@ var ResolvedSchema = /** @class */ (function () {
119
119
  for (var _i = 0, _a = Object.keys(schema.patternProperties); _i < _a.length; _i++) {
120
120
  var pattern = _a[_i];
121
121
  var regex = Strings.extendedRegExp(pattern);
122
- if (regex.test(next)) {
122
+ if (regex === null || regex === void 0 ? void 0 : regex.test(next)) {
123
123
  return this.getSectionRecursive(path, schema.patternProperties[pattern]);
124
124
  }
125
125
  }
@@ -175,6 +175,8 @@ var JSONSchemaService = /** @class */ (function () {
175
175
  };
176
176
  JSONSchemaService.prototype.onResourceChange = function (uri) {
177
177
  var _this = this;
178
+ // always clear this local cache when a resource changes
179
+ this.cachedSchemaForResource = undefined;
178
180
  var hasChanges = false;
179
181
  uri = normalizeId(uri);
180
182
  var toWalk = [uri];
@@ -231,7 +233,7 @@ var JSONSchemaService = /** @class */ (function () {
231
233
  this.registeredSchemasIds[id] = true;
232
234
  this.cachedSchemaForResource = undefined;
233
235
  if (filePatterns) {
234
- this.addFilePatternAssociation(filePatterns, [uri]);
236
+ this.addFilePatternAssociation(filePatterns, [id]);
235
237
  }
236
238
  return unresolvedSchemaContent ? this.addSchemaHandle(id, unresolvedSchemaContent) : this.getOrAddSchemaHandle(id);
237
239
  };
@@ -43,10 +43,22 @@ export function repeat(value, count) {
43
43
  return s;
44
44
  }
45
45
  export function extendedRegExp(pattern) {
46
+ var flags = '';
46
47
  if (startsWith(pattern, '(?i)')) {
47
- return new RegExp(pattern.substring(4), 'i');
48
+ pattern = pattern.substring(4);
49
+ flags = 'i';
48
50
  }
49
- else {
50
- return new RegExp(pattern);
51
+ try {
52
+ return new RegExp(pattern, flags + 'u');
53
+ }
54
+ catch (e) {
55
+ // could be an exception due to the 'u ' flag
56
+ try {
57
+ return new RegExp(pattern, flags);
58
+ }
59
+ catch (e) {
60
+ // invalid pattern
61
+ return undefined;
62
+ }
51
63
  }
52
64
  }
@@ -1,8 +1,8 @@
1
1
  import { JSONWorkerContribution, JSONPath, Segment, CompletionsCollector } from './jsonContributions';
2
2
  import { JSONSchema } from './jsonSchema';
3
- import { Range, TextEdit, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, MarkupKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, Position, InsertTextFormat, MarkupContent, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString, FormattingOptions as LSPFormattingOptions, DefinitionLink } from 'vscode-languageserver-types';
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 } from 'vscode-languageserver-textdocument';
5
- export { TextDocument, Range, TextEdit, JSONSchema, JSONWorkerContribution, JSONPath, Segment, CompletionsCollector, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, Position, InsertTextFormat, MarkupContent, MarkupKind, DefinitionLink, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString };
5
+ export { TextDocument, 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
6
  /**
7
7
  * Error codes used by diagnostics
8
8
  */
@@ -13,31 +13,42 @@
13
13
  })(function (require, exports) {
14
14
  "use strict";
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.ClientCapabilities = exports.ErrorCode = exports.MarkedString = exports.Hover = exports.Location = exports.DocumentSymbol = exports.SymbolKind = exports.SymbolInformation = exports.MarkupKind = exports.MarkupContent = exports.InsertTextFormat = exports.Position = exports.CompletionList = exports.CompletionItemKind = exports.CompletionItem = exports.DiagnosticSeverity = exports.Diagnostic = exports.SelectionRange = exports.FoldingRangeKind = exports.FoldingRange = exports.ColorPresentation = exports.ColorInformation = exports.Color = exports.TextEdit = exports.Range = exports.TextDocument = void 0;
16
+ exports.ClientCapabilities = exports.ErrorCode = exports.DocumentHighlightKind = exports.VersionedTextDocumentIdentifier = exports.TextDocumentEdit = exports.CodeActionKind = exports.TextEdit = exports.WorkspaceEdit = exports.DocumentLink = exports.DocumentHighlight = exports.CodeAction = exports.Command = exports.CodeActionContext = exports.MarkedString = exports.Hover = exports.Location = exports.DocumentSymbol = exports.SymbolKind = exports.SymbolInformation = exports.InsertTextFormat = exports.CompletionItemTag = exports.CompletionList = exports.CompletionItemKind = exports.CompletionItem = exports.DiagnosticSeverity = exports.Diagnostic = exports.SelectionRange = exports.FoldingRangeKind = exports.FoldingRange = exports.ColorPresentation = exports.ColorInformation = exports.Color = exports.MarkupKind = exports.MarkupContent = exports.Position = exports.Range = exports.TextDocument = void 0;
17
17
  var vscode_languageserver_types_1 = require("vscode-languageserver-types");
18
18
  Object.defineProperty(exports, "Range", { enumerable: true, get: function () { return vscode_languageserver_types_1.Range; } });
19
- Object.defineProperty(exports, "TextEdit", { enumerable: true, get: function () { return vscode_languageserver_types_1.TextEdit; } });
19
+ Object.defineProperty(exports, "Position", { enumerable: true, get: function () { return vscode_languageserver_types_1.Position; } });
20
+ Object.defineProperty(exports, "MarkupContent", { enumerable: true, get: function () { return vscode_languageserver_types_1.MarkupContent; } });
21
+ Object.defineProperty(exports, "MarkupKind", { enumerable: true, get: function () { return vscode_languageserver_types_1.MarkupKind; } });
20
22
  Object.defineProperty(exports, "Color", { enumerable: true, get: function () { return vscode_languageserver_types_1.Color; } });
21
23
  Object.defineProperty(exports, "ColorInformation", { enumerable: true, get: function () { return vscode_languageserver_types_1.ColorInformation; } });
22
24
  Object.defineProperty(exports, "ColorPresentation", { enumerable: true, get: function () { return vscode_languageserver_types_1.ColorPresentation; } });
23
25
  Object.defineProperty(exports, "FoldingRange", { enumerable: true, get: function () { return vscode_languageserver_types_1.FoldingRange; } });
24
26
  Object.defineProperty(exports, "FoldingRangeKind", { enumerable: true, get: function () { return vscode_languageserver_types_1.FoldingRangeKind; } });
25
- Object.defineProperty(exports, "MarkupKind", { enumerable: true, get: function () { return vscode_languageserver_types_1.MarkupKind; } });
26
27
  Object.defineProperty(exports, "SelectionRange", { enumerable: true, get: function () { return vscode_languageserver_types_1.SelectionRange; } });
27
28
  Object.defineProperty(exports, "Diagnostic", { enumerable: true, get: function () { return vscode_languageserver_types_1.Diagnostic; } });
28
29
  Object.defineProperty(exports, "DiagnosticSeverity", { enumerable: true, get: function () { return vscode_languageserver_types_1.DiagnosticSeverity; } });
29
30
  Object.defineProperty(exports, "CompletionItem", { enumerable: true, get: function () { return vscode_languageserver_types_1.CompletionItem; } });
30
31
  Object.defineProperty(exports, "CompletionItemKind", { enumerable: true, get: function () { return vscode_languageserver_types_1.CompletionItemKind; } });
31
32
  Object.defineProperty(exports, "CompletionList", { enumerable: true, get: function () { return vscode_languageserver_types_1.CompletionList; } });
32
- Object.defineProperty(exports, "Position", { enumerable: true, get: function () { return vscode_languageserver_types_1.Position; } });
33
+ Object.defineProperty(exports, "CompletionItemTag", { enumerable: true, get: function () { return vscode_languageserver_types_1.CompletionItemTag; } });
33
34
  Object.defineProperty(exports, "InsertTextFormat", { enumerable: true, get: function () { return vscode_languageserver_types_1.InsertTextFormat; } });
34
- Object.defineProperty(exports, "MarkupContent", { enumerable: true, get: function () { return vscode_languageserver_types_1.MarkupContent; } });
35
35
  Object.defineProperty(exports, "SymbolInformation", { enumerable: true, get: function () { return vscode_languageserver_types_1.SymbolInformation; } });
36
36
  Object.defineProperty(exports, "SymbolKind", { enumerable: true, get: function () { return vscode_languageserver_types_1.SymbolKind; } });
37
37
  Object.defineProperty(exports, "DocumentSymbol", { enumerable: true, get: function () { return vscode_languageserver_types_1.DocumentSymbol; } });
38
38
  Object.defineProperty(exports, "Location", { enumerable: true, get: function () { return vscode_languageserver_types_1.Location; } });
39
39
  Object.defineProperty(exports, "Hover", { enumerable: true, get: function () { return vscode_languageserver_types_1.Hover; } });
40
40
  Object.defineProperty(exports, "MarkedString", { enumerable: true, get: function () { return vscode_languageserver_types_1.MarkedString; } });
41
+ Object.defineProperty(exports, "CodeActionContext", { enumerable: true, get: function () { return vscode_languageserver_types_1.CodeActionContext; } });
42
+ Object.defineProperty(exports, "Command", { enumerable: true, get: function () { return vscode_languageserver_types_1.Command; } });
43
+ Object.defineProperty(exports, "CodeAction", { enumerable: true, get: function () { return vscode_languageserver_types_1.CodeAction; } });
44
+ Object.defineProperty(exports, "DocumentHighlight", { enumerable: true, get: function () { return vscode_languageserver_types_1.DocumentHighlight; } });
45
+ Object.defineProperty(exports, "DocumentLink", { enumerable: true, get: function () { return vscode_languageserver_types_1.DocumentLink; } });
46
+ Object.defineProperty(exports, "WorkspaceEdit", { enumerable: true, get: function () { return vscode_languageserver_types_1.WorkspaceEdit; } });
47
+ Object.defineProperty(exports, "TextEdit", { enumerable: true, get: function () { return vscode_languageserver_types_1.TextEdit; } });
48
+ Object.defineProperty(exports, "CodeActionKind", { enumerable: true, get: function () { return vscode_languageserver_types_1.CodeActionKind; } });
49
+ Object.defineProperty(exports, "TextDocumentEdit", { enumerable: true, get: function () { return vscode_languageserver_types_1.TextDocumentEdit; } });
50
+ Object.defineProperty(exports, "VersionedTextDocumentIdentifier", { enumerable: true, get: function () { return vscode_languageserver_types_1.VersionedTextDocumentIdentifier; } });
51
+ Object.defineProperty(exports, "DocumentHighlightKind", { enumerable: true, get: function () { return vscode_languageserver_types_1.DocumentHighlightKind; } });
41
52
  var vscode_languageserver_textdocument_1 = require("vscode-languageserver-textdocument");
42
53
  Object.defineProperty(exports, "TextDocument", { enumerable: true, get: function () { return vscode_languageserver_textdocument_1.TextDocument; } });
43
54
  /**
@@ -634,7 +634,7 @@ var __extends = (this && this.__extends) || (function () {
634
634
  }
635
635
  if (objects_1.isString(schema.pattern)) {
636
636
  var regex = strings_1.extendedRegExp(schema.pattern);
637
- if (!regex.test(node.value)) {
637
+ if (!(regex === null || regex === void 0 ? void 0 : regex.test(node.value))) {
638
638
  validationResult.problems.push({
639
639
  location: { offset: node.offset, length: node.length },
640
640
  message: schema.patternErrorMessage || schema.errorMessage || localize('patternWarning', 'String does not match the pattern of "{0}".', schema.pattern)
@@ -828,7 +828,7 @@ var __extends = (this && this.__extends) || (function () {
828
828
  var regex = strings_1.extendedRegExp(propertyPattern);
829
829
  for (var _h = 0, _j = unprocessedProperties.slice(0); _h < _j.length; _h++) {
830
830
  var propertyName = _j[_h];
831
- if (regex.test(propertyName)) {
831
+ if (regex === null || regex === void 0 ? void 0 : regex.test(propertyName)) {
832
832
  propertyProcessed(propertyName);
833
833
  var child = seenKeys[propertyName];
834
834
  if (child) {
@@ -25,7 +25,6 @@
25
25
  },
26
26
  // bundle the schema-schema to include (localized) descriptions
27
27
  'http://json-schema.org/draft-04/schema#': {
28
- 'title': localize('schema.json', 'Describes a JSON file using a schema. See json-schema.org for more info.'),
29
28
  '$schema': 'http://json-schema.org/draft-04/schema#',
30
29
  'definitions': {
31
30
  'schemaArray': {
@@ -309,7 +308,6 @@
309
308
  'default': {}
310
309
  },
311
310
  'http://json-schema.org/draft-07/schema#': {
312
- 'title': localize('schema.json', 'Describes a JSON file using a schema. See json-schema.org for more info.'),
313
311
  'definitions': {
314
312
  'schemaArray': {
315
313
  'type': 'array',
@@ -452,7 +452,7 @@
452
452
  for (var _a = 0, _b = Object.keys(s.schema.patternProperties); _a < _b.length; _a++) {
453
453
  var pattern = _b[_a];
454
454
  var regex = strings_1.extendedRegExp(pattern);
455
- if (regex.test(parentKey)) {
455
+ if (regex === null || regex === void 0 ? void 0 : regex.test(parentKey)) {
456
456
  propertyMatched = true;
457
457
  var propertySchema = s.schema.patternProperties[pattern];
458
458
  this.addSchemaValueCompletions(propertySchema, separatorAfter, collector, types);
@@ -131,7 +131,7 @@
131
131
  for (var _i = 0, _a = Object.keys(schema.patternProperties); _i < _a.length; _i++) {
132
132
  var pattern = _a[_i];
133
133
  var regex = Strings.extendedRegExp(pattern);
134
- if (regex.test(next)) {
134
+ if (regex === null || regex === void 0 ? void 0 : regex.test(next)) {
135
135
  return this.getSectionRecursive(path, schema.patternProperties[pattern]);
136
136
  }
137
137
  }
@@ -187,6 +187,8 @@
187
187
  };
188
188
  JSONSchemaService.prototype.onResourceChange = function (uri) {
189
189
  var _this = this;
190
+ // always clear this local cache when a resource changes
191
+ this.cachedSchemaForResource = undefined;
190
192
  var hasChanges = false;
191
193
  uri = normalizeId(uri);
192
194
  var toWalk = [uri];
@@ -243,7 +245,7 @@
243
245
  this.registeredSchemasIds[id] = true;
244
246
  this.cachedSchemaForResource = undefined;
245
247
  if (filePatterns) {
246
- this.addFilePatternAssociation(filePatterns, [uri]);
248
+ this.addFilePatternAssociation(filePatterns, [id]);
247
249
  }
248
250
  return unresolvedSchemaContent ? this.addSchemaHandle(id, unresolvedSchemaContent) : this.getOrAddSchemaHandle(id);
249
251
  };
@@ -59,11 +59,23 @@
59
59
  }
60
60
  exports.repeat = repeat;
61
61
  function extendedRegExp(pattern) {
62
+ var flags = '';
62
63
  if (startsWith(pattern, '(?i)')) {
63
- return new RegExp(pattern.substring(4), 'i');
64
+ pattern = pattern.substring(4);
65
+ flags = 'i';
64
66
  }
65
- else {
66
- return new RegExp(pattern);
67
+ try {
68
+ return new RegExp(pattern, flags + 'u');
69
+ }
70
+ catch (e) {
71
+ // could be an exception due to the 'u ' flag
72
+ try {
73
+ return new RegExp(pattern, flags);
74
+ }
75
+ catch (e) {
76
+ // invalid pattern
77
+ return undefined;
78
+ }
67
79
  }
68
80
  }
69
81
  exports.extendedRegExp = extendedRegExp;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vscode-json-languageservice",
3
- "version": "4.1.6",
3
+ "version": "4.1.10",
4
4
  "description": "Language service for JSON",
5
5
  "main": "./lib/umd/jsonLanguageService.js",
6
6
  "typings": "./lib/umd/jsonLanguageService",
@@ -14,16 +14,13 @@
14
14
  "bugs": {
15
15
  "url": "https://github.com/Microsoft/vscode-json-languageservice"
16
16
  },
17
- "engines": {
18
- "npm": ">=7.0.0"
19
- },
20
17
  "devDependencies": {
21
- "@types/mocha": "^8.2.0",
18
+ "@types/mocha": "^9.0.0",
22
19
  "@types/node": "^10.12.21",
23
- "@typescript-eslint/eslint-plugin": "^4.14.0",
24
- "@typescript-eslint/parser": "^4.14.0",
25
- "eslint": "^7.18.0",
26
- "mocha": "^8.2.1",
20
+ "@typescript-eslint/eslint-plugin": "^4.32.0",
21
+ "@typescript-eslint/parser": "^4.32.0",
22
+ "eslint": "^7.32.0",
23
+ "mocha": "^9.1.2",
27
24
  "rimraf": "^3.0.2",
28
25
  "typescript": "^4.1.3"
29
26
  },