Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vscode-json-languageservice

Package Overview
Dependencies
Maintainers
7
Versions
161
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vscode-json-languageservice - npm Package Compare versions

Comparing version 5.1.1 to 5.1.2

1

lib/esm/jsonContributions.d.ts

@@ -14,5 +14,4 @@ import { Thenable, MarkedString, CompletionItem } from './jsonLanguageService';

error(message: string): void;
log(message: string): void;
setAsIncomplete(): void;
getNumberOfProposals(): number;
}

141

lib/esm/parser/jsonParser.js

@@ -9,13 +9,12 @@ /*---------------------------------------------------------------------------------------------

import { ErrorCode, Diagnostic, DiagnosticSeverity, Range, SchemaDraft } from '../jsonLanguageTypes';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
import * as l10n from '@vscode/l10n';
const formats = {
'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})$/ },
'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 },
'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 },
'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 },
'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,}))$/ },
'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 },
'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)$/ },
'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 },
'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})$/ },
'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 },
'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 },
'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 },
'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,}))$/ },
'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 },
'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)$/ },
'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 },
};

@@ -171,3 +170,3 @@ export class ASTNodeImpl {

if (error.code === ErrorCode.EnumValueMismatch) {
error.message = localize('enumWarning', 'Value is not accepted. Valid values: {0}.', this.enumValues.map(v => JSON.stringify(v)).join(', '));
error.message = l10n.t('Value is not accepted. Valid values: {0}.', this.enumValues.map(v => JSON.stringify(v)).join(', '));
}

@@ -307,3 +306,3 @@ }

location: { offset: node.offset, length: node.length },
message: schema.errorMessage || localize('typeArrayMismatchWarning', 'Incorrect type. Expected one of {0}.', schema.type.join(', '))
message: schema.errorMessage || l10n.t('Incorrect type. Expected one of {0}.', schema.type.join(', '))
});

@@ -316,3 +315,3 @@ }

location: { offset: node.offset, length: node.length },
message: schema.errorMessage || localize('typeMismatchWarning', 'Incorrect type. Expected "{0}".', schema.type)
message: schema.errorMessage || l10n.t('Incorrect type. Expected "{0}".', schema.type)
});

@@ -338,3 +337,3 @@ }

location: { offset: node.offset, length: node.length },
message: localize('notSchemaWarning', "Matches a schema that is not allowed.")
message: l10n.t("Matches a schema that is not allowed.")
});

@@ -387,3 +386,3 @@ }

location: { offset: node.offset, length: 1 },
message: localize('oneOfWarning', "Matches multiple schemas when only one must validate.")
message: l10n.t("Matches multiple schemas when only one must validate.")
});

@@ -445,3 +444,3 @@ }

code: ErrorCode.EnumValueMismatch,
message: schema.errorMessage || localize('enumWarning', 'Value is not accepted. Valid values: {0}.', schema.enum.map(v => JSON.stringify(v)).join(', '))
message: schema.errorMessage || l10n.t('Value is not accepted. Valid values: {0}.', schema.enum.map(v => JSON.stringify(v)).join(', '))
});

@@ -456,3 +455,3 @@ }

code: ErrorCode.EnumValueMismatch,
message: schema.errorMessage || localize('constWarning', 'Value must be {0}.', JSON.stringify(schema.const))
message: schema.errorMessage || l10n.t('Value must be {0}.', JSON.stringify(schema.const))
});

@@ -468,3 +467,3 @@ validationResult.enumValueMatch = false;

if ((deprecationMessage || schema.deprecated) && node.parent) {
deprecationMessage = deprecationMessage || localize('deprecated', 'Value is deprecated');
deprecationMessage = deprecationMessage || l10n.t('Value is deprecated');
validationResult.problems.push({

@@ -510,3 +509,3 @@ location: { offset: node.parent.offset, length: node.parent.length },

location: { offset: node.offset, length: node.length },
message: localize('multipleOfWarning', 'Value is not divisible by {0}.', schema.multipleOf)
message: l10n.t('Value is not divisible by {0}.', schema.multipleOf)
});

@@ -534,3 +533,3 @@ }

location: { offset: node.offset, length: node.length },
message: localize('exclusiveMinimumWarning', 'Value is below the exclusive minimum of {0}.', exclusiveMinimum)
message: l10n.t('Value is below the exclusive minimum of {0}.', exclusiveMinimum)
});

@@ -542,3 +541,3 @@ }

location: { offset: node.offset, length: node.length },
message: localize('exclusiveMaximumWarning', 'Value is above the exclusive maximum of {0}.', exclusiveMaximum)
message: l10n.t('Value is above the exclusive maximum of {0}.', exclusiveMaximum)
});

@@ -550,3 +549,3 @@ }

location: { offset: node.offset, length: node.length },
message: localize('minimumWarning', 'Value is below the minimum of {0}.', minimum)
message: l10n.t('Value is below the minimum of {0}.', minimum)
});

@@ -558,3 +557,3 @@ }

location: { offset: node.offset, length: node.length },
message: localize('maximumWarning', 'Value is above the maximum of {0}.', maximum)
message: l10n.t('Value is above the maximum of {0}.', maximum)
});

@@ -567,3 +566,3 @@ }

location: { offset: node.offset, length: node.length },
message: localize('minLengthWarning', 'String is shorter than the minimum length of {0}.', schema.minLength)
message: l10n.t('String is shorter than the minimum length of {0}.', schema.minLength)
});

@@ -574,3 +573,3 @@ }

location: { offset: node.offset, length: node.length },
message: localize('maxLengthWarning', 'String is longer than the maximum length of {0}.', schema.maxLength)
message: l10n.t('String is longer than the maximum length of {0}.', schema.maxLength)
});

@@ -583,3 +582,3 @@ }

location: { offset: node.offset, length: node.length },
message: schema.patternErrorMessage || schema.errorMessage || localize('patternWarning', 'String does not match the pattern of "{0}".', schema.pattern)
message: schema.patternErrorMessage || schema.errorMessage || l10n.t('String does not match the pattern of "{0}".', schema.pattern)
});

@@ -595,3 +594,3 @@ }

if (!node.value) {
errorMessage = localize('uriEmpty', 'URI expected.');
errorMessage = l10n.t('URI expected.');
}

@@ -601,6 +600,6 @@ else {

if (!match) {
errorMessage = localize('uriMissing', 'URI is expected.');
errorMessage = l10n.t('URI is expected.');
}
else if (!match[2] && schema.format === 'uri') {
errorMessage = localize('uriSchemeMissing', 'URI with a scheme is expected.');
errorMessage = l10n.t('URI with a scheme is expected.');
}

@@ -611,3 +610,3 @@ }

location: { offset: node.offset, length: node.length },
message: schema.patternErrorMessage || schema.errorMessage || localize('uriFormatWarning', 'String is not a URI: {0}', errorMessage)
message: schema.patternErrorMessage || schema.errorMessage || l10n.t('String is not a URI: {0}', errorMessage)
});

@@ -667,3 +666,3 @@ }

location: { offset: node.offset, length: node.length },
message: localize('additionalItemsWarning', 'Array has too many items according to schema. Expected {0} or fewer.', index)
message: l10n.t('Array has too many items according to schema. Expected {0} or fewer.', index)
});

@@ -702,3 +701,3 @@ }

location: { offset: node.offset, length: node.length },
message: schema.errorMessage || localize('requiredItemMissingWarning', 'Array does not contain required item.')
message: schema.errorMessage || l10n.t('Array does not contain required item.')
});

@@ -709,3 +708,3 @@ }

location: { offset: node.offset, length: node.length },
message: localize('minContainsWarning', 'Array has too few items that match the contains contraint. Expected {0} or more.', schema.minContains)
message: l10n.t('Array has too few items that match the contains contraint. Expected {0} or more.', schema.minContains)
});

@@ -716,3 +715,3 @@ }

location: { offset: node.offset, length: node.length },
message: localize('maxContainsWarning', 'Array has too many items that match the contains contraint. Expected {0} or less.', schema.maxContains)
message: l10n.t('Array has too many items that match the contains contraint. Expected {0} or less.', schema.maxContains)
});

@@ -728,3 +727,3 @@ }

location: { offset: node.offset, length: node.length },
message: localize('unevaluatedItemsWarning', 'Item does not match any validation rule from the array.')
message: l10n.t('Item does not match any validation rule from the array.')
});

@@ -745,3 +744,3 @@ }

location: { offset: node.offset, length: node.length },
message: localize('minItemsWarning', 'Array has too few items. Expected {0} or more.', schema.minItems)
message: l10n.t('Array has too few items. Expected {0} or more.', schema.minItems)
});

@@ -752,3 +751,3 @@ }

location: { offset: node.offset, length: node.length },
message: localize('maxItemsWarning', 'Array has too many items. Expected {0} or fewer.', schema.maxItems)
message: l10n.t('Array has too many items. Expected {0} or fewer.', schema.maxItems)
});

@@ -764,3 +763,3 @@ }

location: { offset: node.offset, length: node.length },
message: localize('uniqueItemsWarning', 'Array has duplicate items.')
message: l10n.t('Array has duplicate items.')
});

@@ -785,3 +784,3 @@ }

location: location,
message: localize('MissingRequiredPropWarning', 'Missing property "{0}".', propertyName)
message: l10n.t('Missing property "{0}".', propertyName)
});

@@ -806,3 +805,3 @@ }

location: { offset: propertyNode.keyNode.offset, length: propertyNode.keyNode.length },
message: schema.errorMessage || localize('DisallowedExtraPropWarning', 'Property {0} is not allowed.', propertyName)
message: schema.errorMessage || l10n.t('Property {0} is not allowed.', propertyName)
});

@@ -839,3 +838,3 @@ }

location: { offset: propertyNode.keyNode.offset, length: propertyNode.keyNode.length },
message: schema.errorMessage || localize('DisallowedExtraPropWarning', 'Property {0} is not allowed.', propertyName)
message: schema.errorMessage || l10n.t('Property {0} is not allowed.', propertyName)
});

@@ -870,3 +869,3 @@ }

location: { offset: propertyNode.keyNode.offset, length: propertyNode.keyNode.length },
message: schema.errorMessage || localize('DisallowedExtraPropWarning', 'Property {0} is not allowed.', propertyName)
message: schema.errorMessage || l10n.t('Property {0} is not allowed.', propertyName)
});

@@ -894,3 +893,3 @@ }

location: { offset: propertyNode.keyNode.offset, length: propertyNode.keyNode.length },
message: schema.errorMessage || localize('DisallowedExtraPropWarning', 'Property {0} is not allowed.', propertyName)
message: schema.errorMessage || l10n.t('Property {0} is not allowed.', propertyName)
});

@@ -912,3 +911,3 @@ }

location: { offset: node.offset, length: node.length },
message: localize('MaxPropWarning', 'Object has more properties than limit of {0}.', schema.maxProperties)
message: l10n.t('Object has more properties than limit of {0}.', schema.maxProperties)
});

@@ -921,3 +920,3 @@ }

location: { offset: node.offset, length: node.length },
message: localize('MinPropWarning', 'Object has fewer properties than the required number of {0}', schema.minProperties)
message: l10n.t('Object has fewer properties than the required number of {0}', schema.minProperties)
});

@@ -967,3 +966,3 @@ }

location: { offset: node.offset, length: node.length },
message: localize('RequiredDependentPropWarning', 'Object is missing property {0} required by property {1}.', requiredProp, key)
message: l10n.t('Object is missing property {0} required by property {1}.', requiredProp, key)
});

@@ -1058,18 +1057,18 @@ }

case 4 /* Json.ScanError.InvalidUnicode */:
_error(localize('InvalidUnicode', 'Invalid unicode sequence in string.'), ErrorCode.InvalidUnicode);
_error(l10n.t('Invalid unicode sequence in string.'), ErrorCode.InvalidUnicode);
return true;
case 5 /* Json.ScanError.InvalidEscapeCharacter */:
_error(localize('InvalidEscapeCharacter', 'Invalid escape character in string.'), ErrorCode.InvalidEscapeCharacter);
_error(l10n.t('Invalid escape character in string.'), ErrorCode.InvalidEscapeCharacter);
return true;
case 3 /* Json.ScanError.UnexpectedEndOfNumber */:
_error(localize('UnexpectedEndOfNumber', 'Unexpected end of number.'), ErrorCode.UnexpectedEndOfNumber);
_error(l10n.t('Unexpected end of number.'), ErrorCode.UnexpectedEndOfNumber);
return true;
case 1 /* Json.ScanError.UnexpectedEndOfComment */:
_error(localize('UnexpectedEndOfComment', 'Unexpected end of comment.'), ErrorCode.UnexpectedEndOfComment);
_error(l10n.t('Unexpected end of comment.'), ErrorCode.UnexpectedEndOfComment);
return true;
case 2 /* Json.ScanError.UnexpectedEndOfString */:
_error(localize('UnexpectedEndOfString', 'Unexpected end of string.'), ErrorCode.UnexpectedEndOfString);
_error(l10n.t('Unexpected end of string.'), ErrorCode.UnexpectedEndOfString);
return true;
case 6 /* Json.ScanError.InvalidCharacter */:
_error(localize('InvalidCharacter', 'Invalid characters in string. Control characters must be escaped.'), ErrorCode.InvalidCharacter);
_error(l10n.t('Invalid characters in string. Control characters must be escaped.'), ErrorCode.InvalidCharacter);
return true;

