vscode-json-languageservice 5.1.1 → 5.1.3

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.
@@ -8,7 +8,7 @@
8
8
  if (v !== undefined) module.exports = v;
9
9
  }
10
10
  else if (typeof define === "function" && define.amd) {
11
- define(["require", "exports", "jsonc-parser", "../utils/objects", "../utils/strings", "../jsonLanguageTypes", "vscode-nls"], factory);
11
+ define(["require", "exports", "jsonc-parser", "../utils/objects", "../utils/strings", "../jsonLanguageTypes", "@vscode/l10n"], factory);
12
12
  }
13
13
  })(function (require, exports) {
14
14
  "use strict";
@@ -18,17 +18,16 @@
18
18
  const objects_1 = require("../utils/objects");
19
19
  const strings_1 = require("../utils/strings");
20
20
  const jsonLanguageTypes_1 = require("../jsonLanguageTypes");
21
- const nls = require("vscode-nls");
22
- const localize = nls.loadMessageBundle();
21
+ const l10n = require("@vscode/l10n");
23
22
  const formats = {
24
- 'color-hex': { errorMessage: localize('colorHexFormatWarning', 'Invalid color format. Use #RGB, #RGBA, #RRGGBB or #RRGGBBAA.'), pattern: /^#([0-9A-Fa-f]{3,4}|([0-9A-Fa-f]{2}){3,4})$/ },
25
- 'date-time': { errorMessage: localize('dateTimeFormatWarning', 'String is not a RFC3339 date-time.'), pattern: /^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)([01][0-9]|2[0-3]):([0-5][0-9]))$/i },
26
- 'date': { errorMessage: localize('dateFormatWarning', 'String is not a RFC3339 date.'), pattern: /^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/i },
27
- 'time': { errorMessage: localize('timeFormatWarning', 'String is not a RFC3339 time.'), pattern: /^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)([01][0-9]|2[0-3]):([0-5][0-9]))$/i },
28
- 'email': { errorMessage: localize('emailFormatWarning', 'String is not an e-mail address.'), pattern: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}))$/ },
29
- 'hostname': { errorMessage: localize('hostnameFormatWarning', 'String is not a hostname.'), pattern: /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i },
30
- 'ipv4': { errorMessage: localize('ipv4FormatWarning', 'String is not an IPv4 address.'), pattern: /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/ },
31
- 'ipv6': { errorMessage: localize('ipv6FormatWarning', 'String is not an IPv6 address.'), pattern: /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i },
23
+ 'color-hex': { errorMessage: l10n.t('Invalid color format. Use #RGB, #RGBA, #RRGGBB or #RRGGBBAA.'), pattern: /^#([0-9A-Fa-f]{3,4}|([0-9A-Fa-f]{2}){3,4})$/ },
24
+ 'date-time': { errorMessage: l10n.t('String is not a RFC3339 date-time.'), pattern: /^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)([01][0-9]|2[0-3]):([0-5][0-9]))$/i },
25
+ 'date': { errorMessage: l10n.t('String is not a RFC3339 date.'), pattern: /^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/i },
26
+ 'time': { errorMessage: l10n.t('String is not a RFC3339 time.'), pattern: /^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)([01][0-9]|2[0-3]):([0-5][0-9]))$/i },
27
+ 'email': { errorMessage: l10n.t('String is not an e-mail address.'), pattern: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}))$/ },
28
+ 'hostname': { errorMessage: l10n.t('String is not a hostname.'), pattern: /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i },
29
+ 'ipv4': { errorMessage: l10n.t('String is not an IPv4 address.'), pattern: /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/ },
30
+ 'ipv6': { errorMessage: l10n.t('String is not an IPv6 address.'), pattern: /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i },
32
31
  };
33
32
  class ASTNodeImpl {
34
33
  constructor(parent, offset, length = 0) {
@@ -188,7 +187,7 @@
188
187
  this.enumValues = this.enumValues.concat(validationResult.enumValues);
189
188
  for (const error of this.problems) {
190
189
  if (error.code === jsonLanguageTypes_1.ErrorCode.EnumValueMismatch) {
191
- error.message = localize('enumWarning', 'Value is not accepted. Valid values: {0}.', this.enumValues.map(v => JSON.stringify(v)).join(', '));
190
+ error.message = l10n.t('Value is not accepted. Valid values: {0}.', this.enumValues.map(v => JSON.stringify(v)).join(', '));
192
191
  }
193
192
  }
194
193
  }
@@ -329,7 +328,7 @@
329
328
  if (!schema.type.some(matchesType)) {
330
329
  validationResult.problems.push({
331
330
  location: { offset: node.offset, length: node.length },
332
- message: schema.errorMessage || localize('typeArrayMismatchWarning', 'Incorrect type. Expected one of {0}.', schema.type.join(', '))
331
+ message: schema.errorMessage || l10n.t('Incorrect type. Expected one of {0}.', schema.type.join(', '))
333
332
  });
334
333
  }
335
334
  }
