vscode-json-languageservice 5.4.0 → 5.4.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.
@@ -1,10 +1,10 @@
1
- import { Thenable, MarkedString, CompletionItem } from './jsonLanguageService';
1
+ import { MarkedString, CompletionItem } from './jsonLanguageService';
2
2
  export interface JSONWorkerContribution {
3
- getInfoContribution(uri: string, location: JSONPath): Thenable<MarkedString[]>;
4
- collectPropertyCompletions(uri: string, location: JSONPath, currentWord: string, addValue: boolean, isLast: boolean, result: CompletionsCollector): Thenable<any>;
5
- collectValueCompletions(uri: string, location: JSONPath, propertyKey: string, result: CompletionsCollector): Thenable<any>;
6
- collectDefaultCompletions(uri: string, result: CompletionsCollector): Thenable<any>;
7
- resolveCompletion?(item: CompletionItem): Thenable<CompletionItem>;
3
+ getInfoContribution(uri: string, location: JSONPath): PromiseLike<MarkedString[]>;
4
+ collectPropertyCompletions(uri: string, location: JSONPath, currentWord: string, addValue: boolean, isLast: boolean, result: CompletionsCollector): PromiseLike<any>;
5
+ collectValueCompletions(uri: string, location: JSONPath, propertyKey: string, result: CompletionsCollector): PromiseLike<any>;
6
+ collectDefaultCompletions(uri: string, result: CompletionsCollector): PromiseLike<any>;
7
+ resolveCompletion?(item: CompletionItem): PromiseLike<CompletionItem>;
8
8
  }
9
9
  export type Segment = string | number;
10
10
  export type JSONPath = Segment[];
@@ -1,4 +1,4 @@
1
- import { Thenable, ASTNode, Color, ColorInformation, ColorPresentation, LanguageServiceParams, LanguageSettings, DocumentLanguageSettings, FoldingRange, JSONSchema, SelectionRange, FoldingRangesContext, DocumentSymbolsContext, ColorInformationContext as DocumentColorsContext, TextDocument, Position, CompletionItem, CompletionList, Hover, Range, SymbolInformation, Diagnostic, TextEdit, FormattingOptions, DocumentSymbol, DefinitionLink, MatchingSchema, JSONLanguageStatus, SortOptions } from './jsonLanguageTypes';
1
+ import { ASTNode, Color, ColorInformation, ColorPresentation, LanguageServiceParams, LanguageSettings, DocumentLanguageSettings, FoldingRange, JSONSchema, SelectionRange, FoldingRangesContext, DocumentSymbolsContext, ColorInformationContext as DocumentColorsContext, TextDocument, Position, CompletionItem, CompletionList, Hover, Range, SymbolInformation, Diagnostic, TextEdit, FormattingOptions, DocumentSymbol, DefinitionLink, MatchingSchema, JSONLanguageStatus, SortOptions } from './jsonLanguageTypes';
2
2
  import { DocumentLink } from 'vscode-languageserver-types';