@@ -1097,3 +1096,3 @@ }

if (!needsComma) {
_error(localize('ValueExpected', 'Value expected'), ErrorCode.ValueExpected);
_error(l10n.t('Value expected'), ErrorCode.ValueExpected);
}

@@ -1104,3 +1103,3 @@ const commaOffset = scanner.getTokenOffset();

if (needsComma) {
_errorAtRange(localize('TrailingComma', 'Trailing comma'), ErrorCode.TrailingComma, commaOffset, commaOffset + 1);
_errorAtRange(l10n.t('Trailing comma'), ErrorCode.TrailingComma, commaOffset, commaOffset + 1);
}

@@ -1111,7 +1110,7 @@ continue;

else if (needsComma) {
_error(localize('ExpectedComma', 'Expected comma'), ErrorCode.CommaExpected);
_error(l10n.t('Expected comma'), ErrorCode.CommaExpected);
}
const item = _parseValue(node);
if (!item) {
_error(localize('PropertyExpected', 'Value expected'), ErrorCode.ValueExpected, undefined, [], [4 /* Json.SyntaxKind.CloseBracketToken */, 5 /* Json.SyntaxKind.CommaToken */]);
_error(l10n.t('Value expected'), ErrorCode.ValueExpected, undefined, [], [4 /* Json.SyntaxKind.CloseBracketToken */, 5 /* Json.SyntaxKind.CommaToken */]);
}