@@ -337,7 +336,7 @@
337
336
  if (!matchesType(schema.type)) {
338
337
  validationResult.problems.push({
339
338
  location: { offset: node.offset, length: node.length },
340
- message: schema.errorMessage || localize('typeMismatchWarning', 'Incorrect type. Expected "{0}".', schema.type)
339
+ message: schema.errorMessage || l10n.t('Incorrect type. Expected "{0}".', schema.type)
341
340
  });
342
341
  }
343
342
  }
@@ -358,7 +357,7 @@
358
357
  if (!subValidationResult.hasProblems()) {
359
358
  validationResult.problems.push({
360
359
  location: { offset: node.offset, length: node.length },
361
- message: localize('notSchemaWarning', "Matches a schema that is not allowed.")
360
+ message: l10n.t("Matches a schema that is not allowed.")
362
361
  });
363
362
  }
364
363
  for (const ms of subMatchingSchemas.schemas) {
@@ -406,7 +405,7 @@
406
405
  if (matches.length > 1 && maxOneMatch) {
407
406
  validationResult.problems.push({
408
407
  location: { offset: node.offset, length: 1 },
409
- message: localize('oneOfWarning', "Matches multiple schemas when only one must validate.")
408
+ message: l10n.t("Matches multiple schemas when only one must validate.")
410
409
  });
411
410
  }
412
411
  if (bestMatch) {
@@ -463,7 +462,7 @@
463
462
  validationResult.problems.push({
464
463
  location: { offset: node.offset, length: node.length },
465
464
  code: jsonLanguageTypes_1.ErrorCode.EnumValueMismatch,
466
- message: schema.errorMessage || localize('enumWarning', 'Value is not accepted. Valid values: {0}.', schema.enum.map(v => JSON.stringify(v)).join(', '))
465
+ message: schema.errorMessage || l10n.t('Value is not accepted. Valid values: {0}.', schema.enum.map(v => JSON.stringify(v)).join(', '))
467
466
  });
468
467
  }
469
468
  }
@@ -473,7 +472,7 @@
473
472
  validationResult.problems.push({
474
473
  location: { offset: node.offset, length: node.length },
475
474
  code: jsonLanguageTypes_1.ErrorCode.EnumValueMismatch,
476
- message: schema.errorMessage || localize('constWarning', 'Value must be {0}.', JSON.stringify(schema.const))
475
+ message: schema.errorMessage || l10n.t('Value must be {0}.', JSON.stringify(schema.const))
477
476
  });
478
477
  validationResult.enumValueMatch = false;
479
478
  }
@@ -484,7 +483,7 @@
484
483
  }
485
484
  let deprecationMessage = schema.deprecationMessage;
486
485
  if ((deprecationMessage || schema.deprecated) && node.parent) {
487
- deprecationMessage = deprecationMessage || localize('deprecated', 'Value is deprecated');
486
+ deprecationMessage = deprecationMessage || l10n.t('Value is deprecated');
488
487
  validationResult.problems.push({
489
488
  location: { offset: node.parent.offset, length: node.parent.length },
490
489
  severity: jsonLanguageTypes_1.DiagnosticSeverity.Warning,
@@ -525,7 +524,7 @@
525
524
  if (remainder !== 0) {
526
525
  validationResult.problems.push({
527
526
  location: { offset: node.offset, length: node.length },
528
- message: localize('multipleOfWarning', 'Value is not divisible by {0}.', schema.multipleOf)
527
+ message: l10n.t('Value is not divisible by {0}.', schema.multipleOf)
529
528
  });
530
529
  }
531
530
  }
@@ -548,28 +547,28 @@
548
547
  if ((0, objects_1.isNumber)(exclusiveMinimum) && val <= exclusiveMinimum) {
549
548
  validationResult.problems.push({
550
549
  location: { offset: node.offset, length: node.length },
551
- message: localize('exclusiveMinimumWarning', 'Value is below the exclusive minimum of {0}.', exclusiveMinimum)
550
+ message: l10n.t('Value is below the exclusive minimum of {0}.', exclusiveMinimum)
552
551
  });
553
552
  }
554
553
  const exclusiveMaximum = getExclusiveLimit(schema.maximum, schema.exclusiveMaximum);
555
554
  if ((0, objects_1.isNumber)(exclusiveMaximum) && val >= exclusiveMaximum) {
556
555
  validationResult.problems.push({
557
556
  location: { offset: node.offset, length: node.length },
558
- message: localize('exclusiveMaximumWarning', 'Value is above the exclusive maximum of {0}.', exclusiveMaximum)
557
+ message: l10n.t('Value is above the exclusive maximum of {0}.', exclusiveMaximum)
559
558
  });
560
559
  }
561
560
  const minimum = getLimit(schema.minimum, schema.exclusiveMinimum);
562
561
  if ((0, objects_1.isNumber)(minimum) && val < minimum) {
563
562
  validationResult.problems.push({
564
563
  location: { offset: node.offset, length: node.length },
565
- message: localize('minimumWarning', 'Value is below the minimum of {0}.', minimum)
564
+ message: l10n.t('Value is below the minimum of {0}.', minimum)
566
565
  });
567
566
  }
568
567
  const maximum = getLimit(schema.maximum, schema.exclusiveMaximum);
569
568
  if ((0, objects_1.isNumber)(maximum) && val > maximum) {
570
569
  validationResult.problems.push({
571
570
  location: { offset: node.offset, length: node.length },
572
- message: localize('maximumWarning', 'Value is above the maximum of {0}.', maximum)
571
+ message: l10n.t('Value is above the maximum of {0}.', maximum)
573
572
  });
574
573
  }
575
574
  }
@@ -577,13 +576,13 @@
577
576
  if ((0, objects_1.isNumber)(schema.minLength) && (0, strings_1.stringLength)(node.value) < schema.minLength) {
578
577
  validationResult.problems.push({
579
578
  location: { offset: node.offset, length: node.length },
580
- message: localize('minLengthWarning', 'String is shorter than the minimum length of {0}.', schema.minLength)
579
+ message: l10n.t('String is shorter than the minimum length of {0}.', schema.minLength)
581
580
  });
582
581
  }
583
582
  if ((0, objects_1.isNumber)(schema.maxLength) && (0, strings_1.stringLength)(node.value) > schema.maxLength) {
584
583
  validationResult.problems.push({
585
584
  location: { offset: node.offset, length: node.length },
586
- message: localize('maxLengthWarning', 'String is longer than the maximum length of {0}.', schema.maxLength)
585
+ message: l10n.t('String is longer than the maximum length of {0}.', schema.maxLength)
587
586
  });
588
587
  }
589
588
  if ((0, objects_1.isString)(schema.pattern)) {
@@ -591,7 +590,7 @@
591
590
  if (!(regex?.test(node.value))) {
592
591
  validationResult.problems.push({
593
592
  location: { offset: node.offset, length: node.length },
594
- message: schema.patternErrorMessage || schema.errorMessage || localize('patternWarning', 'String does not match the pattern of "{0}".', schema.pattern)
593
+ message: schema.patternErrorMessage || schema.errorMessage || l10n.t('String does not match the pattern of "{0}".', schema.pattern)
595
594
  });
596
595
  }
597
596
  }
@@ -602,21 +601,21 @@
602
601
  {
603
602
  let errorMessage;
604
603
  if (!node.value) {
605
- errorMessage = localize('uriEmpty', 'URI expected.');
604
+ errorMessage = l10n.t('URI expected.');
606
605
  }
607
606
  else {
608
607
  const match = /^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/.exec(node.value);
609
608
  if (!match) {
610
- errorMessage = localize('uriMissing', 'URI is expected.');
609
+ errorMessage = l10n.t('URI is expected.');
611
610
  }
612
611
  else if (!match[2] && schema.format === 'uri') {
613
- errorMessage = localize('uriSchemeMissing', 'URI with a scheme is expected.');
612
+ errorMessage = l10n.t('URI with a scheme is expected.');
614
613
  }
615
614
  }
616
615
  if (errorMessage) {
617
616
  validationResult.problems.push({
618
617
  location: { offset: node.offset, length: node.length },
619
- message: schema.patternErrorMessage || schema.errorMessage || localize('uriFormatWarning', 'String is not a URI: {0}', errorMessage)
618
+ message: schema.patternErrorMessage || schema.errorMessage || l10n.t('String is not a URI: {0}', errorMessage)
620
619
  });
621
620
  }
622
621
  }
@@ -671,7 +670,7 @@
671
670
  if (additionalItemSchema === false) {
672
671
  validationResult.problems.push({
673
672
  location: { offset: node.offset, length: node.length },
674
- message: localize('additionalItemsWarning', 'Array has too many items according to schema. Expected {0} or fewer.', index)
673
+ message: l10n.t('Array has too many items according to schema. Expected {0} or fewer.', index)
675
674
  });
676
675
  }
677
676
  for (; index < node.items.length; index++) {
@@ -705,19 +704,19 @@
705
704
  if (containsCount === 0 && !(0, objects_1.isNumber)(schema.minContains)) {
706
705
  validationResult.problems.push({
707
706
  location: { offset: node.offset, length: node.length },
708
- message: schema.errorMessage || localize('requiredItemMissingWarning', 'Array does not contain required item.')
707
+ message: schema.errorMessage || l10n.t('Array does not contain required item.')
709
708
  });
710
709
  }
711
710
  if ((0, objects_1.isNumber)(schema.minContains) && containsCount < schema.minContains) {
712
711
  validationResult.problems.push({
713
712
  location: { offset: node.offset, length: node.length },
714
- message: localize('minContainsWarning', 'Array has too few items that match the contains contraint. Expected {0} or more.', schema.minContains)
713
+ message: l10n.t('Array has too few items that match the contains contraint. Expected {0} or more.', schema.minContains)
715
714
  });
716
715
  }
717
716
  if ((0, objects_1.isNumber)(schema.maxContains) && containsCount > schema.maxContains) {
718
717
  validationResult.problems.push({
719
718
  location: { offset: node.offset, length: node.length },
720
- message: localize('maxContainsWarning', 'Array has too many items that match the contains contraint. Expected {0} or less.', schema.maxContains)
719
+ message: l10n.t('Array has too many items that match the contains contraint. Expected {0} or less.', schema.maxContains)
721
720
  });
722
721
  }
723
722
  }
@@ -728,7 +727,7 @@
728
727
  if (unevaluatedItems === false) {
729
728
  validationResult.problems.push({
730
729
  location: { offset: node.offset, length: node.length },
731
- message: localize('unevaluatedItemsWarning', 'Item does not match any validation rule from the array.')
730
+ message: l10n.t('Item does not match any validation rule from the array.')
732
731
  });
733
732
  }
734
733
  else {
@@ -744,13 +743,13 @@
744
743
  if ((0, objects_1.isNumber)(schema.minItems) && node.items.length < schema.minItems) {
745
744
  validationResult.problems.push({
746
745
  location: { offset: node.offset, length: node.length },
747
- message: localize('minItemsWarning', 'Array has too few items. Expected {0} or more.', schema.minItems)
746
+ message: l10n.t('Array has too few items. Expected {0} or more.', schema.minItems)
748
747
  });
749
748
  }
750
749
  if ((0, objects_1.isNumber)(schema.maxItems) && node.items.length > schema.maxItems) {
751
750
  validationResult.problems.push({
752
751
  location: { offset: node.offset, length: node.length },
753
- message: localize('maxItemsWarning', 'Array has too many items. Expected {0} or fewer.', schema.maxItems)
752
+ message: l10n.t('Array has too many items. Expected {0} or fewer.', schema.maxItems)
754
753
  });
755
754
  }
756
755
  if (schema.uniqueItems === true) {
@@ -761,7 +760,7 @@
761
760
  if (duplicates) {
762
761
  validationResult.problems.push({
763
762
  location: { offset: node.offset, length: node.length },
764
- message: localize('uniqueItemsWarning', 'Array has duplicate items.')
763
+ message: l10n.t('Array has duplicate items.')
765
764
  });
766
765
  }
767
766
  }
@@ -781,7 +780,7 @@
781
780
  const location = keyNode ? { offset: keyNode.offset, length: keyNode.length } : { offset: node.offset, length: 1 };
782
781
  validationResult.problems.push({
783
782
  location: location,
784
- message: localize('MissingRequiredPropWarning', 'Missing property "{0}".', propertyName)
783
+ message: l10n.t('Missing property "{0}".', propertyName)
785
784
  });
786
785
  }
787
786
  }
@@ -801,7 +800,7 @@
801
800
  const propertyNode = child.parent;
802
801
  validationResult.problems.push({
803
802
  location: { offset: propertyNode.keyNode.offset, length: propertyNode.keyNode.length },
804
- message: schema.errorMessage || localize('DisallowedExtraPropWarning', 'Property {0} is not allowed.', propertyName)
803
+ message: schema.errorMessage || l10n.t('Property {0} is not allowed.', propertyName)
805
804
  });
806
805
  }
807
806
  else {
@@ -833,7 +832,7 @@
833
832
  const propertyNode = child.parent;
834
833
  validationResult.problems.push({
835
834
  location: { offset: propertyNode.keyNode.offset, length: propertyNode.keyNode.length },
836
- message: schema.errorMessage || localize('DisallowedExtraPropWarning', 'Property {0} is not allowed.', propertyName)
835
+ message: schema.errorMessage || l10n.t('Property {0} is not allowed.', propertyName)
837
836
  });
838
837
  }
839
838
  else {
@@ -863,7 +862,7 @@
863
862
  const propertyNode = child.parent;
864
863
  validationResult.problems.push({
865
864
  location: { offset: propertyNode.keyNode.offset, length: propertyNode.keyNode.length },
866
- message: schema.errorMessage || localize('DisallowedExtraPropWarning', 'Property {0} is not allowed.', propertyName)
865
+ message: schema.errorMessage || l10n.t('Property {0} is not allowed.', propertyName)
867
866
  });
868
867
  }
869
868
  else if (additionalProperties !== true) {
@@ -886,7 +885,7 @@
886
885
  const propertyNode = child.parent;
887
886
  validationResult.problems.push({
888
887
  location: { offset: propertyNode.keyNode.offset, length: propertyNode.keyNode.length },
889
- message: schema.errorMessage || localize('DisallowedExtraPropWarning', 'Property {0} is not allowed.', propertyName)
888
+ message: schema.errorMessage || l10n.t('Property {0} is not allowed.', propertyName)
890
889
  });
891
890
  }
892
891
  else if (unevaluatedProperties !== true) {
@@ -903,7 +902,7 @@
903
902
  if (node.properties.length > schema.maxProperties) {
904
903
  validationResult.problems.push({
905
904
  location: { offset: node.offset, length: node.length },
906
- message: localize('MaxPropWarning', 'Object has more properties than limit of {0}.', schema.maxProperties)
905
+ message: l10n.t('Object has more properties than limit of {0}.', schema.maxProperties)
907
906
  });
908
907
  }
909
908
  }
@@ -911,7 +910,7 @@
911
910
  if (node.properties.length < schema.minProperties) {
912
911
  validationResult.problems.push({
913
912
  location: { offset: node.offset, length: node.length },
914
- message: localize('MinPropWarning', 'Object has fewer properties than the required number of {0}', schema.minProperties)
913
+ message: l10n.t('Object has fewer properties than the required number of {0}', schema.minProperties)
915
914
  });
916
915
  }
917
916
  }
@@ -956,7 +955,7 @@
956
955
  if (!seenKeys[requiredProp]) {
957
956
  validationResult.problems.push({
958
957
  location: { offset: node.offset, length: node.length },
959
- message: localize('RequiredDependentPropWarning', 'Object is missing property {0} required by property {1}.', requiredProp, key)
958
+ message: l10n.t('Object is missing property {0} required by property {1}.', requiredProp, key)
960
959
  });
961
960
  }
962
961
  else {
@@ -1046,22 +1045,22 @@
1046
1045
  function _checkScanError() {
1047
1046
  switch (scanner.getTokenError()) {
1048
1047
  case 4 /* Json.ScanError.InvalidUnicode */:
1049
- _error(localize('InvalidUnicode', 'Invalid unicode sequence in string.'), jsonLanguageTypes_1.ErrorCode.InvalidUnicode);
1048
+ _error(l10n.t('Invalid unicode sequence in string.'), jsonLanguageTypes_1.ErrorCode.InvalidUnicode);
1050
1049
  return true;
1051
1050
  case 5 /* Json.ScanError.InvalidEscapeCharacter */:
1052
- _error(localize('InvalidEscapeCharacter', 'Invalid escape character in string.'), jsonLanguageTypes_1.ErrorCode.InvalidEscapeCharacter);
1051
+ _error(l10n.t('Invalid escape character in string.'), jsonLanguageTypes_1.ErrorCode.InvalidEscapeCharacter);
1053
1052
  return true;
1054
1053
  case 3 /* Json.ScanError.UnexpectedEndOfNumber */:
1055
- _error(localize('UnexpectedEndOfNumber', 'Unexpected end of number.'), jsonLanguageTypes_1.ErrorCode.UnexpectedEndOfNumber);
1054
+ _error(l10n.t('Unexpected end of number.'), jsonLanguageTypes_1.ErrorCode.UnexpectedEndOfNumber);
1056
1055
  return true;
1057
1056
  case 1 /* Json.ScanError.UnexpectedEndOfComment */:
1058
- _error(localize('UnexpectedEndOfComment', 'Unexpected end of comment.'), jsonLanguageTypes_1.ErrorCode.UnexpectedEndOfComment);
1057
+ _error(l10n.t('Unexpected end of comment.'), jsonLanguageTypes_1.ErrorCode.UnexpectedEndOfComment);
1059
1058
  return true;
1060
1059
  case 2 /* Json.ScanError.UnexpectedEndOfString */:
1061
- _error(localize('UnexpectedEndOfString', 'Unexpected end of string.'), jsonLanguageTypes_1.ErrorCode.UnexpectedEndOfString);
1060
+ _error(l10n.t('Unexpected end of string.'), jsonLanguageTypes_1.ErrorCode.UnexpectedEndOfString);
1062
1061
  return true;
1063
1062
  case 6 /* Json.ScanError.InvalidCharacter */:
1064
- _error(localize('InvalidCharacter', 'Invalid characters in string. Control characters must be escaped.'), jsonLanguageTypes_1.ErrorCode.InvalidCharacter);
1063
+ _error(l10n.t('Invalid characters in string. Control characters must be escaped.'), jsonLanguageTypes_1.ErrorCode.InvalidCharacter);
1065
1064
  return true;
1066
1065
  }
1067
1066
  return false;
@@ -1084,23 +1083,23 @@
1084
1083
  while (scanner.getToken() !== 4 /* Json.SyntaxKind.CloseBracketToken */ && scanner.getToken() !== 17 /* Json.SyntaxKind.EOF */) {
1085
1084
  if (scanner.getToken() === 5 /* Json.SyntaxKind.CommaToken */) {
1086
1085
  if (!needsComma) {
1087
- _error(localize('ValueExpected', 'Value expected'), jsonLanguageTypes_1.ErrorCode.ValueExpected);
1086
+ _error(l10n.t('Value expected'), jsonLanguageTypes_1.ErrorCode.ValueExpected);
1088
1087
  }
1089
1088
  const commaOffset = scanner.getTokenOffset();
1090
1089
  _scanNext(); // consume comma
1091
1090
  if (scanner.getToken() === 4 /* Json.SyntaxKind.CloseBracketToken */) {
1092
1091
  if (needsComma) {
1093
- _errorAtRange(localize('TrailingComma', 'Trailing comma'), jsonLanguageTypes_1.ErrorCode.TrailingComma, commaOffset, commaOffset + 1);
1092
+ _errorAtRange(l10n.t('Trailing comma'), jsonLanguageTypes_1.ErrorCode.TrailingComma, commaOffset, commaOffset + 1);
1094
1093
  }
1095
1094
  continue;
1096
1095
  }
1097
1096
  }
1098
1097
  else if (needsComma) {
1099
- _error(localize('ExpectedComma', 'Expected comma'), jsonLanguageTypes_1.ErrorCode.CommaExpected);
1098
+ _error(l10n.t('Expected comma'), jsonLanguageTypes_1.ErrorCode.CommaExpected);
1100
1099
  }
1101
1100
  const item = _parseValue(node);
1102
1101
  if (!item) {
1103
- _error(localize('PropertyExpected', 'Value expected'), jsonLanguageTypes_1.ErrorCode.ValueExpected, undefined, [], [4 /* Json.SyntaxKind.CloseBracketToken */, 5 /* Json.SyntaxKind.CommaToken */]);
1102
+ _error(l10n.t('Value expected'), jsonLanguageTypes_1.ErrorCode.ValueExpected, undefined, [], [4 /* Json.SyntaxKind.CloseBracketToken */, 5 /* Json.SyntaxKind.CommaToken */]);
1104
1103
  }
1105
1104
  else {
1106
1105
  node.items.push(item);
@@ -1108,7 +1107,7 @@
1108
1107
  needsComma = true;
1109
1108
  }
1110
1109
  if (scanner.getToken() !== 4 /* Json.SyntaxKind.CloseBracketToken */) {
1111
- return _error(localize('ExpectedCloseBracket', 'Expected comma or closing bracket'), jsonLanguageTypes_1.ErrorCode.CommaOrCloseBacketExpected, node);
1110
+ return _error(l10n.t('Expected comma or closing bracket'), jsonLanguageTypes_1.ErrorCode.CommaOrCloseBacketExpected, node);
1112
1111
  }
1113
1112
  return _finalize(node, true);
1114
1113
  }
@@ -1119,7 +1118,7 @@
1119
1118
  if (!key) {
1120
1119
  if (scanner.getToken() === 16 /* Json.SyntaxKind.Unknown */) {
1121
1120
  // give a more helpful error message
1122
- _error(localize('DoubleQuotesExpected', 'Property keys must be doublequoted'), jsonLanguageTypes_1.ErrorCode.Undefined);
1121
+ _error(l10n.t('Property keys must be doublequoted'), jsonLanguageTypes_1.ErrorCode.Undefined);
1123
1122
  const keyNode = new StringASTNodeImpl(node, scanner.getTokenOffset(), scanner.getTokenLength());
1124
1123
  keyNode.value = scanner.getTokenValue();
1125
1124
  key = keyNode;
@@ -1135,9 +1134,9 @@
1135
1134
  if (key.value !== "//") {
1136
1135
  const seen = keysSeen[key.value];
1137
1136
  if (seen) {
1138
- _errorAtRange(localize('DuplicateKeyWarning', "Duplicate object key"), jsonLanguageTypes_1.ErrorCode.DuplicateKey, node.keyNode.offset, node.keyNode.offset + node.keyNode.length, jsonLanguageTypes_1.DiagnosticSeverity.Warning);
1137
+ _errorAtRange(l10n.t("Duplicate object key"), jsonLanguageTypes_1.ErrorCode.DuplicateKey, node.keyNode.offset, node.keyNode.offset + node.keyNode.length, jsonLanguageTypes_1.DiagnosticSeverity.Warning);
1139
1138
  if ((0, objects_1.isObject)(seen)) {
1140
- _errorAtRange(localize('DuplicateKeyWarning', "Duplicate object key"), jsonLanguageTypes_1.ErrorCode.DuplicateKey, seen.keyNode.offset, seen.keyNode.offset + seen.keyNode.length, jsonLanguageTypes_1.DiagnosticSeverity.Warning);
1139
+ _errorAtRange(l10n.t("Duplicate object key"), jsonLanguageTypes_1.ErrorCode.DuplicateKey, seen.keyNode.offset, seen.keyNode.offset + seen.keyNode.length, jsonLanguageTypes_1.DiagnosticSeverity.Warning);
1141
1140
  }
1142
1141
  keysSeen[key.value] = true; // if the same key is duplicate again, avoid duplicate error reporting
1143
1142
  }
@@ -1150,7 +1149,7 @@
1150
1149
  _scanNext(); // consume ColonToken
1151
1150
  }
1152
1151
  else {
1153
- _error(localize('ColonExpected', 'Colon expected'), jsonLanguageTypes_1.ErrorCode.ColonExpected);
1152
+ _error(l10n.t('Colon expected'), jsonLanguageTypes_1.ErrorCode.ColonExpected);
1154
1153
  if (scanner.getToken() === 10 /* Json.SyntaxKind.StringLiteral */ && textDocument.positionAt(key.offset + key.length).line < textDocument.positionAt(scanner.getTokenOffset()).line) {
1155
1154
  node.length = key.length;
1156
1155
  return node;
@@ -1158,7 +1157,7 @@
1158
1157
  }
1159
1158
  const value = _parseValue(node);
1160
1159
  if (!value) {
1161
- return _error(localize('ValueExpected', 'Value expected'), jsonLanguageTypes_1.ErrorCode.ValueExpected, node, [], [2 /* Json.SyntaxKind.CloseBraceToken */, 5 /* Json.SyntaxKind.CommaToken */]);
1160
+ return _error(l10n.t('Value expected'), jsonLanguageTypes_1.ErrorCode.ValueExpected, node, [], [2 /* Json.SyntaxKind.CloseBraceToken */, 5 /* Json.SyntaxKind.CommaToken */]);
1162
1161
  }
1163
1162
  node.valueNode = value;
1164
1163
  node.length = value.offset + value.length - node.offset;
@@ -1175,23 +1174,23 @@
1175
1174
  while (scanner.getToken() !== 2 /* Json.SyntaxKind.CloseBraceToken */ && scanner.getToken() !== 17 /* Json.SyntaxKind.EOF */) {
1176
1175
  if (scanner.getToken() === 5 /* Json.SyntaxKind.CommaToken */) {
1177
1176
  if (!needsComma) {
1178
- _error(localize('PropertyExpected', 'Property expected'), jsonLanguageTypes_1.ErrorCode.PropertyExpected);
1177
+ _error(l10n.t('Property expected'), jsonLanguageTypes_1.ErrorCode.PropertyExpected);
1179
1178
  }
1180
1179
  const commaOffset = scanner.getTokenOffset();
1181
1180
  _scanNext(); // consume comma
1182
1181
  if (scanner.getToken() === 2 /* Json.SyntaxKind.CloseBraceToken */) {
1183
1182
  if (needsComma) {
1184
- _errorAtRange(localize('TrailingComma', 'Trailing comma'), jsonLanguageTypes_1.ErrorCode.TrailingComma, commaOffset, commaOffset + 1);
1183
+ _errorAtRange(l10n.t('Trailing comma'), jsonLanguageTypes_1.ErrorCode.TrailingComma, commaOffset, commaOffset + 1);
1185
1184
  }
1186
1185
  continue;
1187
1186
  }
1188
1187
  }
1189
1188
  else if (needsComma) {
1190
- _error(localize('ExpectedComma', 'Expected comma'), jsonLanguageTypes_1.ErrorCode.CommaExpected);
1189
+ _error(l10n.t('Expected comma'), jsonLanguageTypes_1.ErrorCode.CommaExpected);
1191
1190
  }
1192
1191
  const property = _parseProperty(node, keysSeen);
1193
1192
  if (!property) {
1194
- _error(localize('PropertyExpected', 'Property expected'), jsonLanguageTypes_1.ErrorCode.PropertyExpected, undefined, [], [2 /* Json.SyntaxKind.CloseBraceToken */, 5 /* Json.SyntaxKind.CommaToken */]);
1193
+ _error(l10n.t('Property expected'), jsonLanguageTypes_1.ErrorCode.PropertyExpected, undefined, [], [2 /* Json.SyntaxKind.CloseBraceToken */, 5 /* Json.SyntaxKind.CommaToken */]);
1195
1194
  }
1196
1195
  else {
1197
1196
  node.properties.push(property);
@@ -1199,7 +1198,7 @@
1199
1198
  needsComma = true;
1200
1199
  }
1201
1200
  if (scanner.getToken() !== 2 /* Json.SyntaxKind.CloseBraceToken */) {
1202
- return _error(localize('ExpectedCloseBrace', 'Expected comma or closing brace'), jsonLanguageTypes_1.ErrorCode.CommaOrCloseBraceExpected, node);
1201
+ return _error(l10n.t('Expected comma or closing brace'), jsonLanguageTypes_1.ErrorCode.CommaOrCloseBraceExpected, node);
1203
1202
  }
1204
1203
  return _finalize(node, true);
1205
1204
  }
@@ -1221,12 +1220,12 @@
1221
1220
  try {
1222
1221
  const numberValue = JSON.parse(tokenValue);
1223
1222
  if (!(0, objects_1.isNumber)(numberValue)) {
1224
- return _error(localize('InvalidNumberFormat', 'Invalid number format.'), jsonLanguageTypes_1.ErrorCode.Undefined, node);
1223
+ return _error(l10n.t('Invalid number format.'), jsonLanguageTypes_1.ErrorCode.Undefined, node);
1225
1224
  }
1226
1225
  node.value = numberValue;
1227
1226
  }
1228
1227
  catch (e) {
1229
- return _error(localize('InvalidNumberFormat', 'Invalid number format.'), jsonLanguageTypes_1.ErrorCode.Undefined, node);
1228
+ return _error(l10n.t('Invalid number format.'), jsonLanguageTypes_1.ErrorCode.Undefined, node);
1230
1229
  }
1231
1230
  node.isInteger = tokenValue.indexOf('.') === -1;
1232
1231
  }
@@ -1253,10 +1252,10 @@
1253
1252
  if (token !== 17 /* Json.SyntaxKind.EOF */) {
1254
1253
  _root = _parseValue(_root);
1255
1254
  if (!_root) {
1256
- _error(localize('Invalid symbol', 'Expected a JSON object, array or literal.'), jsonLanguageTypes_1.ErrorCode.Undefined);
1255
+ _error(l10n.t('Expected a JSON object, array or literal.'), jsonLanguageTypes_1.ErrorCode.Undefined);
1257
1256
  }
1258
1257
  else if (scanner.getToken() !== 17 /* Json.SyntaxKind.EOF */) {
1259
- _error(localize('End of file expected', 'End of file expected.'), jsonLanguageTypes_1.ErrorCode.Undefined);
1258
+ _error(l10n.t('End of file expected.'), jsonLanguageTypes_1.ErrorCode.Undefined);
1260
1259
  }
1261
1260
  }
1262
1261
  return new JSONDocument(_root, problems, commentRanges);