3
3
  export type JSONDocument = {
4
4
  root: ASTNode | undefined;
@@ -7,23 +7,23 @@ export type JSONDocument = {
7
7
  export * from './jsonLanguageTypes';
8
8
  export interface LanguageService {
9
9
  configure(settings: LanguageSettings): void;
10
- doValidation(document: TextDocument, jsonDocument: JSONDocument, documentSettings?: DocumentLanguageSettings, schema?: JSONSchema): Thenable<Diagnostic[]>;
10
+ doValidation(document: TextDocument, jsonDocument: JSONDocument, documentSettings?: DocumentLanguageSettings, schema?: JSONSchema): PromiseLike<Diagnostic[]>;
11
11
  parseJSONDocument(document: TextDocument): JSONDocument;
12
12
  newJSONDocument(rootNode: ASTNode, syntaxDiagnostics?: Diagnostic[]): JSONDocument;
13
13
  resetSchema(uri: string): boolean;
14
- getMatchingSchemas(document: TextDocument, jsonDocument: JSONDocument, schema?: JSONSchema): Thenable<MatchingSchema[]>;
14
+ getMatchingSchemas(document: TextDocument, jsonDocument: JSONDocument, schema?: JSONSchema): PromiseLike<MatchingSchema[]>;
15
15
  getLanguageStatus(document: TextDocument, jsonDocument: JSONDocument): JSONLanguageStatus;
16
- doResolve(item: CompletionItem): Thenable<CompletionItem>;
17
- doComplete(document: TextDocument, position: Position, doc: JSONDocument): Thenable<CompletionList | null>;
16
+ doResolve(item: CompletionItem): PromiseLike<CompletionItem>;
17
+ doComplete(document: TextDocument, position: Position, doc: JSONDocument): PromiseLike<CompletionList | null>;
18
18
  findDocumentSymbols(document: TextDocument, doc: JSONDocument, context?: DocumentSymbolsContext): SymbolInformation[];
19
19
  findDocumentSymbols2(document: TextDocument, doc: JSONDocument, context?: DocumentSymbolsContext): DocumentSymbol[];
20
- findDocumentColors(document: TextDocument, doc: JSONDocument, context?: DocumentColorsContext): Thenable<ColorInformation[]>;
20
+ findDocumentColors(document: TextDocument, doc: JSONDocument, context?: DocumentColorsContext): PromiseLike<ColorInformation[]>;
21
21
  getColorPresentations(document: TextDocument, doc: JSONDocument, color: Color, range: Range): ColorPresentation[];
22
- doHover(document: TextDocument, position: Position, doc: JSONDocument): Thenable<Hover | null>;
22
+ doHover(document: TextDocument, position: Position, doc: JSONDocument): PromiseLike<Hover | null>;
23
23
  getFoldingRanges(document: TextDocument, context?: FoldingRangesContext): FoldingRange[];
24
24
  getSelectionRanges(document: TextDocument, positions: Position[], doc: JSONDocument): SelectionRange[];
25
- findDefinition(document: TextDocument, position: Position, doc: JSONDocument): Thenable<DefinitionLink[]>;
26
- findLinks(document: TextDocument, doc: JSONDocument): Thenable<DocumentLink[]>;
25
+ findDefinition(document: TextDocument, position: Position, doc: JSONDocument): PromiseLike<DefinitionLink[]>;
26
+ findLinks(document: TextDocument, doc: JSONDocument): PromiseLike<DocumentLink[]>;
27
27
  format(document: TextDocument, range: Range, options: FormattingOptions): TextEdit[];
28
28
  sort(document: TextDocument, options: SortOptions): TextEdit[];
29
29
  }
@@ -156,7 +156,7 @@ export interface WorkspaceContextService {
156
156
  * In case of an error, returns a rejected promise with a displayable error string.
157
157
  */
158
158
  export interface SchemaRequestService {
159
- (uri: string): Thenable<string>;
159
+ (uri: string): PromiseLike<string>;
160
160
  }
161
161
  export interface PromiseConstructor {
162
162
  /**
@@ -165,36 +165,33 @@ export interface PromiseConstructor {
165
165
  * a resolve callback used resolve the promise with a value or the result of another promise,
166
166
  * and a reject callback used to reject the promise with a provided reason or error.
167
167
  */
168
- new <T>(executor: (resolve: (value?: T | Thenable<T | undefined>) => void, reject: (reason?: any) => void) => void): Thenable<T | undefined>;
168
+ new <T>(executor: (resolve: (value?: T | PromiseLike<T | undefined>) => void, reject: (reason?: any) => void) => void): PromiseLike<T | undefined>;
169
169
  /**
170
170
  * Creates a Promise that is resolved with an array of results when all of the provided Promises
171
171
  * resolve, or rejected when any Promise is rejected.
172
172
  * @param values An array of Promises.
173
173
  * @returns A new Promise.
174
174
  */
175
- all<T>(values: Array<T | Thenable<T>>): Thenable<T[]>;
175
+ all<T>(values: Array<T | PromiseLike<T>>): PromiseLike<T[]>;
176
176
  /**
177
177
  * Creates a new rejected promise for the provided reason.
178
178
  * @param reason The reason the promise was rejected.
179
179
  * @returns A new rejected Promise.
180
180
  */
181
- reject<T>(reason: any): Thenable<T>;
181
+ reject<T>(reason: any): PromiseLike<T>;
182
182
  /**
183
183
  * Creates a new resolved promise for the provided value.
184
184
  * @param value A promise.
185
185
  * @returns A promise whose internal state matches the provided promise.
186
186
  */
187
- resolve<T>(value: T | Thenable<T>): Thenable<T>;
187
+ resolve<T>(value: T | PromiseLike<T>): PromiseLike<T>;
188
188
  }
189
- export interface Thenable<R> {
190
- /**
191
- * Attaches callbacks for the resolution and/or rejection of the Promise.
192
- * @param onfulfilled The callback to execute when the Promise is resolved.
193
- * @param onrejected The callback to execute when the Promise is rejected.
194
- * @returns A Promise for the completion of which ever callback is executed.
195
- */
196
- then<TResult>(onfulfilled?: (value: R) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Thenable<TResult>;
197
- then<TResult>(onfulfilled?: (value: R) => TResult | Thenable<TResult>, onrejected?: (reason: any) => void): Thenable<TResult>;
189
+ /**
190
+ * A deprecated alias of {@link PromiseLike}
191
+ *
192
+ * @deprecated
193
+ */
194
+ export interface Thenable<R> extends PromiseLike<R> {
198
195
  }
199
196
  export interface LanguageServiceParams {
200
197
  /**
@@ -83,6 +83,7 @@ export interface JSONSchema {
83
83
  suggestSortText?: string;
84
84
  allowComments?: boolean;
85
85
  allowTrailingCommas?: boolean;
86
+ completionDetail?: string;
86
87
  }
87
88
  export interface JSONSchemaMap {
88
89
  [name: string]: JSONSchemaRef;
@@ -164,6 +164,10 @@ export class ValidationResult {
164
164
  mergeEnumValues(validationResult) {
165
165
  if (!this.enumValueMatch && !validationResult.enumValueMatch && this.enumValues && validationResult.enumValues) {
166
166
  this.enumValues = this.enumValues.concat(validationResult.enumValues);
167
+ }
168
+ }
169
+ updateEnumMismatchProblemMessages() {
170
+ if (!this.enumValueMatch && this.enumValues) {
167
171
  for (const error of this.problems) {
168
172
  if (error.code === ErrorCode.EnumValueMismatch) {
169
173
  error.message = l10n.t('Value is not accepted. Valid values: {0}.', this.enumValues.map(v => JSON.stringify(v)).join(', '));
@@ -382,6 +386,7 @@ function validate(n, schema, validationResult, matchingSchemas, context) {
382
386
  });
383
387
  }
384
388
  if (bestMatch) {
389
+ bestMatch.validationResult.updateEnumMismatchProblemMessages();
385
390
  validationResult.merge(bestMatch.validationResult);
386
391
  matchingSchemas.merge(bestMatch.matchingSchemas);
387
392
  }
@@ -460,8 +460,8 @@ export const schemaContributions = {
460
460
  const descriptions = {
461
461
  id: l10n.t("A unique identifier for the schema."),
462
462
  $schema: l10n.t("The schema to verify this document against."),
463
- title: l10n.t("A descriptive title of the element."),
464
- description: l10n.t("A long description of the element. Used in hover menus and suggestions."),
463
+ title: l10n.t("A descriptive title of the schema."),
464
+ description: l10n.t("A long description of the schema. Used in hover menus and suggestions."),
465
465
  default: l10n.t("A default value. Used by suggestions."),
466
466
  multipleOf: l10n.t("A number that should cleanly divide the current value (i.e. have no remainder)."),
467
467
  maximum: l10n.t("The maximum numerical value, inclusive by default."),
@@ -471,7 +471,7 @@ const descriptions = {
471
471
  maxLength: l10n.t("The maximum length of a string."),
472
472
  minLength: l10n.t("The minimum length of a string."),
473
473
  pattern: l10n.t("A regular expression to match the string against. It is not implicitly anchored."),
474
- additionalItems: l10n.t("For arrays, only when items is set as an array. If it is a schema, then this schema validates items after the ones specified by the items array. If it is false, then additional items will cause validation to fail."),
474
+ additionalItems: l10n.t("For arrays, only when items is set as an array. If items are a schema, this schema validates items after the ones specified by the items schema. If false, additional items will cause validation to fail."),
475
475
  items: l10n.t("For arrays. Can either be a schema to validate every element against or an array of schemas to validate each item against in order (the first schema will validate the first element, the second schema will validate the second element, and so on."),
476
476
  maxItems: l10n.t("The maximum number of items that can be inside an array. Inclusive."),
477
477
  minItems: l10n.t("The minimum number of items that can be inside an array. Inclusive."),
@@ -479,14 +479,14 @@ const descriptions = {
479
479
  maxProperties: l10n.t("The maximum number of properties an object can have. Inclusive."),
480
480
  minProperties: l10n.t("The minimum number of properties an object can have. Inclusive."),
481
481
  required: l10n.t("An array of strings that lists the names of all properties required on this object."),
482
- additionalProperties: l10n.t("Either a schema or a boolean. If a schema, then used to validate all properties not matched by 'properties' or 'patternProperties'. If false, then any properties not matched by either will cause this schema to fail."),
482
+ additionalProperties: l10n.t("Either a schema or a boolean. If a schema, used to validate all properties not matched by 'properties', 'propertyNames', or 'patternProperties'. If false, any properties not defined by the adajacent keywords will cause this schema to fail."),
483
483
  definitions: l10n.t("Not used for validation. Place subschemas here that you wish to reference inline with $ref."),
484
484
  properties: l10n.t("A map of property names to schemas for each property."),
485
485
  patternProperties: l10n.t("A map of regular expressions on property names to schemas for matching properties."),
486
486
  dependencies: l10n.t("A map of property names to either an array of property names or a schema. An array of property names means the property named in the key depends on the properties in the array being present in the object in order to be valid. If the value is a schema, then the schema is only applied to the object if the property in the key exists on the object."),
487
487
  enum: l10n.t("The set of literal values that are valid."),
488
488
  type: l10n.t("Either a string of one of the basic schema types (number, integer, null, array, object, boolean, string) or an array of strings specifying a subset of those types."),
489
- format: l10n.t("Describes the format expected for the value."),
489
+ format: l10n.t("Describes the format expected for the value. By default, not used for validation"),
490
490
  allOf: l10n.t("An array of schemas, all of which must match."),
491
491
  anyOf: l10n.t("An array of schemas, where at least one must match."),
492
492
  oneOf: l10n.t("An array of schemas, exactly one of which must match."),
@@ -502,7 +502,7 @@ const descriptions = {
502
502
  contentMediaType: l10n.t("Describes the media type of a string property."),
503
503
  contentEncoding: l10n.t("Describes the content encoding of a string property."),
504
504
  if: l10n.t("The validation outcome of the \"if\" subschema controls which of the \"then\" or \"else\" keywords are evaluated."),
505
- then: l10n.t("The \"if\" subschema is used for validation when the \"if\" subschema succeeds."),
505
+ then: l10n.t("The \"then\" subschema is used for validation when the \"if\" subschema succeeds."),
506
506
  else: l10n.t("The \"else\" subschema is used for validation when the \"if\" subschema fails.")
507
507
  };
508
508
  for (const schemaName in schemaContributions.schemas) {
@@ -205,8 +205,11 @@ export class JSONCompletion {
205
205
  insertText: this.getInsertTextForProperty(key, propertySchema, addValue, separatorAfter),
206
206
  insertTextFormat: InsertTextFormat.Snippet,
207
207
  filterText: this.getFilterTextForValue(key),
208
- documentation: this.fromMarkup(propertySchema.markdownDescription) || propertySchema.description || '',
208
+ documentation: this.fromMarkup(propertySchema.markdownDescription) || propertySchema.description || ''
209
209
  };
210
+ if (propertySchema.completionDetail !== undefined) {
211
+ proposal.detail = propertySchema.completionDetail;
212
+ }
210
213
  if (propertySchema.suggestSortText !== undefined) {
211
214
  proposal.sortText = propertySchema.suggestSortText;
212
215
  }
@@ -229,8 +232,11 @@ export class JSONCompletion {
229
232
  insertText: this.getInsertTextForProperty(name, undefined, addValue, separatorAfter),
230
233
  insertTextFormat: InsertTextFormat.Snippet,
231
234
  filterText: this.getFilterTextForValue(name),
232
- documentation: enumDescription || this.fromMarkup(schemaPropertyNames.markdownDescription) || schemaPropertyNames.description || '',
235
+ documentation: enumDescription || this.fromMarkup(schemaPropertyNames.markdownDescription) || schemaPropertyNames.description || ''
233
236
  };
237
+ if (schemaPropertyNames.completionDetail !== undefined) {
238
+ proposal.detail = schemaPropertyNames.completionDetail;
239
+ }
234
240
  if (schemaPropertyNames.suggestSortText !== undefined) {
235
241
  proposal.sortText = schemaPropertyNames.suggestSortText;
236
242
  }
@@ -352,7 +352,7 @@ export class JSONSchemaService {
352
352
  }
353
353
  };
354
354
  const resolveExternalLink = (node, uri, refSegment, parentHandle) => {
355
- if (contextService && !/^[A-Za-z][A-Za-z0-9+\-.+]*:\/\/.*/.test(uri)) {
355
+ if (contextService && !/^[A-Za-z][A-Za-z0-9+\-.+]*:\/.*/.test(uri)) {
356
356
  uri = contextService.resolveRelativePath(uri, parentHandle.uri);
357
357
  }
358
358
  uri = normalizeId(uri);
@@ -2,7 +2,6 @@
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 { TextEdit} from 'vscode-languageserver-textdocument';
6
5
  import { createScanner } from 'jsonc-parser';
7
6
  import { TextDocument, TextEdit, Position, Range } from '../jsonLanguageTypes';
8
7
  import { format } from './format';
@@ -322,6 +321,13 @@ function sortJsoncDocument(jsonDocument, propertyTree) {
322
321
  }
323
322
  return sortedJsonDocument;
324
323
  }
324
+ function sortPropertiesCaseSensitive(properties) {
325
+ properties.sort((a, b) => {
326
+ const aName = a.propertyName ?? '';
327
+ const bName = b.propertyName ?? '';
328
+ return aName < bName ? -1 : aName > bName ? 1 : 0;
329
+ });
330
+ }
325
331
  function updateSortingQueue(queue, propertyTree, beginningLineNumber) {
326
332
  if (propertyTree.childrenProperties.length === 0) {
327
333
  return;
@@ -335,6 +341,7 @@ function updateSortingQueue(queue, propertyTree, beginningLineNumber) {
335
341
  }
336
342
  const diff = minimumBeginningLineNumber - propertyTree.beginningLineNumber;
337
343
  beginningLineNumber = beginningLineNumber + diff;
344
+ sortPropertiesCaseSensitive(propertyTree.childrenProperties);
338
345
  queue.push(new SortingRange(beginningLineNumber, propertyTree.childrenProperties));
339
346
  }
340
347
  else if (propertyTree.type === Container.Array) {
@@ -1,10 +1,10 @@
1
- import { Thenable, MarkedString, CompletionItem } from './jsonLanguageService';
1
+ import { MarkedString, CompletionItem } from './jsonLanguageService';
2
2
  export interface JSONWorkerContribution {
3
- getInfoContribution(uri: string, location: JSONPath): Thenable<MarkedString[]>;
4
- collectPropertyCompletions(uri: string, location: JSONPath, currentWord: string, addValue: boolean, isLast: boolean, result: CompletionsCollector): Thenable<any>;
5
- collectValueCompletions(uri: string, location: JSONPath, propertyKey: string, result: CompletionsCollector): Thenable<any>;
6
- collectDefaultCompletions(uri: string, result: CompletionsCollector): Thenable<any>;
7
- resolveCompletion?(item: CompletionItem): Thenable<CompletionItem>;
3
+ getInfoContribution(uri: string, location: JSONPath): PromiseLike<MarkedString[]>;
4
+ collectPropertyCompletions(uri: string, location: JSONPath, currentWord: string, addValue: boolean, isLast: boolean, result: CompletionsCollector): PromiseLike<any>;
5
+ collectValueCompletions(uri: string, location: JSONPath, propertyKey: string, result: CompletionsCollector): PromiseLike<any>;
6
+ collectDefaultCompletions(uri: string, result: CompletionsCollector): PromiseLike<any>;
7
+ resolveCompletion?(item: CompletionItem): PromiseLike<CompletionItem>;
8
8
  }
9
9
  export type Segment = string | number;
10
10
  export type JSONPath = Segment[];
@@ -1,4 +1,4 @@
1
- import { Thenable, ASTNode, Color, ColorInformation, ColorPresentation, LanguageServiceParams, LanguageSettings, DocumentLanguageSettings, FoldingRange, JSONSchema, SelectionRange, FoldingRangesContext, DocumentSymbolsContext, ColorInformationContext as DocumentColorsContext, TextDocument, Position, CompletionItem, CompletionList, Hover, Range, SymbolInformation, Diagnostic, TextEdit, FormattingOptions, DocumentSymbol, DefinitionLink, MatchingSchema, JSONLanguageStatus, SortOptions } from './jsonLanguageTypes';
1
+ import { ASTNode, Color, ColorInformation, ColorPresentation, LanguageServiceParams, LanguageSettings, DocumentLanguageSettings, FoldingRange, JSONSchema, SelectionRange, FoldingRangesContext, DocumentSymbolsContext, ColorInformationContext as DocumentColorsContext, TextDocument, Position, CompletionItem, CompletionList, Hover, Range, SymbolInformation, Diagnostic, TextEdit, FormattingOptions, DocumentSymbol, DefinitionLink, MatchingSchema, JSONLanguageStatus, SortOptions } from './jsonLanguageTypes';
2
2
  import { DocumentLink } from 'vscode-languageserver-types';
3
3
  export type JSONDocument = {
4
4
  root: ASTNode | undefined;
@@ -7,23 +7,23 @@ export type JSONDocument = {
7
7
  export * from './jsonLanguageTypes';
8
8
  export interface LanguageService {
9
9
  configure(settings: LanguageSettings): void;
10
- doValidation(document: TextDocument, jsonDocument: JSONDocument, documentSettings?: DocumentLanguageSettings, schema?: JSONSchema): Thenable<Diagnostic[]>;
10
+ doValidation(document: TextDocument, jsonDocument: JSONDocument, documentSettings?: DocumentLanguageSettings, schema?: JSONSchema): PromiseLike<Diagnostic[]>;
11
11
  parseJSONDocument(document: TextDocument): JSONDocument;
12
12
  newJSONDocument(rootNode: ASTNode, syntaxDiagnostics?: Diagnostic[]): JSONDocument;
13
13
  resetSchema(uri: string): boolean;
14
- getMatchingSchemas(document: TextDocument, jsonDocument: JSONDocument, schema?: JSONSchema): Thenable<MatchingSchema[]>;
14
+ getMatchingSchemas(document: TextDocument, jsonDocument: JSONDocument, schema?: JSONSchema): PromiseLike<MatchingSchema[]>;
15
15
  getLanguageStatus(document: TextDocument, jsonDocument: JSONDocument): JSONLanguageStatus;
16
- doResolve(item: CompletionItem): Thenable<CompletionItem>;
17
- doComplete(document: TextDocument, position: Position, doc: JSONDocument): Thenable<CompletionList | null>;
16
+ doResolve(item: CompletionItem): PromiseLike<CompletionItem>;
17
+ doComplete(document: TextDocument, position: Position, doc: JSONDocument): PromiseLike<CompletionList | null>;
18
18
  findDocumentSymbols(document: TextDocument, doc: JSONDocument, context?: DocumentSymbolsContext): SymbolInformation[];
19
19
  findDocumentSymbols2(document: TextDocument, doc: JSONDocument, context?: DocumentSymbolsContext): DocumentSymbol[];
20
- findDocumentColors(document: TextDocument, doc: JSONDocument, context?: DocumentColorsContext): Thenable<ColorInformation[]>;
20
+ findDocumentColors(document: TextDocument, doc: JSONDocument, context?: DocumentColorsContext): PromiseLike<ColorInformation[]>;
21
21
  getColorPresentations(document: TextDocument, doc: JSONDocument, color: Color, range: Range): ColorPresentation[];
22
- doHover(document: TextDocument, position: Position, doc: JSONDocument): Thenable<Hover | null>;
22
+ doHover(document: TextDocument, position: Position, doc: JSONDocument): PromiseLike<Hover | null>;
23
23
  getFoldingRanges(document: TextDocument, context?: FoldingRangesContext): FoldingRange[];
24
24
  getSelectionRanges(document: TextDocument, positions: Position[], doc: JSONDocument): SelectionRange[];
25
- findDefinition(document: TextDocument, position: Position, doc: JSONDocument): Thenable<DefinitionLink[]>;
26
- findLinks(document: TextDocument, doc: JSONDocument): Thenable<DocumentLink[]>;
25
+ findDefinition(document: TextDocument, position: Position, doc: JSONDocument): PromiseLike<DefinitionLink[]>;
26
+ findLinks(document: TextDocument, doc: JSONDocument): PromiseLike<DocumentLink[]>;
27
27
  format(document: TextDocument, range: Range, options: FormattingOptions): TextEdit[];
28
28
  sort(document: TextDocument, options: SortOptions): TextEdit[];
29
29
  }
@@ -27,7 +27,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
27
27
  })(function (require, exports) {
28
28
  "use strict";
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
- exports.getLanguageService = void 0;
30
+ exports.getLanguageService = getLanguageService;
31
31
  const jsonCompletion_1 = require("./services/jsonCompletion");
32
32
  const jsonHover_1 = require("./services/jsonHover");
33
33
  const jsonValidation_1 = require("./services/jsonValidation");
@@ -76,5 +76,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
76
76
  sort: (document, options) => (0, sort_1.sort)(document, options)
77
77
  };
78
78
  }
79
- exports.getLanguageService = getLanguageService;
80
79
  });
@@ -156,7 +156,7 @@ export interface WorkspaceContextService {
156
156
  * In case of an error, returns a rejected promise with a displayable error string.
157
157
  */
158
158
  export interface SchemaRequestService {
159
- (uri: string): Thenable<string>;
159
+ (uri: string): PromiseLike<string>;
160
160
  }
161
161
  export interface PromiseConstructor {
162
162
  /**
@@ -165,36 +165,33 @@ export interface PromiseConstructor {
165
165
  * a resolve callback used resolve the promise with a value or the result of another promise,
166
166
  * and a reject callback used to reject the promise with a provided reason or error.
167
167
  */
168
- new <T>(executor: (resolve: (value?: T | Thenable<T | undefined>) => void, reject: (reason?: any) => void) => void): Thenable<T | undefined>;
168
+ new <T>(executor: (resolve: (value?: T | PromiseLike<T | undefined>) => void, reject: (reason?: any) => void) => void): PromiseLike<T | undefined>;
169
169
  /**
170
170
  * Creates a Promise that is resolved with an array of results when all of the provided Promises
171
171
  * resolve, or rejected when any Promise is rejected.
172
172
  * @param values An array of Promises.
173
173
  * @returns A new Promise.
174
174
  */
175
- all<T>(values: Array<T | Thenable<T>>): Thenable<T[]>;
175
+ all<T>(values: Array<T | PromiseLike<T>>): PromiseLike<T[]>;
176
176
  /**
177
177
  * Creates a new rejected promise for the provided reason.
178
178
  * @param reason The reason the promise was rejected.
179
179
  * @returns A new rejected Promise.
180
180
  */
181
- reject<T>(reason: any): Thenable<T>;
181
+ reject<T>(reason: any): PromiseLike<T>;
182
182
  /**
183
183
  * Creates a new resolved promise for the provided value.
184
184
  * @param value A promise.
185
185
  * @returns A promise whose internal state matches the provided promise.
186
186
  */
187
- resolve<T>(value: T | Thenable<T>): Thenable<T>;
187
+ resolve<T>(value: T | PromiseLike<T>): PromiseLike<T>;
188
188
  }
189
- export interface Thenable<R> {
190
- /**
191
- * Attaches callbacks for the resolution and/or rejection of the Promise.
192
- * @param onfulfilled The callback to execute when the Promise is resolved.
193
- * @param onrejected The callback to execute when the Promise is rejected.
194
- * @returns A Promise for the completion of which ever callback is executed.
195
- */
196
- then<TResult>(onfulfilled?: (value: R) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Thenable<TResult>;
197
- then<TResult>(onfulfilled?: (value: R) => TResult | Thenable<TResult>, onrejected?: (reason: any) => void): Thenable<TResult>;
189
+ /**
190
+ * A deprecated alias of {@link PromiseLike}
191
+ *
192
+ * @deprecated
193
+ */
194
+ export interface Thenable<R> extends PromiseLike<R> {
198
195
  }
199
196
  export interface LanguageServiceParams {
200
197
  /**
@@ -83,6 +83,7 @@ export interface JSONSchema {
83
83
  suggestSortText?: string;
84
84
  allowComments?: boolean;
85
85
  allowTrailingCommas?: boolean;
86
+ completionDetail?: string;
86
87
  }
87
88
  export interface JSONSchemaMap {
88
89
  [name: string]: JSONSchemaRef;
@@ -13,7 +13,13 @@
13
13
  })(function (require, exports) {
14
14
  "use strict";
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.parse = exports.JSONDocument = exports.contains = exports.getNodePath = exports.getNodeValue = exports.newJSONDocument = exports.ValidationResult = exports.EnumMatch = exports.asSchema = exports.ObjectASTNodeImpl = exports.PropertyASTNodeImpl = exports.StringASTNodeImpl = exports.NumberASTNodeImpl = exports.ArrayASTNodeImpl = exports.BooleanASTNodeImpl = exports.NullASTNodeImpl = exports.ASTNodeImpl = void 0;
16
+ exports.JSONDocument = exports.ValidationResult = exports.EnumMatch = exports.ObjectASTNodeImpl = exports.PropertyASTNodeImpl = exports.StringASTNodeImpl = exports.NumberASTNodeImpl = exports.ArrayASTNodeImpl = exports.BooleanASTNodeImpl = exports.NullASTNodeImpl = exports.ASTNodeImpl = void 0;
17
+ exports.asSchema = asSchema;
18
+ exports.newJSONDocument = newJSONDocument;
19
+ exports.getNodeValue = getNodeValue;
20
+ exports.getNodePath = getNodePath;
21
+ exports.contains = contains;
22
+ exports.parse = parse;
17
23
  const Json = require("jsonc-parser");
18
24
  const objects_1 = require("../utils/objects");
19
25
  const strings_1 = require("../utils/strings");
@@ -116,7 +122,6 @@
116
122
  }
117
123
  return schema;
118
124
  }
119
- exports.asSchema = asSchema;
120
125
  var EnumMatch;
121
126
  (function (EnumMatch) {
122
127
  EnumMatch[EnumMatch["Key"] = 0] = "Key";
@@ -185,6 +190,10 @@
185
190
  mergeEnumValues(validationResult) {
186
191
  if (!this.enumValueMatch && !validationResult.enumValueMatch && this.enumValues && validationResult.enumValues) {
187
192
  this.enumValues = this.enumValues.concat(validationResult.enumValues);
193
+ }
194
+ }
195
+ updateEnumMismatchProblemMessages() {
196
+ if (!this.enumValueMatch && this.enumValues) {
188
197
  for (const error of this.problems) {
189
198
  if (error.code === jsonLanguageTypes_1.ErrorCode.EnumValueMismatch) {
190
199
  error.message = l10n.t('Value is not accepted. Valid values: {0}.', this.enumValues.map(v => JSON.stringify(v)).join(', '));
@@ -226,19 +235,15 @@
226
235
  function newJSONDocument(root, diagnostics = []) {
227
236
  return new JSONDocument(root, diagnostics, []);
228
237
  }
229
- exports.newJSONDocument = newJSONDocument;
230
238
  function getNodeValue(node) {
231
239
  return Json.getNodeValue(node);
232
240
  }
233
- exports.getNodeValue = getNodeValue;
234
241
  function getNodePath(node) {
235
242
  return Json.getNodePath(node);
236
243
  }
237
- exports.getNodePath = getNodePath;
238
244
  function contains(node, offset, includeRightBound = false) {
239
245
  return offset >= node.offset && offset < (node.offset + node.length) || includeRightBound && offset === (node.offset + node.length);
240
246
  }
241
- exports.contains = contains;
242
247
  class JSONDocument {
243
248
  constructor(root, syntaxErrors = [], comments = []) {
244
249
  this.root = root;
@@ -409,6 +414,7 @@
409
414
  });
410
415
  }
411
416
  if (bestMatch) {
417
+ bestMatch.validationResult.updateEnumMismatchProblemMessages();
412
418
  validationResult.merge(bestMatch.validationResult);
413
419
  matchingSchemas.merge(bestMatch.matchingSchemas);
414
420
  }
@@ -1269,5 +1275,4 @@
1269
1275
  }
1270
1276
  return new JSONDocument(_root, problems, commentRanges);
1271
1277
  }
1272
- exports.parse = parse;
1273
1278
  });
@@ -472,8 +472,8 @@
472
472
  const descriptions = {
473
473
  id: l10n.t("A unique identifier for the schema."),
474
474
  $schema: l10n.t("The schema to verify this document against."),
475
- title: l10n.t("A descriptive title of the element."),
476
- description: l10n.t("A long description of the element. Used in hover menus and suggestions."),
475
+ title: l10n.t("A descriptive title of the schema."),
476
+ description: l10n.t("A long description of the schema. Used in hover menus and suggestions."),
477
477
  default: l10n.t("A default value. Used by suggestions."),
478
478
  multipleOf: l10n.t("A number that should cleanly divide the current value (i.e. have no remainder)."),
479
479
  maximum: l10n.t("The maximum numerical value, inclusive by default."),
@@ -483,7 +483,7 @@
483
483
  maxLength: l10n.t("The maximum length of a string."),
484
484
  minLength: l10n.t("The minimum length of a string."),
485
485
  pattern: l10n.t("A regular expression to match the string against. It is not implicitly anchored."),
486
- additionalItems: l10n.t("For arrays, only when items is set as an array. If it is a schema, then this schema validates items after the ones specified by the items array. If it is false, then additional items will cause validation to fail."),
486
+ additionalItems: l10n.t("For arrays, only when items is set as an array. If items are a schema, this schema validates items after the ones specified by the items schema. If false, additional items will cause validation to fail."),
487
487
  items: l10n.t("For arrays. Can either be a schema to validate every element against or an array of schemas to validate each item against in order (the first schema will validate the first element, the second schema will validate the second element, and so on."),
488
488
  maxItems: l10n.t("The maximum number of items that can be inside an array. Inclusive."),
489
489
  minItems: l10n.t("The minimum number of items that can be inside an array. Inclusive."),
@@ -491,14 +491,14 @@
491
491
  maxProperties: l10n.t("The maximum number of properties an object can have. Inclusive."),
492
492
  minProperties: l10n.t("The minimum number of properties an object can have. Inclusive."),
493
493
  required: l10n.t("An array of strings that lists the names of all properties required on this object."),
494
- additionalProperties: l10n.t("Either a schema or a boolean. If a schema, then used to validate all properties not matched by 'properties' or 'patternProperties'. If false, then any properties not matched by either will cause this schema to fail."),
494
+ additionalProperties: l10n.t("Either a schema or a boolean. If a schema, used to validate all properties not matched by 'properties', 'propertyNames', or 'patternProperties'. If false, any properties not defined by the adajacent keywords will cause this schema to fail."),
495
495
  definitions: l10n.t("Not used for validation. Place subschemas here that you wish to reference inline with $ref."),
496
496
  properties: l10n.t("A map of property names to schemas for each property."),
497
497
  patternProperties: l10n.t("A map of regular expressions on property names to schemas for matching properties."),
498
498
  dependencies: l10n.t("A map of property names to either an array of property names or a schema. An array of property names means the property named in the key depends on the properties in the array being present in the object in order to be valid. If the value is a schema, then the schema is only applied to the object if the property in the key exists on the object."),
499
499
  enum: l10n.t("The set of literal values that are valid."),
500
500
  type: l10n.t("Either a string of one of the basic schema types (number, integer, null, array, object, boolean, string) or an array of strings specifying a subset of those types."),
501
- format: l10n.t("Describes the format expected for the value."),
501
+ format: l10n.t("Describes the format expected for the value. By default, not used for validation"),
502
502
  allOf: l10n.t("An array of schemas, all of which must match."),
503
503
  anyOf: l10n.t("An array of schemas, where at least one must match."),
504
504
  oneOf: l10n.t("An array of schemas, exactly one of which must match."),
@@ -514,7 +514,7 @@
514
514
  contentMediaType: l10n.t("Describes the media type of a string property."),
515
515
  contentEncoding: l10n.t("Describes the content encoding of a string property."),
516
516
  if: l10n.t("The validation outcome of the \"if\" subschema controls which of the \"then\" or \"else\" keywords are evaluated."),
517
- then: l10n.t("The \"if\" subschema is used for validation when the \"if\" subschema succeeds."),
517
+ then: l10n.t("The \"then\" subschema is used for validation when the \"if\" subschema succeeds."),
518
518
  else: l10n.t("The \"else\" subschema is used for validation when the \"if\" subschema fails.")
519
519
  };
520
520
  for (const schemaName in exports.schemaContributions.schemas) {
@@ -217,8 +217,11 @@
217
217
  insertText: this.getInsertTextForProperty(key, propertySchema, addValue, separatorAfter),
218
218
  insertTextFormat: jsonLanguageTypes_1.InsertTextFormat.Snippet,
219
219
  filterText: this.getFilterTextForValue(key),
220
- documentation: this.fromMarkup(propertySchema.markdownDescription) || propertySchema.description || '',
220
+ documentation: this.fromMarkup(propertySchema.markdownDescription) || propertySchema.description || ''
221
221
  };
222
+ if (propertySchema.completionDetail !== undefined) {
223
+ proposal.detail = propertySchema.completionDetail;
224
+ }
222
225
  if (propertySchema.suggestSortText !== undefined) {
223
226
  proposal.sortText = propertySchema.suggestSortText;
224
227
  }
@@ -241,8 +244,11 @@
241
244
  insertText: this.getInsertTextForProperty(name, undefined, addValue, separatorAfter),
242
245
  insertTextFormat: jsonLanguageTypes_1.InsertTextFormat.Snippet,
243
246
  filterText: this.getFilterTextForValue(name),
244
- documentation: enumDescription || this.fromMarkup(schemaPropertyNames.markdownDescription) || schemaPropertyNames.description || '',
247
+ documentation: enumDescription || this.fromMarkup(schemaPropertyNames.markdownDescription) || schemaPropertyNames.description || ''
245
248
  };
249
+ if (schemaPropertyNames.completionDetail !== undefined) {
250
+ proposal.detail = schemaPropertyNames.completionDetail;
251
+ }
246
252
  if (schemaPropertyNames.suggestSortText !== undefined) {
247
253
  proposal.sortText = schemaPropertyNames.suggestSortText;
248
254
  }
@@ -13,7 +13,7 @@
13
13
  })(function (require, exports) {
14
14
  "use strict";
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.getFoldingRanges = void 0;
16
+ exports.getFoldingRanges = getFoldingRanges;
17
17
  const jsonc_parser_1 = require("jsonc-parser");
18
18
  const jsonLanguageTypes_1 = require("../jsonLanguageTypes");
19
19
  function getFoldingRanges(document, context) {
@@ -130,5 +130,4 @@
130
130
  }
131
131
  return result;
132
132
  }
133
- exports.getFoldingRanges = getFoldingRanges;
134
133
  });
@@ -13,7 +13,7 @@
13
13
  })(function (require, exports) {
14
14
  "use strict";
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.findLinks = void 0;
16
+ exports.findLinks = findLinks;
17
17
  const jsonLanguageTypes_1 = require("../jsonLanguageTypes");
18
18
  function findLinks(document, doc) {
19
19
  const links = [];
@@ -33,7 +33,6 @@
33
33
  });
34
34
  return Promise.resolve(links);
35
35
  }
36
- exports.findLinks = findLinks;
37
36
  function createRange(document, node) {
38
37
  return jsonLanguageTypes_1.Range.create(document.positionAt(node.offset + 1), document.positionAt(node.offset + node.length - 1));
39
38
  }
@@ -366,7 +366,7 @@
366
366
  }
367
367
  };
368
368
  const resolveExternalLink = (node, uri, refSegment, parentHandle) => {
369
- if (contextService && !/^[A-Za-z][A-Za-z0-9+\-.+]*:\/\/.*/.test(uri)) {
369
+ if (contextService && !/^[A-Za-z][A-Za-z0-9+\-.+]*:\/.*/.test(uri)) {
370
370
  uri = contextService.resolveRelativePath(uri, parentHandle.uri);
371
371
  }
372
372
  uri = normalizeId(uri);
@@ -13,7 +13,7 @@
13
13
  })(function (require, exports) {
14
14
  "use strict";
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.getSelectionRanges = void 0;
16
+ exports.getSelectionRanges = getSelectionRanges;
17
17
  const jsonLanguageTypes_1 = require("../jsonLanguageTypes");
18
18
  const jsonc_parser_1 = require("jsonc-parser");
19
19
  function getSelectionRanges(document, positions, doc) {
@@ -71,5 +71,4 @@
71
71
  }
72
72
  return positions.map(getSelectionRange);
73
73
  }
74
- exports.getSelectionRanges = getSelectionRanges;
75
74
  });
@@ -13,7 +13,9 @@
13
13
  })(function (require, exports) {
14
14
  "use strict";
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.colorFrom256RGB = exports.colorFromHex = exports.hexDigit = void 0;
16
+ exports.hexDigit = hexDigit;
17
+ exports.colorFromHex = colorFromHex;
18
+ exports.colorFrom256RGB = colorFrom256RGB;
17
19
  const Digit0 = 48;
18
20
  const Digit9 = 57;
19
21
  const A = 65;
@@ -34,7 +36,6 @@
34
36
  }
35
37
  return 0;
36
38
  }
37
- exports.hexDigit = hexDigit;
38
39
  function colorFromHex(text) {
39
40
  if (text[0] !== '#') {
40
41
  return undefined;
@@ -71,7 +72,6 @@
71
72
  }
72
73
  return undefined;
73
74
  }
74
- exports.colorFromHex = colorFromHex;
75
75
  function colorFrom256RGB(red, green, blue, alpha = 1.0) {
76
76
  return {
77
77
  red: red / 255.0,
@@ -80,5 +80,4 @@
80
80
  alpha
81
81
  };
82
82
  }
83
- exports.colorFrom256RGB = colorFrom256RGB;
84
83
  });
@@ -9,7 +9,7 @@
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.format = void 0;
12
+ exports.format = format;
13
13
  const jsonc_parser_1 = require("jsonc-parser");
14
14
  const jsonLanguageTypes_1 = require("../jsonLanguageTypes");
15
15
  function format(documentToFormat, formattingOptions, formattingRange) {
@@ -30,5 +30,4 @@
30
30
  return jsonLanguageTypes_1.TextEdit.replace(jsonLanguageTypes_1.Range.create(documentToFormat.positionAt(edit.offset), documentToFormat.positionAt(edit.offset + edit.length)), edit.content);
31
31
  });
32
32
  }
33
- exports.format = format;
34
33
  });
@@ -9,7 +9,7 @@
9
9
  })(function (require, exports) {
10
10
  "use strict";
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.createRegex = void 0;
12
+ exports.createRegex = createRegex;
13
13
  /*---------------------------------------------------------------------------------------------
14
14
  * Copyright (c) Microsoft Corporation. All rights reserved.
15
15
  * Copyright (c) 2013, Nick Fitzgerald
@@ -133,6 +133,5 @@
133
133
  }
134
134
  return new RegExp(reStr, flags);
135
135
  }
136
- exports.createRegex = createRegex;
137
136
  ;
138
137
  });
@@ -13,7 +13,7 @@
13
13
  })(function (require, exports) {
14
14
  "use strict";
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.stringifyObject = void 0;
16
+ exports.stringifyObject = stringifyObject;
17
17
  function stringifyObject(obj, indent, stringifyLiteral) {
18
18
  if (obj !== null && typeof obj === 'object') {
19
19
  const newIndent = indent + '\t';
@@ -52,5 +52,4 @@
52
52
  }
53
53
  return stringifyLiteral(obj);
54
54
  }
55
- exports.stringifyObject = stringifyObject;
56
55
  });
@@ -13,7 +13,12 @@
13
13
  })(function (require, exports) {
14
14
  "use strict";
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.isObject = exports.isString = exports.isBoolean = exports.isDefined = exports.isNumber = exports.equals = void 0;
16
+ exports.equals = equals;
17
+ exports.isNumber = isNumber;
18
+ exports.isDefined = isDefined;
19
+ exports.isBoolean = isBoolean;
20
+ exports.isString = isString;
21
+ exports.isObject = isObject;
17
22
  function equals(one, other) {
18
23
  if (one === other) {
19
24
  return true;
@@ -63,25 +68,19 @@
63
68
  }
64
69
  return true;
65
70
  }
66
- exports.equals = equals;
67
71
  function isNumber(val) {
68
72
  return typeof val === 'number';
69
73
  }
70
- exports.isNumber = isNumber;
71
74
  function isDefined(val) {
72
75
  return typeof val !== 'undefined';
73
76
  }
74
- exports.isDefined = isDefined;
75
77
  function isBoolean(val) {
76
78
  return typeof val === 'boolean';
77
79
  }
78
- exports.isBoolean = isBoolean;
79
80
  function isString(val) {
80
81
  return typeof val === 'string';
81
82
  }
82
- exports.isString = isString;
83
83
  function isObject(val) {
84
84
  return typeof val === 'object' && val !== null && !Array.isArray(val);
85
85
  }
86
- exports.isObject = isObject;
87
86
  });
@@ -13,8 +13,7 @@
13
13
  })(function (require, exports) {
14
14
  "use strict";
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.sort = void 0;
17
- // import { TextEdit} from 'vscode-languageserver-textdocument';
16
+ exports.sort = sort;
18
17
  const jsonc_parser_1 = require("jsonc-parser");
19
18
  const jsonLanguageTypes_1 = require("../jsonLanguageTypes");
20
19
  const format_1 = require("./format");
@@ -32,7 +31,6 @@
32
31
  const sortedAndFormattedJsonDocument = jsonLanguageTypes_1.TextDocument.applyEdits(sortedJsonDocument, edits);
33
32
  return [jsonLanguageTypes_1.TextEdit.replace(jsonLanguageTypes_1.Range.create(jsonLanguageTypes_1.Position.create(0, 0), documentToSort.positionAt(documentToSort.getText().length)), sortedAndFormattedJsonDocument)];
34
33
  }
35
- exports.sort = sort;
36
34
  function findJsoncPropertyTree(formattedDocument) {
37
35
  const formattedString = formattedDocument.getText();
38
36
  const scanner = (0, jsonc_parser_1.createScanner)(formattedString, false);
@@ -335,6 +333,13 @@
335
333
  }
336
334
  return sortedJsonDocument;
337
335
  }
336
+ function sortPropertiesCaseSensitive(properties) {
337
+ properties.sort((a, b) => {
338
+ const aName = a.propertyName ?? '';
339
+ const bName = b.propertyName ?? '';
340
+ return aName < bName ? -1 : aName > bName ? 1 : 0;
341
+ });
342
+ }
338
343
  function updateSortingQueue(queue, propertyTree, beginningLineNumber) {
339
344
  if (propertyTree.childrenProperties.length === 0) {
340
345
  return;
@@ -348,6 +353,7 @@
348
353
  }
349
354
  const diff = minimumBeginningLineNumber - propertyTree.beginningLineNumber;
350
355
  beginningLineNumber = beginningLineNumber + diff;
356
+ sortPropertiesCaseSensitive(propertyTree.childrenProperties);
351
357
  queue.push(new SortingRange(beginningLineNumber, propertyTree.childrenProperties));
352
358
  }
353
359
  else if (propertyTree.type === propertyTree_1.Container.Array) {
@@ -13,7 +13,12 @@
13
13
  })(function (require, exports) {
14
14
  "use strict";
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.stringLength = exports.extendedRegExp = exports.repeat = exports.convertSimple2RegExpPattern = exports.endsWith = exports.startsWith = void 0;
16
+ exports.startsWith = startsWith;
17
+ exports.endsWith = endsWith;
18
+ exports.convertSimple2RegExpPattern = convertSimple2RegExpPattern;
19
+ exports.repeat = repeat;
20
+ exports.extendedRegExp = extendedRegExp;
21
+ exports.stringLength = stringLength;
17
22
  function startsWith(haystack, needle) {
18
23
  if (haystack.length < needle.length) {
19
24
  return false;
@@ -25,7 +30,6 @@
25
30
  }
26
31
  return true;
27
32
  }
28
- exports.startsWith = startsWith;
29
33
  /**
30
34
  * Determines if haystack ends with needle.
31
35
  */
@@ -41,11 +45,9 @@
41
45
  return false;
42
46
  }
43
47
  }
44
- exports.endsWith = endsWith;
45
48
  function convertSimple2RegExpPattern(pattern) {
46
49
  return pattern.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g, '\\$&').replace(/[\*]/g, '.*');
47
50
  }
48
- exports.convertSimple2RegExpPattern = convertSimple2RegExpPattern;
49
51
  function repeat(value, count) {
50
52
  let s = '';
51
53
  while (count > 0) {
@@ -57,7 +59,6 @@
57
59
  }
58
60
  return s;
59
61
  }
60
- exports.repeat = repeat;
61
62
  function extendedRegExp(pattern) {
62
63
  let flags = '';
63
64
  if (startsWith(pattern, '(?i)')) {
@@ -78,7 +79,6 @@
78
79
  }
79
80
  }
80
81
  }
81
- exports.extendedRegExp = extendedRegExp;
82
82
  // from https://tanishiking.github.io/posts/count-unicode-codepoint/#work-hard-with-for-statements
83
83
  function stringLength(str) {
84
84
  let count = 0;
@@ -94,5 +94,4 @@
94
94
  }
95
95
  return count;
96
96
  }
97
- exports.stringLength = stringLength;
98
97
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vscode-json-languageservice",
3
- "version": "5.4.0",
3
+ "version": "5.4.2",
4
4
  "description": "Language service for JSON",
5
5
  "main": "./lib/umd/jsonLanguageService.js",
6
6
  "typings": "./lib/umd/jsonLanguageService",
@@ -15,19 +15,19 @@
15
15
  "url": "https://github.com/Microsoft/vscode-json-languageservice"
16
16
  },
17
17
  "devDependencies": {
18
- "@types/mocha": "^10.0.7",
18
+ "@types/mocha": "^10.0.10",
19
19
  "@types/node": "18.x",
20
- "@typescript-eslint/eslint-plugin": "^7.7.0",
21
- "@typescript-eslint/parser": "^7.13.1",
22
- "eslint": "^8.57.0",
20
+ "@typescript-eslint/eslint-plugin": "^8.17.0",
21
+ "@typescript-eslint/parser": "^8.17.0",
22
+ "eslint": "^9.16.0",
23
23
  "json-schema-test-suite": "https://github.com/json-schema-org/JSON-Schema-Test-Suite.git#69acf52990b004240839ae19b4bec8fb01d50876",
24
- "mocha": "^10.4.0",
25
- "rimraf": "^5.0.7",
26
- "typescript": "^5.4.5"
24
+ "mocha": "^10.8.2",
25
+ "rimraf": "^6.0.1",
26
+ "typescript": "^5.7.2"
27
27
  },
28
28
  "dependencies": {
29
- "jsonc-parser": "^3.3.0",
30
- "vscode-languageserver-textdocument": "^1.0.11",
29
+ "jsonc-parser": "^3.3.1",
30
+ "vscode-languageserver-textdocument": "^1.0.12",
31
31
  "vscode-languageserver-types": "^3.17.5",
32
32
  "vscode-uri": "^3.0.8",
33
33
  "@vscode/l10n": "^0.0.18"