@@ -1124,3 +1123,3 @@ else {

if (scanner.getToken() !== 4 /* Json.SyntaxKind.CloseBracketToken */) {
return _error(localize('ExpectedCloseBracket', 'Expected comma or closing bracket'), ErrorCode.CommaOrCloseBacketExpected, node);
return _error(l10n.t('Expected comma or closing bracket'), ErrorCode.CommaOrCloseBacketExpected, node);
}

@@ -1136,3 +1135,3 @@ return _finalize(node, true);

// give a more helpful error message
_error(localize('DoubleQuotesExpected', 'Property keys must be doublequoted'), ErrorCode.Undefined);
_error(l10n.t('Property keys must be doublequoted'), ErrorCode.Undefined);
const keyNode = new StringASTNodeImpl(node, scanner.getTokenOffset(), scanner.getTokenLength());

@@ -1153,5 +1152,5 @@ keyNode.value = scanner.getTokenValue();

if (seen) {
_errorAtRange(localize('DuplicateKeyWarning', "Duplicate object key"), ErrorCode.DuplicateKey, node.keyNode.offset, node.keyNode.offset + node.keyNode.length, DiagnosticSeverity.Warning);
_errorAtRange(l10n.t("Duplicate object key"), ErrorCode.DuplicateKey, node.keyNode.offset, node.keyNode.offset + node.keyNode.length, DiagnosticSeverity.Warning);
if (isObject(seen)) {
_errorAtRange(localize('DuplicateKeyWarning', "Duplicate object key"), ErrorCode.DuplicateKey, seen.keyNode.offset, seen.keyNode.offset + seen.keyNode.length, DiagnosticSeverity.Warning);
_errorAtRange(l10n.t("Duplicate object key"), ErrorCode.DuplicateKey, seen.keyNode.offset, seen.keyNode.offset + seen.keyNode.length, DiagnosticSeverity.Warning);
}

@@ -1169,3 +1168,3 @@ keysSeen[key.value] = true; // if the same key is duplicate again, avoid duplicate error reporting

else {
_error(localize('ColonExpected', 'Colon expected'), ErrorCode.ColonExpected);
_error(l10n.t('Colon expected'), ErrorCode.ColonExpected);
if (scanner.getToken() === 10 /* Json.SyntaxKind.StringLiteral */ && textDocument.positionAt(key.offset + key.length).line < textDocument.positionAt(scanner.getTokenOffset()).line) {

@@ -1178,3 +1177,3 @@ node.length = key.length;

if (!value) {
return _error(localize('ValueExpected', 'Value expected'), ErrorCode.ValueExpected, node, [], [2 /* Json.SyntaxKind.CloseBraceToken */, 5 /* Json.SyntaxKind.CommaToken */]);
return _error(l10n.t('Value expected'), ErrorCode.ValueExpected, node, [], [2 /* Json.SyntaxKind.CloseBraceToken */, 5 /* Json.SyntaxKind.CommaToken */]);
}

@@ -1196,3 +1195,3 @@ node.valueNode = value;

if (!needsComma) {
_error(localize('PropertyExpected', 'Property expected'), ErrorCode.PropertyExpected);
_error(l10n.t('Property expected'), ErrorCode.PropertyExpected);
}

@@ -1203,3 +1202,3 @@ const commaOffset = scanner.getTokenOffset();

if (needsComma) {
_errorAtRange(localize('TrailingComma', 'Trailing comma'), ErrorCode.TrailingComma, commaOffset, commaOffset + 1);
_errorAtRange(l10n.t('Trailing comma'), ErrorCode.TrailingComma, commaOffset, commaOffset + 1);
}

@@ -1210,7 +1209,7 @@ continue;

else if (needsComma) {
_error(localize('ExpectedComma', 'Expected comma'), ErrorCode.CommaExpected);
_error(l10n.t('Expected comma'), ErrorCode.CommaExpected);
}
const property = _parseProperty(node, keysSeen);
if (!property) {
_error(localize('PropertyExpected', 'Property expected'), ErrorCode.PropertyExpected, undefined, [], [2 /* Json.SyntaxKind.CloseBraceToken */, 5 /* Json.SyntaxKind.CommaToken */]);
_error(l10n.t('Property expected'), ErrorCode.PropertyExpected, undefined, [], [2 /* Json.SyntaxKind.CloseBraceToken */, 5 /* Json.SyntaxKind.CommaToken */]);
}

@@ -1223,3 +1222,3 @@ else {

if (scanner.getToken() !== 2 /* Json.SyntaxKind.CloseBraceToken */) {
return _error(localize('ExpectedCloseBrace', 'Expected comma or closing brace'), ErrorCode.CommaOrCloseBraceExpected, node);
return _error(l10n.t('Expected comma or closing brace'), ErrorCode.CommaOrCloseBraceExpected, node);
}

@@ -1246,3 +1245,3 @@ return _finalize(node, true);

if (!isNumber(numberValue)) {
return _error(localize('InvalidNumberFormat', 'Invalid number format.'), ErrorCode.Undefined, node);
return _error(l10n.t('Invalid number format.'), ErrorCode.Undefined, node);
}

@@ -1252,3 +1251,3 @@ node.value = numberValue;

catch (e) {
return _error(localize('InvalidNumberFormat', 'Invalid number format.'), ErrorCode.Undefined, node);
return _error(l10n.t('Invalid number format.'), ErrorCode.Undefined, node);
}

@@ -1280,6 +1279,6 @@ node.isInteger = tokenValue.indexOf('.') === -1;

if (!_root) {
_error(localize('Invalid symbol', 'Expected a JSON object, array or literal.'), ErrorCode.Undefined);
_error(l10n.t('Expected a JSON object, array or literal.'), ErrorCode.Undefined);
}
else if (scanner.getToken() !== 17 /* Json.SyntaxKind.EOF */) {
_error(localize('End of file expected', 'End of file expected.'), ErrorCode.Undefined);
_error(l10n.t('End of file expected.'), ErrorCode.Undefined);
}

@@ -1286,0 +1285,0 @@ }

@@ -5,4 +5,3 @@ /*---------------------------------------------------------------------------------------------

*--------------------------------------------------------------------------------------------*/
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
import * as l10n from '@vscode/l10n';
export const schemaContributions = {

@@ -467,48 +466,48 @@ schemaAssociations: [],

const descriptions = {
id: localize('schema.json.id', "A unique identifier for the schema."),
$schema: localize('schema.json.$schema', "The schema to verify this document against."),
title: localize('schema.json.title', "A descriptive title of the element."),
description: localize('schema.json.description', "A long description of the element. Used in hover menus and suggestions."),
default: localize('schema.json.default', "A default value. Used by suggestions."),
multipleOf: localize('schema.json.multipleOf', "A number that should cleanly divide the current value (i.e. have no remainder)."),
maximum: localize('schema.json.maximum', "The maximum numerical value, inclusive by default."),
exclusiveMaximum: localize('schema.json.exclusiveMaximum', "Makes the maximum property exclusive."),
minimum: localize('schema.json.minimum', "The minimum numerical value, inclusive by default."),
exclusiveMinimum: localize('schema.json.exclusiveMininum', "Makes the minimum property exclusive."),
maxLength: localize('schema.json.maxLength', "The maximum length of a string."),
minLength: localize('schema.json.minLength', "The minimum length of a string."),
pattern: localize('schema.json.pattern', "A regular expression to match the string against. It is not implicitly anchored."),
additionalItems: localize('schema.json.additionalItems', "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."),
items: localize('schema.json.items', "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."),
maxItems: localize('schema.json.maxItems', "The maximum number of items that can be inside an array. Inclusive."),
minItems: localize('schema.json.minItems', "The minimum number of items that can be inside an array. Inclusive."),
uniqueItems: localize('schema.json.uniqueItems', "If all of the items in the array must be unique. Defaults to false."),
maxProperties: localize('schema.json.maxProperties', "The maximum number of properties an object can have. Inclusive."),
minProperties: localize('schema.json.minProperties', "The minimum number of properties an object can have. Inclusive."),
required: localize('schema.json.required', "An array of strings that lists the names of all properties required on this object."),
additionalProperties: localize('schema.json.additionalProperties', "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."),
definitions: localize('schema.json.definitions', "Not used for validation. Place subschemas here that you wish to reference inline with $ref."),
properties: localize('schema.json.properties', "A map of property names to schemas for each property."),
patternProperties: localize('schema.json.patternProperties', "A map of regular expressions on property names to schemas for matching properties."),
dependencies: localize('schema.json.dependencies', "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."),
enum: localize('schema.json.enum', "The set of literal values that are valid."),
type: localize('schema.json.type', "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."),
format: localize('schema.json.format', "Describes the format expected for the value."),
allOf: localize('schema.json.allOf', "An array of schemas, all of which must match."),
anyOf: localize('schema.json.anyOf', "An array of schemas, where at least one must match."),
oneOf: localize('schema.json.oneOf', "An array of schemas, exactly one of which must match."),
not: localize('schema.json.not', "A schema which must not match."),
$id: localize('schema.json.$id', "A unique identifier for the schema."),
$ref: localize('schema.json.$ref', "Reference a definition hosted on any location."),
$comment: localize('schema.json.$comment', "Comments from schema authors to readers or maintainers of the schema."),
readOnly: localize('schema.json.readOnly', "Indicates that the value of the instance is managed exclusively by the owning authority."),
examples: localize('schema.json.examples', "Sample JSON values associated with a particular schema, for the purpose of illustrating usage."),
contains: localize('schema.json.contains', "An array instance is valid against \"contains\" if at least one of its elements is valid against the given schema."),
propertyNames: localize('schema.json.propertyNames', "If the instance is an object, this keyword validates if every property name in the instance validates against the provided schema."),
const: localize('schema.json.const', "An instance validates successfully against this keyword if its value is equal to the value of the keyword."),
contentMediaType: localize('schema.json.contentMediaType', "Describes the media type of a string property."),
contentEncoding: localize('schema.json.contentEncoding', "Describes the content encoding of a string property."),
if: localize('schema.json.if', "The validation outcome of the \"if\" subschema controls which of the \"then\" or \"else\" keywords are evaluated."),
then: localize('schema.json.then', "The \"if\" subschema is used for validation when the \"if\" subschema succeeds."),
else: localize('schema.json.else', "The \"else\" subschema is used for validation when the \"if\" subschema fails.")
id: l10n.t("A unique identifier for the schema."),
$schema: l10n.t("The schema to verify this document against."),
title: l10n.t("A descriptive title of the element."),
description: l10n.t("A long description of the element. Used in hover menus and suggestions."),
default: l10n.t("A default value. Used by suggestions."),
multipleOf: l10n.t("A number that should cleanly divide the current value (i.e. have no remainder)."),
maximum: l10n.t("The maximum numerical value, inclusive by default."),
exclusiveMaximum: l10n.t("Makes the maximum property exclusive."),
minimum: l10n.t("The minimum numerical value, inclusive by default."),
exclusiveMinimum: l10n.t("Makes the minimum property exclusive."),
maxLength: l10n.t("The maximum length of a string."),
minLength: l10n.t("The minimum length of a string."),
pattern: l10n.t("A regular expression to match the string against. It is not implicitly anchored."),
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."),
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."),
maxItems: l10n.t("The maximum number of items that can be inside an array. Inclusive."),
minItems: l10n.t("The minimum number of items that can be inside an array. Inclusive."),
uniqueItems: l10n.t("If all of the items in the array must be unique. Defaults to false."),
maxProperties: l10n.t("The maximum number of properties an object can have. Inclusive."),
minProperties: l10n.t("The minimum number of properties an object can have. Inclusive."),
required: l10n.t("An array of strings that lists the names of all properties required on this object."),
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."),
definitions: l10n.t("Not used for validation. Place subschemas here that you wish to reference inline with $ref."),
properties: l10n.t("A map of property names to schemas for each property."),
patternProperties: l10n.t("A map of regular expressions on property names to schemas for matching properties."),
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."),
enum: l10n.t("The set of literal values that are valid."),
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."),
format: l10n.t("Describes the format expected for the value."),
allOf: l10n.t("An array of schemas, all of which must match."),
anyOf: l10n.t("An array of schemas, where at least one must match."),
oneOf: l10n.t("An array of schemas, exactly one of which must match."),
not: l10n.t("A schema which must not match."),
$id: l10n.t("A unique identifier for the schema."),
$ref: l10n.t("Reference a definition hosted on any location."),
$comment: l10n.t("Comments from schema authors to readers or maintainers of the schema."),
readOnly: l10n.t("Indicates that the value of the instance is managed exclusively by the owning authority."),
examples: l10n.t("Sample JSON values associated with a particular schema, for the purpose of illustrating usage."),
contains: l10n.t("An array instance is valid against \"contains\" if at least one of its elements is valid against the given schema."),
propertyNames: l10n.t("If the instance is an object, this keyword validates if every property name in the instance validates against the provided schema."),
const: l10n.t("An instance validates successfully against this keyword if its value is equal to the value of the keyword."),
contentMediaType: l10n.t("Describes the media type of a string property."),
contentEncoding: l10n.t("Describes the content encoding of a string property."),
if: l10n.t("The validation outcome of the \"if\" subschema controls which of the \"then\" or \"else\" keywords are evaluated."),
then: l10n.t("The \"if\" subschema is used for validation when the \"if\" subschema succeeds."),
else: l10n.t("The \"else\" subschema is used for validation when the \"if\" subschema fails.")
};

@@ -526,6 +525,3 @@ for (const schemaName in schemaContributions.schemas) {

}
else {
console.log(`${property}: localize('schema.json.${property}', "")`);
}
}
}

@@ -11,4 +11,3 @@ /*---------------------------------------------------------------------------------------------

import { CompletionItem, CompletionItemKind, Range, TextEdit, InsertTextFormat, MarkupKind } from '../jsonLanguageTypes';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
import * as l10n from '@vscode/l10n';
const valueCommitCharacters = [',', '}', ']'];

@@ -66,7 +65,7 @@ const propertyCommitCharacters = [':'];

const supportsCommitCharacters = false; //this.doesSupportsCommitCharacters(); disabled for now, waiting for new API: https://github.com/microsoft/vscode/issues/42544
const proposed = {};
const proposed = new Map();
const collector = {
add: (suggestion) => {
let label = suggestion.label;
const existing = proposed[label];
const existing = proposed.get(label);
if (!existing) {

@@ -76,3 +75,3 @@ label = label.replace(/[\n]/g, '↵');

const shortendedLabel = label.substr(0, 57).trim() + '...';
if (!proposed[shortendedLabel]) {
if (!proposed.has(shortendedLabel)) {
label = shortendedLabel;

@@ -88,3 +87,3 @@ }

suggestion.label = label;
proposed[label] = suggestion;
proposed.set(label, suggestion);
result.items.push(suggestion);

@@ -107,5 +106,2 @@ }

},
log: (message) => {
console.log(message);
},
getNumberOfProposals: () => {

@@ -143,3 +139,3 @@ return result.items.length;

if (!currentProperty || currentProperty !== p) {
proposed[p.keyNode.value] = CompletionItem.create('__');
proposed.set(p.keyNode.value, CompletionItem.create('__'));
}

@@ -523,3 +519,3 @@ });

insertTextFormat: InsertTextFormat.Snippet,
detail: localize('json.suggest.default', 'Default value')
detail: l10n.t('Default value')
});

@@ -641,3 +637,3 @@ hasProposals = true;

insertTextFormat: InsertTextFormat.Snippet,
detail: localize('defaults.object', 'New object'),
detail: l10n.t('New object'),
documentation: ''

@@ -652,3 +648,3 @@ });

insertTextFormat: InsertTextFormat.Snippet,
detail: localize('defaults.array', 'New array'),
detail: l10n.t('New array'),
documentation: ''

@@ -655,0 +651,0 @@ });

@@ -9,6 +9,5 @@ /*---------------------------------------------------------------------------------------------

import * as Parser from '../parser/jsonParser';
import * as nls from 'vscode-nls';
import * as l10n from '@vscode/l10n';
import { createRegex } from '../utils/glob';
import { isObject, isString } from '../utils/objects';
const localize = nls.loadMessageBundle();
const BANG = '!';

@@ -254,3 +253,3 @@ const PATH_SEP = '/';

if (!this.requestService) {
const errorMessage = localize('json.schema.norequestservice', 'Unable to load schema from \'{0}\'. No schema request service available', toDisplayString(url));
const errorMessage = l10n.t('Unable to load schema from \'{0}\'. No schema request service available', toDisplayString(url));
return this.promise.resolve(new UnresolvedSchema({}, [errorMessage]));

@@ -260,3 +259,3 @@ }

if (!content) {
const errorMessage = localize('json.schema.nocontent', 'Unable to load schema from \'{0}\': No content.', toDisplayString(url));
const errorMessage = l10n.t('Unable to load schema from \'{0}\': No content.', toDisplayString(url));
return new UnresolvedSchema({}, [errorMessage]);

@@ -266,3 +265,3 @@ }

if (content.charCodeAt(0) === 65279) {
errors.push(localize('json.schema.encodingWithBOM', 'Problem reading content from \'{0}\': UTF-8 with BOM detected, only UTF 8 is allowed.', toDisplayString(url)));
errors.push(l10n.t('Problem reading content from \'{0}\': UTF-8 with BOM detected, only UTF 8 is allowed.', toDisplayString(url)));
content = content.trimStart();

@@ -274,3 +273,3 @@ }

if (jsonErrors.length) {
errors.push(localize('json.schema.invalidFormat', 'Unable to parse content from \'{0}\': Parse error at offset {1}.', toDisplayString(url), jsonErrors[0].offset));
errors.push(l10n.t('Unable to parse content from \'{0}\': Parse error at offset {1}.', toDisplayString(url), jsonErrors[0].offset));
}

@@ -288,3 +287,3 @@ return new UnresolvedSchema(schemaContent, errors);

}
return new UnresolvedSchema({}, [localize('json.schema.nocontent', 'Unable to load schema from \'{0}\': {1}.', toDisplayString(url), errorMessage)]);
return new UnresolvedSchema({}, [l10n.t('Unable to load schema from \'{0}\': {1}.', toDisplayString(url), errorMessage)]);
});

@@ -297,3 +296,3 @@ }

if (schemaDraft === 'http://json-schema.org/draft-03/schema') {
return this.promise.resolve(new ResolvedSchema({}, [localize('json.schema.draft03.notsupported', "Draft-03 schemas are not supported.")], [], schemaDraft));
return this.promise.resolve(new ResolvedSchema({}, [l10n.t("Draft-03 schemas are not supported.")], [], schemaDraft));
}

@@ -345,3 +344,3 @@ let usesUnsupportedFeatures = new Set();

else {
resolveErrors.push(localize('json.schema.invalidid', '$ref \'{0}\' in \'{1}\' can not be resolved.', refSegment, sourceHandle.uri));
resolveErrors.push(l10n.t('$ref \'{0}\' in \'{1}\' can not be resolved.', refSegment || '', sourceHandle.uri));
}

@@ -359,3 +358,3 @@ };

const loc = refSegment ? uri + '#' + refSegment : uri;
resolveErrors.push(localize('json.schema.problemloadingref', 'Problems loading reference \'{0}\': {1}', loc, unresolvedSchema.errors[0]));
resolveErrors.push(l10n.t('Problems loading reference \'{0}\': {1}', loc, unresolvedSchema.errors[0]));
}

@@ -404,3 +403,3 @@ mergeRef(node, unresolvedSchema.schema, referencedHandle, refSegment);

if (result.has(anchor)) {
resolveErrors.push(localize('json.schema.duplicateid', 'Duplicate anchor declaration: \'{0}\'', anchor));
resolveErrors.push(l10n.t('Duplicate anchor declaration: \'{0}\'', anchor));
}

@@ -423,3 +422,3 @@ else {

if (usesUnsupportedFeatures.size) {
resolveWarnings.push(localize('json.schema.warnings', 'The schema uses meta-schema features ({0}) that are not yet supported by the validator.', Array.from(usesUnsupportedFeatures.keys()).join(', ')));
resolveWarnings.push(l10n.t('The schema uses meta-schema features ({0}) that are not yet supported by the validator.', Array.from(usesUnsupportedFeatures.keys()).join(', ')));
}

@@ -426,0 +425,0 @@ return new ResolvedSchema(schema, resolveErrors, resolveWarnings, schemaDraft);

@@ -6,5 +6,4 @@ /*---------------------------------------------------------------------------------------------

import { ErrorCode, Diagnostic, DiagnosticSeverity, Range } from '../jsonLanguageTypes';
import * as nls from 'vscode-nls';
import * as l10n from '@vscode/l10n';
import { isBoolean } from '../utils/objects';
const localize = nls.loadMessageBundle();
export class JSONValidation {

@@ -86,3 +85,3 @@ constructor(jsonSchemaService, promiseConstructor) {

if (typeof commentSeverity === 'number') {
const message = localize('InvalidCommentToken', 'Comments are not permitted in JSON.');
const message = l10n.t('Comments are not permitted in JSON.');
jsonDocument.comments.forEach(c => {

@@ -89,0 +88,0 @@ addProblem(Diagnostic.create(c, message, commentSeverity, ErrorCode.CommentNotPermitted));

@@ -14,5 +14,4 @@ import { Thenable, MarkedString, CompletionItem } from './jsonLanguageService';

error(message: string): void;
log(message: string): void;
setAsIncomplete(): void;
getNumberOfProposals(): number;
}

@@ -11,3 +11,3 @@ /*---------------------------------------------------------------------------------------------

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "vscode-nls"], factory);
define(["require", "exports", "@vscode/l10n"], factory);
}

@@ -18,4 +18,3 @@ })(function (require, exports) {

exports.schemaContributions = void 0;
const nls = require("vscode-nls");
const localize = nls.loadMessageBundle();
const l10n = require("@vscode/l10n");
exports.schemaContributions = {

@@ -480,48 +479,48 @@ schemaAssociations: [],

const descriptions = {
id: localize('schema.json.id', "A unique identifier for the schema."),
$schema: localize('schema.json.$schema', "The schema to verify this document against."),
title: localize('schema.json.title', "A descriptive title of the element."),
description: localize('schema.json.description', "A long description of the element. Used in hover menus and suggestions."),
default: localize('schema.json.default', "A default value. Used by suggestions."),
multipleOf: localize('schema.json.multipleOf', "A number that should cleanly divide the current value (i.e. have no remainder)."),
maximum: localize('schema.json.maximum', "The maximum numerical value, inclusive by default."),
exclusiveMaximum: localize('schema.json.exclusiveMaximum', "Makes the maximum property exclusive."),
minimum: localize('schema.json.minimum', "The minimum numerical value, inclusive by default."),
exclusiveMinimum: localize('schema.json.exclusiveMininum', "Makes the minimum property exclusive."),
maxLength: localize('schema.json.maxLength', "The maximum length of a string."),
minLength: localize('schema.json.minLength', "The minimum length of a string."),
pattern: localize('schema.json.pattern', "A regular expression to match the string against. It is not implicitly anchored."),
additionalItems: localize('schema.json.additionalItems', "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."),
items: localize('schema.json.items', "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."),
maxItems: localize('schema.json.maxItems', "The maximum number of items that can be inside an array. Inclusive."),
minItems: localize('schema.json.minItems', "The minimum number of items that can be inside an array. Inclusive."),
uniqueItems: localize('schema.json.uniqueItems', "If all of the items in the array must be unique. Defaults to false."),
maxProperties: localize('schema.json.maxProperties', "The maximum number of properties an object can have. Inclusive."),
minProperties: localize('schema.json.minProperties', "The minimum number of properties an object can have. Inclusive."),
required: localize('schema.json.required', "An array of strings that lists the names of all properties required on this object."),
additionalProperties: localize('schema.json.additionalProperties', "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."),
definitions: localize('schema.json.definitions', "Not used for validation. Place subschemas here that you wish to reference inline with $ref."),
properties: localize('schema.json.properties', "A map of property names to schemas for each property."),
patternProperties: localize('schema.json.patternProperties', "A map of regular expressions on property names to schemas for matching properties."),
dependencies: localize('schema.json.dependencies', "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."),
enum: localize('schema.json.enum', "The set of literal values that are valid."),
type: localize('schema.json.type', "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."),
format: localize('schema.json.format', "Describes the format expected for the value."),
allOf: localize('schema.json.allOf', "An array of schemas, all of which must match."),
anyOf: localize('schema.json.anyOf', "An array of schemas, where at least one must match."),
oneOf: localize('schema.json.oneOf', "An array of schemas, exactly one of which must match."),
not: localize('schema.json.not', "A schema which must not match."),
$id: localize('schema.json.$id', "A unique identifier for the schema."),
$ref: localize('schema.json.$ref', "Reference a definition hosted on any location."),
$comment: localize('schema.json.$comment', "Comments from schema authors to readers or maintainers of the schema."),
readOnly: localize('schema.json.readOnly', "Indicates that the value of the instance is managed exclusively by the owning authority."),
examples: localize('schema.json.examples', "Sample JSON values associated with a particular schema, for the purpose of illustrating usage."),
contains: localize('schema.json.contains', "An array instance is valid against \"contains\" if at least one of its elements is valid against the given schema."),
propertyNames: localize('schema.json.propertyNames', "If the instance is an object, this keyword validates if every property name in the instance validates against the provided schema."),
const: localize('schema.json.const', "An instance validates successfully against this keyword if its value is equal to the value of the keyword."),
contentMediaType: localize('schema.json.contentMediaType', "Describes the media type of a string property."),
contentEncoding: localize('schema.json.contentEncoding', "Describes the content encoding of a string property."),
if: localize('schema.json.if', "The validation outcome of the \"if\" subschema controls which of the \"then\" or \"else\" keywords are evaluated."),
then: localize('schema.json.then', "The \"if\" subschema is used for validation when the \"if\" subschema succeeds."),
else: localize('schema.json.else', "The \"else\" subschema is used for validation when the \"if\" subschema fails.")
id: l10n.t("A unique identifier for the schema."),
$schema: l10n.t("The schema to verify this document against."),
title: l10n.t("A descriptive title of the element."),
description: l10n.t("A long description of the element. Used in hover menus and suggestions."),
default: l10n.t("A default value. Used by suggestions."),
multipleOf: l10n.t("A number that should cleanly divide the current value (i.e. have no remainder)."),
maximum: l10n.t("The maximum numerical value, inclusive by default."),
exclusiveMaximum: l10n.t("Makes the maximum property exclusive."),
minimum: l10n.t("The minimum numerical value, inclusive by default."),
exclusiveMinimum: l10n.t("Makes the minimum property exclusive."),
maxLength: l10n.t("The maximum length of a string."),
minLength: l10n.t("The minimum length of a string."),
pattern: l10n.t("A regular expression to match the string against. It is not implicitly anchored."),
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."),
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."),
maxItems: l10n.t("The maximum number of items that can be inside an array. Inclusive."),
minItems: l10n.t("The minimum number of items that can be inside an array. Inclusive."),
uniqueItems: l10n.t("If all of the items in the array must be unique. Defaults to false."),
maxProperties: l10n.t("The maximum number of properties an object can have. Inclusive."),
minProperties: l10n.t("The minimum number of properties an object can have. Inclusive."),
required: l10n.t("An array of strings that lists the names of all properties required on this object."),
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."),
definitions: l10n.t("Not used for validation. Place subschemas here that you wish to reference inline with $ref."),
properties: l10n.t("A map of property names to schemas for each property."),
patternProperties: l10n.t("A map of regular expressions on property names to schemas for matching properties."),
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."),
enum: l10n.t("The set of literal values that are valid."),
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."),
format: l10n.t("Describes the format expected for the value."),
allOf: l10n.t("An array of schemas, all of which must match."),
anyOf: l10n.t("An array of schemas, where at least one must match."),
oneOf: l10n.t("An array of schemas, exactly one of which must match."),
not: l10n.t("A schema which must not match."),
$id: l10n.t("A unique identifier for the schema."),
$ref: l10n.t("Reference a definition hosted on any location."),
$comment: l10n.t("Comments from schema authors to readers or maintainers of the schema."),
readOnly: l10n.t("Indicates that the value of the instance is managed exclusively by the owning authority."),
examples: l10n.t("Sample JSON values associated with a particular schema, for the purpose of illustrating usage."),
contains: l10n.t("An array instance is valid against \"contains\" if at least one of its elements is valid against the given schema."),
propertyNames: l10n.t("If the instance is an object, this keyword validates if every property name in the instance validates against the provided schema."),
const: l10n.t("An instance validates successfully against this keyword if its value is equal to the value of the keyword."),
contentMediaType: l10n.t("Describes the media type of a string property."),
contentEncoding: l10n.t("Describes the content encoding of a string property."),
if: l10n.t("The validation outcome of the \"if\" subschema controls which of the \"then\" or \"else\" keywords are evaluated."),
then: l10n.t("The \"if\" subschema is used for validation when the \"if\" subschema succeeds."),
else: l10n.t("The \"else\" subschema is used for validation when the \"if\" subschema fails.")
};

@@ -539,7 +538,4 @@ for (const schemaName in exports.schemaContributions.schemas) {

}
else {
console.log(`${property}: localize('schema.json.${property}', "")`);
}
}
}
});

@@ -11,3 +11,3 @@ /*---------------------------------------------------------------------------------------------

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "../parser/jsonParser", "jsonc-parser", "../utils/json", "../utils/strings", "../utils/objects", "../jsonLanguageTypes", "vscode-nls"], factory);
define(["require", "exports", "../parser/jsonParser", "jsonc-parser", "../utils/json", "../utils/strings", "../utils/objects", "../jsonLanguageTypes", "@vscode/l10n"], factory);
}

@@ -24,4 +24,3 @@ })(function (require, exports) {

const jsonLanguageTypes_1 = require("../jsonLanguageTypes");
const nls = require("vscode-nls");
const localize = nls.loadMessageBundle();
const l10n = require("@vscode/l10n");
const valueCommitCharacters = [',', '}', ']'];

@@ -79,7 +78,7 @@ const propertyCommitCharacters = [':'];

const supportsCommitCharacters = false; //this.doesSupportsCommitCharacters(); disabled for now, waiting for new API: https://github.com/microsoft/vscode/issues/42544
const proposed = {};
const proposed = new Map();
const collector = {
add: (suggestion) => {
let label = suggestion.label;
const existing = proposed[label];
const existing = proposed.get(label);
if (!existing) {

@@ -89,3 +88,3 @@ label = label.replace(/[\n]/g, '↵');

const shortendedLabel = label.substr(0, 57).trim() + '...';
if (!proposed[shortendedLabel]) {
if (!proposed.has(shortendedLabel)) {
label = shortendedLabel;

@@ -101,3 +100,3 @@ }

suggestion.label = label;
proposed[label] = suggestion;
proposed.set(label, suggestion);
result.items.push(suggestion);

@@ -120,5 +119,2 @@ }

},
log: (message) => {
console.log(message);
},
getNumberOfProposals: () => {

@@ -156,3 +152,3 @@ return result.items.length;

if (!currentProperty || currentProperty !== p) {
proposed[p.keyNode.value] = jsonLanguageTypes_1.CompletionItem.create('__');
proposed.set(p.keyNode.value, jsonLanguageTypes_1.CompletionItem.create('__'));
}

@@ -536,3 +532,3 @@ });

insertTextFormat: jsonLanguageTypes_1.InsertTextFormat.Snippet,
detail: localize('json.suggest.default', 'Default value')
detail: l10n.t('Default value')
});

@@ -654,3 +650,3 @@ hasProposals = true;

insertTextFormat: jsonLanguageTypes_1.InsertTextFormat.Snippet,
detail: localize('defaults.object', 'New object'),
detail: l10n.t('New object'),
documentation: ''

@@ -665,3 +661,3 @@ });

insertTextFormat: jsonLanguageTypes_1.InsertTextFormat.Snippet,
detail: localize('defaults.array', 'New array'),
detail: l10n.t('New array'),
documentation: ''

@@ -668,0 +664,0 @@ });

@@ -11,3 +11,3 @@ /*---------------------------------------------------------------------------------------------

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "jsonc-parser", "vscode-uri", "../utils/strings", "../parser/jsonParser", "vscode-nls", "../utils/glob", "../utils/objects"], factory);
define(["require", "exports", "jsonc-parser", "vscode-uri", "../utils/strings", "../parser/jsonParser", "@vscode/l10n", "../utils/glob", "../utils/objects"], factory);
}

@@ -22,6 +22,5 @@ })(function (require, exports) {

const Parser = require("../parser/jsonParser");
const nls = require("vscode-nls");
const l10n = require("@vscode/l10n");
const glob_1 = require("../utils/glob");
const objects_1 = require("../utils/objects");
const localize = nls.loadMessageBundle();
const BANG = '!';

@@ -269,3 +268,3 @@ const PATH_SEP = '/';

if (!this.requestService) {
const errorMessage = localize('json.schema.norequestservice', 'Unable to load schema from \'{0}\'. No schema request service available', toDisplayString(url));
const errorMessage = l10n.t('Unable to load schema from \'{0}\'. No schema request service available', toDisplayString(url));
return this.promise.resolve(new UnresolvedSchema({}, [errorMessage]));

@@ -275,3 +274,3 @@ }

if (!content) {
const errorMessage = localize('json.schema.nocontent', 'Unable to load schema from \'{0}\': No content.', toDisplayString(url));
const errorMessage = l10n.t('Unable to load schema from \'{0}\': No content.', toDisplayString(url));
return new UnresolvedSchema({}, [errorMessage]);

@@ -281,3 +280,3 @@ }

if (content.charCodeAt(0) === 65279) {
errors.push(localize('json.schema.encodingWithBOM', 'Problem reading content from \'{0}\': UTF-8 with BOM detected, only UTF 8 is allowed.', toDisplayString(url)));
errors.push(l10n.t('Problem reading content from \'{0}\': UTF-8 with BOM detected, only UTF 8 is allowed.', toDisplayString(url)));
content = content.trimStart();

@@ -289,3 +288,3 @@ }

if (jsonErrors.length) {
errors.push(localize('json.schema.invalidFormat', 'Unable to parse content from \'{0}\': Parse error at offset {1}.', toDisplayString(url), jsonErrors[0].offset));
errors.push(l10n.t('Unable to parse content from \'{0}\': Parse error at offset {1}.', toDisplayString(url), jsonErrors[0].offset));
}

@@ -303,3 +302,3 @@ return new UnresolvedSchema(schemaContent, errors);

}
return new UnresolvedSchema({}, [localize('json.schema.nocontent', 'Unable to load schema from \'{0}\': {1}.', toDisplayString(url), errorMessage)]);
return new UnresolvedSchema({}, [l10n.t('Unable to load schema from \'{0}\': {1}.', toDisplayString(url), errorMessage)]);
});

@@ -312,3 +311,3 @@ }

if (schemaDraft === 'http://json-schema.org/draft-03/schema') {
return this.promise.resolve(new ResolvedSchema({}, [localize('json.schema.draft03.notsupported', "Draft-03 schemas are not supported.")], [], schemaDraft));
return this.promise.resolve(new ResolvedSchema({}, [l10n.t("Draft-03 schemas are not supported.")], [], schemaDraft));
}

@@ -360,3 +359,3 @@ let usesUnsupportedFeatures = new Set();

else {
resolveErrors.push(localize('json.schema.invalidid', '$ref \'{0}\' in \'{1}\' can not be resolved.', refSegment, sourceHandle.uri));
resolveErrors.push(l10n.t('$ref \'{0}\' in \'{1}\' can not be resolved.', refSegment || '', sourceHandle.uri));
}

@@ -374,3 +373,3 @@ };

const loc = refSegment ? uri + '#' + refSegment : uri;
resolveErrors.push(localize('json.schema.problemloadingref', 'Problems loading reference \'{0}\': {1}', loc, unresolvedSchema.errors[0]));
resolveErrors.push(l10n.t('Problems loading reference \'{0}\': {1}', loc, unresolvedSchema.errors[0]));
}

@@ -419,3 +418,3 @@ mergeRef(node, unresolvedSchema.schema, referencedHandle, refSegment);

if (result.has(anchor)) {
resolveErrors.push(localize('json.schema.duplicateid', 'Duplicate anchor declaration: \'{0}\'', anchor));
resolveErrors.push(l10n.t('Duplicate anchor declaration: \'{0}\'', anchor));
}

@@ -438,3 +437,3 @@ else {

if (usesUnsupportedFeatures.size) {
resolveWarnings.push(localize('json.schema.warnings', 'The schema uses meta-schema features ({0}) that are not yet supported by the validator.', Array.from(usesUnsupportedFeatures.keys()).join(', ')));
resolveWarnings.push(l10n.t('The schema uses meta-schema features ({0}) that are not yet supported by the validator.', Array.from(usesUnsupportedFeatures.keys()).join(', ')));
}

@@ -441,0 +440,0 @@ return new ResolvedSchema(schema, resolveErrors, resolveWarnings, schemaDraft);

@@ -11,3 +11,3 @@ /*---------------------------------------------------------------------------------------------

else if (typeof define === "function" && define.amd) {
define(["require", "exports", "../jsonLanguageTypes", "vscode-nls", "../utils/objects"], factory);
define(["require", "exports", "../jsonLanguageTypes", "@vscode/l10n", "../utils/objects"], factory);
}

@@ -19,5 +19,4 @@ })(function (require, exports) {

const jsonLanguageTypes_1 = require("../jsonLanguageTypes");
const nls = require("vscode-nls");
const l10n = require("@vscode/l10n");
const objects_1 = require("../utils/objects");
const localize = nls.loadMessageBundle();
class JSONValidation {

@@ -99,3 +98,3 @@ constructor(jsonSchemaService, promiseConstructor) {

if (typeof commentSeverity === 'number') {
const message = localize('InvalidCommentToken', 'Comments are not permitted in JSON.');
const message = l10n.t('Comments are not permitted in JSON.');
jsonDocument.comments.forEach(c => {

@@ -102,0 +101,0 @@ addProblem(jsonLanguageTypes_1.Diagnostic.create(c, message, commentSeverity, jsonLanguageTypes_1.ErrorCode.CommentNotPermitted));

{
"name": "vscode-json-languageservice",
"version": "5.1.1",
"version": "5.1.2",
"description": "Language service for JSON",

@@ -18,11 +18,11 @@ "main": "./lib/umd/jsonLanguageService.js",

"devDependencies": {
"@types/mocha": "^9.1.1",
"@types/mocha": "^10.0.0",
"@types/node": "16.x",
"@typescript-eslint/eslint-plugin": "^5.38.1",
"@typescript-eslint/parser": "^5.38.1",
"eslint": "^8.24.0",
"@typescript-eslint/eslint-plugin": "^5.42.1",
"@typescript-eslint/parser": "^5.42.1",
"eslint": "^8.27.0",
"json-schema-test-suite": "https://github.com/json-schema-org/JSON-Schema-Test-Suite.git#69acf52990b004240839ae19b4bec8fb01d50876",
"mocha": "^10.0.0",
"rimraf": "^3.0.2",
"typescript": "^4.8.3",
"json-schema-test-suite": "https://github.com/json-schema-org/JSON-Schema-Test-Suite.git#69acf52990b004240839ae19b4bec8fb01d50876"
"typescript": "^4.8.4"
},

@@ -33,8 +33,7 @@ "dependencies": {

"vscode-languageserver-types": "^3.17.2",
"vscode-nls": "^5.2.0",
"vscode-uri": "^3.0.6"
"vscode-uri": "^3.0.6",
"@vscode/l10n": "^0.0.8"
},
"scripts": {
"prepublishOnly": "npm run clean && npm run compile-esm && npm run test && npm run remove-sourcemap-refs",
"postpublish": "node ./build/post-publish.js",
"prepack": "npm run clean && npm run compile-esm && npm run test && npm run remove-sourcemap-refs",
"compile": "tsc -p ./src",

@@ -51,6 +50,4 @@ "compile-esm": "tsc -p ./src/tsconfig.esm.json",

"install-types-next": "npm install vscode-languageserver-types@next -f -S && npm install vscode-languageserver-textdocument@next -f -S",
"preversion": "npm test",
"postversion": "git push && git push --tags",
"sample": "npm run compile && node ./lib/umd/example/sample.js"
}
}

@@ -7,3 +7,3 @@ # vscode-json-languageservice

[![NPM Downloads](https://img.shields.io/npm/dm/vscode-json-languageservice.svg)](https://npmjs.org/package/vscode-json-languageservice)
[![Build Status](https://travis-ci.org/Microsoft/vscode-json-languageservice.svg?branch=master)](https://travis-ci.org/Microsoft/vscode-json-languageservice)
[![Build Status](https://github.com/microsoft/vscode-json-languageservice/actions/workflows/node.js.yml/badge.svg)](https://github.com/microsoft/vscode-json-languageservice/actions)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

@@ -10,0 +10,0 @@

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc