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

monaco-json

Package Overview
Dependencies
Maintainers
7
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

monaco-json - npm Package Compare versions

Comparing version 2.7.0 to 2.8.0

release/esm/_deps/vscode-languageserver-textdocument/lib/esm/main.js

15

package.json
{
"name": "monaco-json",
"version": "2.7.0",
"version": "2.8.0",
"description": "JSON plugin for the Monaco Editor",

@@ -22,12 +22,11 @@ "scripts": {

"devDependencies": {
"jsonc-parser": "^2.1.1",
"monaco-editor-core": "0.18.1",
"monaco-languages": "1.8.0",
"jsonc-parser": "^2.2.0",
"monaco-editor-core": "0.19.0",
"monaco-languages": "1.9.0",
"monaco-plugin-helpers": "^1.0.2",
"requirejs": "^2.3.6",
"typescript": "3.5.3",
"terser": "^4.3.1",
"vscode-json-languageservice": "3.3.3",
"vscode-languageserver-types": "3.14.0"
"typescript": "3.7.3",
"terser": "^4.4.3",
"vscode-json-languageservice": "3.4.11"
}
}

@@ -72,3 +72,4 @@ define('vs/language/json/monaco.contribution',["require", "exports"], function (require, exports) {

foldingRanges: true,
diagnostics: true
diagnostics: true,
selectionRanges: true
};

@@ -75,0 +76,0 @@ var jsonDefaults = new LanguageServiceDefaultsImpl('json', diagnosticDefault, modeConfigurationDefault);

@@ -169,2 +169,1 @@ /*---------------------------------------------------------------------------------------------

}
//# sourceMappingURL=edit.js.map

@@ -195,2 +195,1 @@ /*---------------------------------------------------------------------------------------------

}
//# sourceMappingURL=format.js.map

@@ -19,3 +19,3 @@ /*---------------------------------------------------------------------------------------------

var earlyReturnException = new Object();
var previousNode = void 0;
var previousNode = undefined;
var previousNodeInst = {

@@ -26,3 +26,3 @@ value: {},

type: 'object',
parent: void 0
parent: undefined
};

@@ -35,3 +35,3 @@ var isAtPropertyKey = false;

previousNodeInst.type = type;
previousNodeInst.colonOffset = void 0;
previousNodeInst.colonOffset = undefined;
previousNode = previousNodeInst;

@@ -45,3 +45,3 @@ }

}
previousNode = void 0;
previousNode = undefined;
isAtPropertyKey = position > offset;

@@ -64,3 +64,3 @@ segments.push(''); // push a placeholder (will be replaced)

}
previousNode = void 0;
previousNode = undefined;
segments.pop();

@@ -72,3 +72,3 @@ },

}
previousNode = void 0;
previousNode = undefined;
segments.push(0);

@@ -80,3 +80,3 @@ },

}
previousNode = void 0;
previousNode = undefined;
segments.pop();

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

}
setPreviousNode(value, offset, length, getLiteralNodeType(value));
setPreviousNode(value, offset, length, getNodeType(value));
if (position <= offset + length) {

@@ -101,3 +101,3 @@ throw earlyReturnException;

isAtPropertyKey = false;
previousNode = void 0;
previousNode = undefined;
}

@@ -113,3 +113,3 @@ else if (sep === ',') {

}
previousNode = void 0;
previousNode = undefined;
}

@@ -156,3 +156,3 @@ }

}
else if (currentProperty) {
else if (currentProperty !== null) {
currentParent[currentProperty] = value;

@@ -199,3 +199,3 @@ }

if (options === void 0) { options = ParseOptions.DEFAULT; }
var currentParent = { type: 'array', offset: -1, length: -1, children: [], parent: void 0 }; // artificial root
var currentParent = { type: 'array', offset: -1, length: -1, children: [], parent: undefined }; // artificial root
function ensurePropertyComplete(endOffset) {

@@ -233,3 +233,3 @@ if (currentParent.type === 'property') {

onLiteralValue: function (value, offset, length) {
onValue({ type: getLiteralNodeType(value), offset: offset, length: length, parent: currentParent, value: value });
onValue({ type: getNodeType(value), offset: offset, length: length, parent: currentParent, value: value });
ensurePropertyComplete(offset + length);

@@ -263,3 +263,3 @@ },

if (!root) {
return void 0;
return undefined;
}

@@ -271,3 +271,3 @@ var node = root;

if (node.type !== 'object' || !Array.isArray(node.children)) {
return void 0;
return undefined;
}

@@ -284,3 +284,3 @@ var found = false;

if (!found) {
return void 0;
return undefined;
}

@@ -291,3 +291,3 @@ }

if (node.type !== 'array' || index < 0 || !Array.isArray(node.children) || index >= node.children.length) {
return void 0;
return undefined;
}

@@ -342,3 +342,3 @@ node = node.children[index];

default:
return void 0;
return undefined;
}

@@ -367,3 +367,3 @@ }

}
return void 0;
return undefined;
}

@@ -587,3 +587,7 @@ /**

if (_scanner.getToken() === 17 /* EOF */) {
return true;
if (options.allowEmptyContent) {
return true;
}
handleError(4 /* ValueExpected */, [], []);
return false;
}

@@ -616,3 +620,3 @@ if (!parseValue()) {

}
if (replaceCh !== void 0) {
if (replaceCh !== undefined) {
parts.push(_scanner.getTokenValue().replace(/[^\r\n]/g, replaceCh));

@@ -626,3 +630,3 @@ }

}
function getLiteralNodeType(value) {
export function getNodeType(value) {
switch (typeof value) {

@@ -632,5 +636,13 @@ case 'boolean': return 'boolean';

case 'string': return 'string';
case 'object': {
if (!value) {
return 'null';
}
else if (Array.isArray(value)) {
return 'array';
}
return 'object';
}
default: return 'null';
}
}
//# sourceMappingURL=parser.js.map

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

if (ignoreTrivia === void 0) { ignoreTrivia = false; }
var pos = 0, len = text.length, value = '', tokenOffset = 0, token = 16 /* Unknown */, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0 /* None */;
var len = text.length;
var pos = 0, value = '', tokenOffset = 0, token = 16 /* Unknown */, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0 /* None */;
function scanHexDigits(count, exact) {

@@ -110,4 +111,4 @@ var digits = 0;

}
ch = text.charCodeAt(pos++);
switch (ch) {
var ch2 = text.charCodeAt(pos++);
switch (ch2) {
case 34 /* doubleQuote */:

@@ -138,5 +139,5 @@ result += '\"';

case 117 /* u */:
var ch_1 = scanHexDigits(4, true);
if (ch_1 >= 0) {
result += String.fromCharCode(ch_1);
var ch3 = scanHexDigits(4, true);
if (ch3 >= 0) {
result += String.fromCharCode(ch3);
}

@@ -366,2 +367,1 @@ else {

}
//# sourceMappingURL=scanner.js.map

@@ -117,2 +117,1 @@ /*---------------------------------------------------------------------------------------------

}
//# sourceMappingURL=main.js.map

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

*--------------------------------------------------------------------------------------------*/
import { TextDocument, Position, CompletionItem, CompletionList, Hover, Range, SymbolInformation, Diagnostic, TextEdit, FormattingOptions, MarkedString } from './_deps/vscode-languageserver-types/main';
import { JSONCompletion } from './services/jsonCompletion';

@@ -16,5 +15,5 @@ import { JSONHover } from './services/jsonHover';

import { getSelectionRanges } from './services/jsonSelectionRanges';
import { format as formatJSON } from '../jsonc-parser/main';
import { format as formatJSON } from './../jsonc-parser/main';
import { Range, TextEdit } from './jsonLanguageTypes';
export * from './jsonLanguageTypes';
export { TextDocument, Position, CompletionItem, CompletionList, Hover, Range, SymbolInformation, Diagnostic, TextEdit, FormattingOptions, MarkedString };
export function getLanguageService(params) {

@@ -21,0 +20,0 @@ var promise = params.promiseConstructor || Promise;

@@ -1,3 +0,4 @@

import { Range, TextEdit, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, MarkupKind, SelectionRange } from './_deps/vscode-languageserver-types/main';
export { Range, TextEdit, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, SelectionRange };
import { MarkupKind } from './../vscode-languageserver-types/main';
export { TextDocument } from './../vscode-languageserver-textdocument/lib/esm/main';
export * from './../vscode-languageserver-types/main';
/**

@@ -33,3 +34,4 @@ * Error codes used by diagnostics

completionItem: {
documentationFormat: [MarkupKind.Markdown, MarkupKind.PlainText]
documentationFormat: [MarkupKind.Markdown, MarkupKind.PlainText],
commitCharactersSupport: true
}

@@ -36,0 +38,0 @@ }

@@ -18,7 +18,6 @@ /*---------------------------------------------------------------------------------------------

})();
import * as Json from '../../jsonc-parser/main';
import * as Json from './../../jsonc-parser/main';
import { isNumber, equals, isBoolean, isString, isDefined } from '../utils/objects';
import { ErrorCode } from '../jsonLanguageTypes';
import * as nls from '../../../fillers/vscode-nls';
import { Diagnostic, DiagnosticSeverity, Range } from '../_deps/vscode-languageserver-types/main';
import { ErrorCode, Diagnostic, DiagnosticSeverity, Range } from '../jsonLanguageTypes';
import * as nls from './../../../fillers/vscode-nls';
var localize = nls.loadMessageBundle();

@@ -25,0 +24,0 @@ var formats = {

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

*--------------------------------------------------------------------------------------------*/
import * as nls from '../../../fillers/vscode-nls';
import * as nls from './../../../fillers/vscode-nls';
var localize = nls.loadMessageBundle();

@@ -8,0 +8,0 @@ export var schemaContributions = {

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

import * as Parser from '../parser/jsonParser';
import * as Json from '../../jsonc-parser/main';
import * as Json from './../../jsonc-parser/main';
import { stringifyObject } from '../utils/json';
import { endsWith } from '../utils/strings';
import { isDefined } from '../utils/objects';
import { CompletionItem, CompletionItemKind, Range, TextEdit, InsertTextFormat, MarkupKind } from '../_deps/vscode-languageserver-types/main';
import * as nls from '../../../fillers/vscode-nls';
import { CompletionItem, CompletionItemKind, Range, TextEdit, InsertTextFormat, MarkupKind } from '../jsonLanguageTypes';
import * as nls from './../../../fillers/vscode-nls';
var localize = nls.loadMessageBundle();
var valueCommitCharacters = [',', '}', ']'];
var propertyCommitCharacters = [':'];
var JSONCompletion = /** @class */ (function () {

@@ -42,2 +44,3 @@ function JSONCompletion(schemaService, contributions, promiseConstructor, clientCapabilities) {

};
var text = document.getText();
var offset = document.offsetAt(position);

@@ -48,2 +51,9 @@ var node = doc.getNodeFromOffset(offset, true);

}
if (node && (offset === node.offset + node.length) && offset > 0) {
var ch = text[offset - 1];
if (node.type === 'object' && ch === '}' || node.type === 'array' && ch === ']') {
// after ] or }
node = node.parent;
}
}
var currentWord = this.getCurrentWord(document, offset);

@@ -56,3 +66,3 @@ var overwriteRange = null;

var overwriteStart = offset - currentWord.length;
if (overwriteStart > 0 && document.getText()[overwriteStart - 1] === '"') {
if (overwriteStart > 0 && text[overwriteStart - 1] === '"') {
overwriteStart--;

@@ -62,11 +72,24 @@ }

}
var supportsCommitCharacters = false; //this.doesSupportsCommitCharacters(); disabled for now, waiting for new API: https://github.com/microsoft/vscode/issues/42544
var proposed = {};
var collector = {
add: function (suggestion) {
var existing = proposed[suggestion.label];
var label = suggestion.label;
var existing = proposed[label];
if (!existing) {
proposed[suggestion.label] = suggestion;
label = label.replace(/[\n]/g, '↵');
if (label.length > 60) {
var shortendedLabel = label.substr(0, 57).trim() + '...';
if (!proposed[shortendedLabel]) {
label = shortendedLabel;
}
}
if (overwriteRange) {
suggestion.textEdit = TextEdit.replace(overwriteRange, suggestion.insertText);
}
if (supportsCommitCharacters) {
suggestion.commitCharacters = suggestion.kind === CompletionItemKind.Property ? propertyCommitCharacters : valueCommitCharacters;
}
suggestion.label = label;
proposed[label] = suggestion;
result.items.push(suggestion);

@@ -102,3 +125,3 @@ }

currentProperty = parent;
currentKey = document.getText().substr(node.offset + 1, node.length - 2);
currentKey = text.substr(node.offset + 1, node.length - 2);
if (parent) {

@@ -142,3 +165,3 @@ node = parent.parent;

});
if ((!schema && currentWord.length > 0 && document.getText().charAt(offset - currentWord.length - 1) !== '"')) {
if ((!schema && currentWord.length > 0 && text.charAt(offset - currentWord.length - 1) !== '"')) {
collector.add({

@@ -191,3 +214,3 @@ kind: CompletionItemKind.Property,

kind: CompletionItemKind.Property,
label: _this.sanitizeLabel(key),
label: key,
insertText: _this.getInsertTextForProperty(key, propertySchema, addValue, separatorAfter),

@@ -218,3 +241,3 @@ insertTextFormat: InsertTextFormat.Snippet,

kind: CompletionItemKind.Property,
label: _this.sanitizeLabel(key),
label: key,
insertText: _this.getInsertTextForValue(key, ''),

@@ -497,3 +520,3 @@ insertTextFormat: InsertTextFormat.Snippet,

insertText = prefix + indent + s.bodyText.split('\n').join('\n' + indent) + suffix + separatorAfter;
label = label || _this.sanitizeLabel(insertText),
label = label || insertText,
filterText = insertText.replace(/[\n]/g, ''); // remove new lines

@@ -609,11 +632,4 @@ }

};
JSONCompletion.prototype.sanitizeLabel = function (label) {
label = label.replace(/[\n]/g, '↵');
if (label.length > 57) {
label = label.substr(0, 57).trim() + '...';
}
return label;
};
JSONCompletion.prototype.getLabelForValue = function (value) {
return this.sanitizeLabel(JSON.stringify(value));
return JSON.stringify(value);
};

@@ -628,4 +644,3 @@ JSONCompletion.prototype.getFilterTextForValue = function (value) {

var label = JSON.stringify(value);
label = label.replace(/\$\{\d+:([^}]+)\}|\$\d+/g, '$1');
return this.sanitizeLabel(label);
return label.replace(/\$\{\d+:([^}]+)\}|\$\d+/g, '$1');
};

@@ -741,2 +756,8 @@ JSONCompletion.prototype.getInsertTextForPlainText = function (text) {

}
if (Array.isArray(propertySchema.examples) && propertySchema.examples.length) {
if (!value) {
value = this.getInsertTextForGuessedValue(propertySchema.examples[0], '');
}
nValueProposals += propertySchema.examples.length;
}
if (nValueProposals === 0) {

@@ -848,4 +869,11 @@ var type = Array.isArray(propertySchema.type) ? propertySchema.type[0] : propertySchema.type;

};
JSONCompletion.prototype.doesSupportsCommitCharacters = function () {
if (!isDefined(this.supportsCommitCharacters)) {
var completion = this.clientCapabilities.textDocument && this.clientCapabilities.textDocument.completion;
this.supportsCommitCharacters = completion && completion.completionItem && !!completion.completionItem.commitCharactersSupport;
}
return this.supportsCommitCharacters;
};
return JSONCompletion;
}());
export { JSONCompletion };

@@ -8,3 +8,3 @@ /*---------------------------------------------------------------------------------------------

import { colorFromHex } from '../utils/colors';
import { SymbolKind, Range, Location, TextEdit } from '../_deps/vscode-languageserver-types/main';
import { Range, TextEdit, SymbolKind, Location } from "../jsonLanguageTypes";
var JSONDocumentSymbols = /** @class */ (function () {

@@ -14,4 +14,5 @@ function JSONDocumentSymbols(schemaService) {

}
JSONDocumentSymbols.prototype.findDocumentSymbols = function (document, doc) {
JSONDocumentSymbols.prototype.findDocumentSymbols = function (document, doc, context) {
var _this = this;
if (context === void 0) { context = { resultLimit: Number.MAX_VALUE }; }
var root = doc.root;

@@ -21,2 +22,3 @@ if (!root) {

}
var limit = context.resultLimit;
// special handling for key bindings

@@ -27,13 +29,16 @@ var resourceString = document.uri;

var result_1 = [];
root.items.forEach(function (item) {
for (var _i = 0, _a = root.items; _i < _a.length; _i++) {
var item = _a[_i];
if (item.type === 'object') {
for (var _i = 0, _a = item.properties; _i < _a.length; _i++) {
var property = _a[_i];
if (property.keyNode.value === 'key') {
if (property.valueNode) {
if (property.valueNode) {
var location = Location.create(document.uri, getRange(document, item));
result_1.push({ name: Parser.getNodeValue(property.valueNode), kind: SymbolKind.Function, location: location });
for (var _b = 0, _c = item.properties; _b < _c.length; _b++) {
var property = _c[_b];
if (property.keyNode.value === 'key' && property.valueNode) {
var location = Location.create(document.uri, getRange(document, item));
result_1.push({ name: Parser.getNodeValue(property.valueNode), kind: SymbolKind.Function, location: location });
limit--;
if (limit <= 0) {
if (context && context.onResultLimitExceeded) {
context.onResultLimitExceeded(resourceString);
}
return;
return result_1;
}

@@ -43,28 +48,51 @@ }

}
});
}
return result_1;
}
}
var collectOutlineEntries = function (result, node, containerName) {
var toVisit = [
{ node: root, containerName: '' }
];
var nextToVisit = 0;
var limitExceeded = false;
var result = [];
var collectOutlineEntries = function (node, containerName) {
if (node.type === 'array') {
node.items.forEach(function (node) { return collectOutlineEntries(result, node, containerName); });
node.items.forEach(function (node) {
if (node) {
toVisit.push({ node: node, containerName: containerName });
}
});
}
else if (node.type === 'object') {
node.properties.forEach(function (property) {
var location = Location.create(document.uri, getRange(document, property));
var valueNode = property.valueNode;
if (valueNode) {
var childContainerName = containerName ? containerName + '.' + property.keyNode.value : property.keyNode.value;
result.push({ name: _this.getKeyLabel(property), kind: _this.getSymbolKind(valueNode.type), location: location, containerName: containerName });
collectOutlineEntries(result, valueNode, childContainerName);
if (limit > 0) {
limit--;
var location = Location.create(document.uri, getRange(document, property));
var childContainerName = containerName ? containerName + '.' + property.keyNode.value : property.keyNode.value;
result.push({ name: _this.getKeyLabel(property), kind: _this.getSymbolKind(valueNode.type), location: location, containerName: containerName });
toVisit.push({ node: valueNode, containerName: childContainerName });
}
else {
limitExceeded = true;
}
}
});
}
return result;
};
var result = collectOutlineEntries([], root, void 0);
// breath first traversal
while (nextToVisit < toVisit.length) {
var next = toVisit[nextToVisit++];
collectOutlineEntries(next.node, next.containerName);
}
if (limitExceeded && context && context.onResultLimitExceeded) {
context.onResultLimitExceeded(resourceString);
}
return result;
};
JSONDocumentSymbols.prototype.findDocumentSymbols2 = function (document, doc) {
JSONDocumentSymbols.prototype.findDocumentSymbols2 = function (document, doc, context) {
var _this = this;
if (context === void 0) { context = { resultLimit: Number.MAX_VALUE }; }
var root = doc.root;

@@ -74,2 +102,3 @@ if (!root) {

}
var limit = context.resultLimit;
// special handling for key bindings

@@ -80,29 +109,47 @@ var resourceString = document.uri;

var result_2 = [];
root.items.forEach(function (item) {
for (var _i = 0, _a = root.items; _i < _a.length; _i++) {
var item = _a[_i];
if (item.type === 'object') {
for (var _i = 0, _a = item.properties; _i < _a.length; _i++) {
var property = _a[_i];
if (property.keyNode.value === 'key') {
if (property.valueNode) {
var range = getRange(document, item);
var selectionRange = getRange(document, property.keyNode);
result_2.push({ name: Parser.getNodeValue(property.valueNode), kind: SymbolKind.Function, range: range, selectionRange: selectionRange });
for (var _b = 0, _c = item.properties; _b < _c.length; _b++) {
var property = _c[_b];
if (property.keyNode.value === 'key' && property.valueNode) {
var range = getRange(document, item);
var selectionRange = getRange(document, property.keyNode);
result_2.push({ name: Parser.getNodeValue(property.valueNode), kind: SymbolKind.Function, range: range, selectionRange: selectionRange });
limit--;
if (limit <= 0) {
if (context && context.onResultLimitExceeded) {
context.onResultLimitExceeded(resourceString);
}
return result_2;
}
return;
}
}
}
});
}
return result_2;
}
}
var collectOutlineEntries = function (result, node) {
var result = [];
var toVisit = [
{ node: root, result: result }
];
var nextToVisit = 0;
var limitExceeded = false;
var collectOutlineEntries = function (node, result) {
if (node.type === 'array') {
node.items.forEach(function (node, index) {
if (node) {
var range = getRange(document, node);
var selectionRange = range;
var name = String(index);
var children = collectOutlineEntries([], node);
result.push({ name: name, kind: _this.getSymbolKind(node.type), range: range, selectionRange: selectionRange, children: children });
if (limit > 0) {
limit--;
var range = getRange(document, node);
var selectionRange = range;
var name = String(index);
var symbol = { name: name, kind: _this.getSymbolKind(node.type), range: range, selectionRange: selectionRange, children: [] };
result.push(symbol);
toVisit.push({ result: symbol.children, node: node });
}
else {
limitExceeded = true;
}
}

@@ -115,12 +162,25 @@ });

if (valueNode) {
var range = getRange(document, property);
var selectionRange = getRange(document, property.keyNode);
var children = collectOutlineEntries([], valueNode);
result.push({ name: _this.getKeyLabel(property), kind: _this.getSymbolKind(valueNode.type), range: range, selectionRange: selectionRange, children: children });
if (limit > 0) {
limit--;
var range = getRange(document, property);
var selectionRange = getRange(document, property.keyNode);
var symbol = { name: _this.getKeyLabel(property), kind: _this.getSymbolKind(valueNode.type), range: range, selectionRange: selectionRange, children: [] };
result.push(symbol);
toVisit.push({ result: symbol.children, node: valueNode });
}
else {
limitExceeded = true;
}
}
});
}
return result;
};
var result = collectOutlineEntries([], root);
// breath first traversal
while (nextToVisit < toVisit.length) {
var next = toVisit[nextToVisit++];
collectOutlineEntries(next.node, next.result);
}
if (limitExceeded && context && context.onResultLimitExceeded) {
context.onResultLimitExceeded(resourceString);
}
return result;

@@ -154,6 +214,7 @@ };

};
JSONDocumentSymbols.prototype.findDocumentColors = function (document, doc) {
JSONDocumentSymbols.prototype.findDocumentColors = function (document, doc, context) {
return this.schemaService.getSchemaForResource(document.uri, doc).then(function (schema) {
var result = [];
if (schema) {
var limit = context && typeof context.resultLimit === 'number' ? context.resultLimit : Number.MAX_VALUE;
var matchingSchemas = doc.getMatchingSchemas(schema.schema);

@@ -172,2 +233,9 @@ var visitedNode = {};

visitedNode[nodeId] = true;
limit--;
if (limit <= 0) {
if (context && context.onResultLimitExceeded) {
context.onResultLimitExceeded(document.uri);
}
return result;
}
}

@@ -174,0 +242,0 @@ }

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

*--------------------------------------------------------------------------------------------*/
import { Position } from '../_deps/vscode-languageserver-types/main';
import { createScanner } from '../../jsonc-parser/main';
import { FoldingRangeKind } from '../jsonLanguageTypes';
import { createScanner } from './../../jsonc-parser/main';
import { FoldingRangeKind, Position } from '../jsonLanguageTypes';
export function getFoldingRanges(document, context) {

@@ -91,2 +90,5 @@ var ranges = [];

}
if (context && context.onRangeLimitExceeded) {
context.onRangeLimitExceeded(document.uri);
}
var counts = [];

@@ -93,0 +95,0 @@ for (var _i = 0, nestingLevels_1 = nestingLevels; _i < nestingLevels_1.length; _i++) {

@@ -6,3 +6,3 @@ /*---------------------------------------------------------------------------------------------

import * as Parser from '../parser/jsonParser';
import { Range } from '../_deps/vscode-languageserver-types/main';
import { Range } from '../jsonLanguageTypes';
var JSONHover = /** @class */ (function () {

@@ -9,0 +9,0 @@ function JSONHover(schemaService, contributions, promiseConstructor) {

@@ -5,7 +5,7 @@ /*---------------------------------------------------------------------------------------------

*--------------------------------------------------------------------------------------------*/
import * as Json from '../../jsonc-parser/main';
import { URI } from '../../vscode-uri/index';
import * as Json from './../../jsonc-parser/main';
import { URI } from './../../vscode-uri/index';
import * as Strings from '../utils/strings';
import * as Parser from '../parser/jsonParser';
import * as nls from '../../../fillers/vscode-nls';
import * as nls from './../../../fillers/vscode-nls';
var localize = nls.loadMessageBundle();

@@ -280,3 +280,6 @@ var FilePatternAssociation = /** @class */ (function () {

}
return new UnresolvedSchema({}, [errorMessage]);
if (Strings.endsWith(errorMessage, '.')) {
errorMessage = errorMessage.substr(0, errorMessage.length - 1);
}
return new UnresolvedSchema({}, [localize('json.schema.nocontent', 'Unable to load schema from \'{0}\': {1}.', toDisplayString(url), errorMessage)]);
});

@@ -288,2 +291,11 @@ };

var schema = schemaToResolve.schema;
if (schema.$schema) {
var id = this.normalizeId(schema.$schema);
if (id === 'http://json-schema.org/draft-03/schema') {
return this.promise.resolve(new ResolvedSchema({}, [localize('json.schema.draft03.notsupported', "Draft-03 schemas are not supported.")]));
}
else if (id === 'https://json-schema.org/draft/2019-09/schema') {
schemaToResolve.errors.push(localize('json.schema.draft201909.notsupported', "Draft 2019-09 schemas are not yet fully supported."));
}
}
var contextService = this.contextService;

@@ -290,0 +302,0 @@ var findSection = function (schema, path) {

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

*--------------------------------------------------------------------------------------------*/
import { Range, SelectionRange } from '../_deps/vscode-languageserver-types/main';
import { createScanner } from '../../jsonc-parser/main';
import { Range, SelectionRange } from '../jsonLanguageTypes';
import { createScanner } from './../../jsonc-parser/main';
export function getSelectionRanges(document, positions, doc) {

@@ -9,0 +9,0 @@ function getSelectionRange(position) {

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

import { UnresolvedSchema } from './jsonSchemaService';
import { Diagnostic, DiagnosticSeverity, Range } from '../_deps/vscode-languageserver-types/main';
import { ErrorCode } from '../jsonLanguageTypes';
import * as nls from '../../../fillers/vscode-nls';
import { ErrorCode, Diagnostic, DiagnosticSeverity, Range } from '../jsonLanguageTypes';
import * as nls from './../../../fillers/vscode-nls';
import { isBoolean } from '../utils/objects';

@@ -120,5 +119,8 @@ var localize = nls.loadMessageBundle();

if (schemaRef && typeof schemaRef === 'object') {
if (isBoolean(schemaRef.allowsTrailingCommas)) {
return schemaRef.allowsTrailingCommas;
if (isBoolean(schemaRef.allowTrailingCommas)) {
return schemaRef.allowTrailingCommas;
}
if (isBoolean(schemaRef['allowsTrailingCommas'])) { // deprecated
return schemaRef['allowsTrailingCommas'];
}
if (schemaRef.allOf) {

@@ -125,0 +127,0 @@ for (var _i = 0, _a = schemaRef.allOf; _i < _a.length; _i++) {

@@ -296,2 +296,23 @@ /* --------------------------------------------------------------------------------------------

/**
* The diagnostic tags.
*
* @since 3.15.0
*/
export var DiagnosticTag;
(function (DiagnosticTag) {
/**
* Unused or unnecessary code.
*
* Clients are allowed to render diagnostics with this tag faded out instead of having
* an error squiggle.
*/
DiagnosticTag.Unnecessary = 1;
/**
* Deprecated or obsolete code.
*
* Clients are allowed to rendered diagnostics with this tag strike through.
*/
DiagnosticTag.Deprecated = 2;
})(DiagnosticTag || (DiagnosticTag = {}));
/**
* The Diagnostic namespace provides helper functions to work with

@@ -798,2 +819,15 @@ * [Diagnostic](#Diagnostic) literals.

/**
* Completion item tags are extra annotations that tweak the rendering of a completion
* item.
*
* @since 3.15.0
*/
export var CompletionItemTag;
(function (CompletionItemTag) {
/**
* Render a completion as obsolete, usually using a strike-out.
*/
CompletionItemTag.Deprecated = 1;
})(CompletionItemTag || (CompletionItemTag = {}));
/**
* The CompletionItem namespace provides functions to deal with

@@ -838,3 +872,3 @@ * completion items.

function fromPlainText(plainText) {
return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, "\\$&"); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
return plainText.replace(/[\\`*_{}[\]()#+\-.!]/g, '\\$&'); // escape markdown syntax tokens: http://daringfireball.net/projects/markdown/syntax#backslash
}

@@ -880,3 +914,2 @@ MarkedString.fromPlainText = fromPlainText;

ParameterInformation.create = create;
;
})(ParameterInformation || (ParameterInformation = {}));

@@ -977,2 +1010,13 @@ /**

})(SymbolKind || (SymbolKind = {}));
/**
* Symbol tags are extra annotations that tweak the rendering of a symbol.
* @since 3.15
*/
export var SymbolTag;
(function (SymbolTag) {
/**
* Render a symbol as obsolete, usually using a strike-out.
*/
SymbolTag.Deprecated = 1;
})(SymbolTag || (SymbolTag = {}));
export var SymbolInformation;

@@ -1002,14 +1046,3 @@ (function (SymbolInformation) {

})(SymbolInformation || (SymbolInformation = {}));
/**
* Represents programming constructs like variables, classes, interfaces etc.
* that appear in a document. Document symbols can be hierarchical and they
* have two ranges: one that encloses its definition and one that points to
* its most interesting range, e.g. the range of an identifier.
*/
var DocumentSymbol = /** @class */ (function () {
function DocumentSymbol() {
}
return DocumentSymbol;
}());
export { DocumentSymbol };
export var DocumentSymbol;
(function (DocumentSymbol) {

@@ -1060,2 +1093,6 @@ /**

/**
* Empty kind.
*/
CodeActionKind.Empty = '';
/**
* Base kind for quickfix actions: 'quickfix'

@@ -1114,2 +1151,11 @@ */

CodeActionKind.SourceOrganizeImports = 'source.organizeImports';
/**
* Base kind for auto-fix source actions: `source.fixAll`.
*
* Fix all actions automatically fix errors that have a clear fix that do not require user input.
* They should not suppress errors or perform unsafe fixes such as generating new types or classes.
*
* @since 3.15.0
*/
CodeActionKind.SourceFixAll = 'source.fixAll';
})(CodeActionKind || (CodeActionKind = {}));

@@ -1152,3 +1198,3 @@ /**

}
if (kind !== void null) {
if (kind !== void 0) {
result.kind = kind;

@@ -1166,2 +1212,3 @@ }

(candidate.command === void 0 || Command.is(candidate.command)) &&
(candidate.isPreferred === void 0 || Is.boolean(candidate.isPreferred)) &&
(candidate.edit === void 0 || WorkspaceEdit.is(candidate.edit));

@@ -1182,4 +1229,5 @@ }

var result = { range: range };
if (Is.defined(data))
if (Is.defined(data)) {
result.data = data;
}
return result;

@@ -1220,15 +1268,6 @@ }

/**
* A document link is a range in a text document that links to an internal or external resource, like another
* text document or a web site.
*/
var DocumentLink = /** @class */ (function () {
function DocumentLink() {
}
return DocumentLink;
}());
export { DocumentLink };
/**
* The DocumentLink namespace provides helper functions to work with
* [DocumentLink](#DocumentLink) literals.
*/
export var DocumentLink;
(function (DocumentLink) {

@@ -1251,3 +1290,27 @@ /**

})(DocumentLink || (DocumentLink = {}));
/**
* The SelectionRange namespace provides helper function to work with
* SelectionRange literals.
*/
export var SelectionRange;
(function (SelectionRange) {
/**
* Creates a new SelectionRange
* @param range the range.
* @param parent an optional parent.
*/
function create(range, parent) {
return { range: range, parent: parent };
}
SelectionRange.create = create;
function is(value) {
var candidate = value;
return candidate !== undefined && Range.is(candidate.range) && (candidate.parent === undefined || SelectionRange.is(candidate.parent));
}
SelectionRange.is = is;
})(SelectionRange || (SelectionRange = {}));
export var EOL = ['\n', '\r\n', '\r'];
/**
* @deprecated Use the text document from the new vscode-languageserver-textdocument package.
*/
export var TextDocument;

@@ -1332,21 +1395,2 @@ (function (TextDocument) {

})(TextDocument || (TextDocument = {}));
/**
* Represents reasons why a text document is saved.
*/
export var TextDocumentSaveReason;
(function (TextDocumentSaveReason) {
/**
* Manually triggered, e.g. by the user pressing save, by starting debugging,
* or by an API call.
*/
TextDocumentSaveReason.Manual = 1;
/**
* Automatic after a delay.
*/
TextDocumentSaveReason.AfterDelay = 2;
/**
* When the editor lost focus.
*/
TextDocumentSaveReason.FocusOut = 3;
})(TextDocumentSaveReason || (TextDocumentSaveReason = {}));
var FullTextDocument = /** @class */ (function () {

@@ -1358,3 +1402,3 @@ function FullTextDocument(uri, languageId, version, content) {

this._content = content;
this._lineOffsets = null;
this._lineOffsets = undefined;
}

@@ -1393,6 +1437,6 @@ Object.defineProperty(FullTextDocument.prototype, "uri", {

this._version = version;
this._lineOffsets = null;
this._lineOffsets = undefined;
};
FullTextDocument.prototype.getLineOffsets = function () {
if (this._lineOffsets === null) {
if (this._lineOffsets === undefined) {
var lineOffsets = [];

@@ -1399,0 +1443,0 @@ var text = this._content;

@@ -7,5 +7,8 @@ /*---------------------------------------------------------------------------------------------

var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {

@@ -17,2 +20,3 @@ extendStatics(d, b);

})();
var _a;
var isWindows;

@@ -26,2 +30,20 @@ if (typeof process === 'object') {

}
function isHighSurrogate(charCode) {
return (0xD800 <= charCode && charCode <= 0xDBFF);
}
function isLowSurrogate(charCode) {
return (0xDC00 <= charCode && charCode <= 0xDFFF);
}
function isLowerAsciiHex(code) {
return code >= 97 /* a */ && code <= 102 /* f */;
}
function isLowerAsciiLetter(code) {
return code >= 97 /* a */ && code <= 122 /* z */;
}
function isUpperAsciiLetter(code) {
return code >= 65 /* A */ && code <= 90 /* Z */;
}
function isAsciiLetter(code) {
return isLowerAsciiLetter(code) || isUpperAsciiLetter(code);
}
//#endregion

@@ -31,20 +53,6 @@ var _schemePattern = /^\w[\w\d+.-]*$/;

var _doubleSlashStart = /^\/\//;
var _throwOnMissingSchema = true;
/**
* @internal
*/
export function setUriThrowOnMissingScheme(value) {
var old = _throwOnMissingSchema;
_throwOnMissingSchema = value;
return old;
}
function _validateUri(ret, _strict) {
// scheme, must be set
if (!ret.scheme) {
if (_strict || _throwOnMissingSchema) {
throw new Error("[UriError]: Scheme is missing: {scheme: \"\", authority: \"" + ret.authority + "\", path: \"" + ret.path + "\", query: \"" + ret.query + "\", fragment: \"" + ret.fragment + "\"}");
}
else {
// console.warn(`[UriError]: Scheme is missing: {scheme: "", authority: "${ret.authority}", path: "${ret.path}", query: "${ret.query}", fragment: "${ret.fragment}"}`);
}
if (!ret.scheme && _strict) {
throw new Error("[UriError]: Scheme is missing: {scheme: \"\", authority: \"" + ret.authority + "\", path: \"" + ret.path + "\", query: \"" + ret.query + "\", fragment: \"" + ret.fragment + "\"}");
}

@@ -79,9 +87,5 @@ // scheme, https://tools.ietf.org/html/rfc3986#section-3.1

function _schemeFix(scheme, _strict) {
if (_strict || _throwOnMissingSchema) {
return scheme || _empty;
if (!scheme && !_strict) {
return 'file';
}
if (!scheme) {
// console.trace('BAD uri lacks scheme, falling back to file-scheme.');
scheme = 'file';
}
return scheme;

@@ -126,3 +130,3 @@ }

*/
var URI = (function () {
var URI = /** @class */ (function () {
/**

@@ -348,3 +352,3 @@ * @internal

// tslint:disable-next-line:class-name
var _URI = (function (_super) {
var _URI = /** @class */ (function (_super) {
__extends(_URI, _super);

@@ -600,2 +604,1 @@ function _URI() {

}
var _a;

@@ -0,0 +0,0 @@ /*---------------------------------------------------------------------------------------------

@@ -0,0 +0,0 @@ /*---------------------------------------------------------------------------------------------

@@ -51,2 +51,5 @@ /*---------------------------------------------------------------------------------------------

}
if (modeConfiguration.selectionRanges) {
providers.push(monaco.languages.registerSelectionRangeProvider(languageId, new languageFeatures.SelectionRangeAdapter(worker)));
}
}

@@ -53,0 +56,0 @@ registerProviders();

@@ -7,3 +7,2 @@ /*---------------------------------------------------------------------------------------------

import * as jsonService from './_deps/vscode-json-languageservice/jsonLanguageService';
import * as ls from './_deps/vscode-languageserver-types/main';
var defaultSchemaRequestService;

@@ -83,4 +82,4 @@ if (typeof fetch !== 'undefined') {

var document = this._getTextDocument(uri);
var stylesheet = this._languageService.parseJSONDocument(document);
var colorSymbols = this._languageService.findDocumentColors(document, stylesheet);
var jsonDocument = this._languageService.parseJSONDocument(document);
var colorSymbols = this._languageService.findDocumentColors(document, jsonDocument);
return Promise.resolve(colorSymbols);

@@ -90,7 +89,7 @@ };

var document = this._getTextDocument(uri);
var stylesheet = this._languageService.parseJSONDocument(document);
var colorPresentations = this._languageService.getColorPresentations(document, stylesheet, color, range);
var jsonDocument = this._languageService.parseJSONDocument(document);
var colorPresentations = this._languageService.getColorPresentations(document, jsonDocument, color, range);
return Promise.resolve(colorPresentations);
};
JSONWorker.prototype.provideFoldingRanges = function (uri, context) {
JSONWorker.prototype.getFoldingRanges = function (uri, context) {
var document = this._getTextDocument(uri);

@@ -100,2 +99,8 @@ var ranges = this._languageService.getFoldingRanges(document, context);

};
JSONWorker.prototype.getSelectionRanges = function (uri, positions) {
var document = this._getTextDocument(uri);
var jsonDocument = this._languageService.parseJSONDocument(document);
var ranges = this._languageService.getSelectionRanges(document, positions, jsonDocument);
return Promise.resolve(ranges);
};
JSONWorker.prototype._getTextDocument = function (uri) {

@@ -106,3 +111,3 @@ var models = this._ctx.getMirrorModels();

if (model.uri.toString() === uri) {
return ls.TextDocument.create(uri, this._languageId, model.version, model.getValue());
return jsonService.TextDocument.create(uri, this._languageId, model.version, model.getValue());
}

@@ -109,0 +114,0 @@ }

@@ -6,3 +6,3 @@ /*---------------------------------------------------------------------------------------------

'use strict';
import * as ls from './_deps/vscode-languageserver-types/main';
import * as jsonService from './_deps/vscode-json-languageservice/jsonLanguageService';
var Uri = monaco.Uri;

@@ -94,6 +94,6 @@ var Range = monaco.Range;

switch (lsSeverity) {
case ls.DiagnosticSeverity.Error: return monaco.MarkerSeverity.Error;
case ls.DiagnosticSeverity.Warning: return monaco.MarkerSeverity.Warning;
case ls.DiagnosticSeverity.Information: return monaco.MarkerSeverity.Info;
case ls.DiagnosticSeverity.Hint: return monaco.MarkerSeverity.Hint;
case jsonService.DiagnosticSeverity.Error: return monaco.MarkerSeverity.Error;
case jsonService.DiagnosticSeverity.Warning: return monaco.MarkerSeverity.Warning;
case jsonService.DiagnosticSeverity.Information: return monaco.MarkerSeverity.Info;
case jsonService.DiagnosticSeverity.Hint: return monaco.MarkerSeverity.Hint;
default:

@@ -138,20 +138,20 @@ return monaco.MarkerSeverity.Info;

switch (kind) {
case ls.CompletionItemKind.Text: return mItemKind.Text;
case ls.CompletionItemKind.Method: return mItemKind.Method;
case ls.CompletionItemKind.Function: return mItemKind.Function;
case ls.CompletionItemKind.Constructor: return mItemKind.Constructor;
case ls.CompletionItemKind.Field: return mItemKind.Field;
case ls.CompletionItemKind.Variable: return mItemKind.Variable;
case ls.CompletionItemKind.Class: return mItemKind.Class;
case ls.CompletionItemKind.Interface: return mItemKind.Interface;
case ls.CompletionItemKind.Module: return mItemKind.Module;
case ls.CompletionItemKind.Property: return mItemKind.Property;
case ls.CompletionItemKind.Unit: return mItemKind.Unit;
case ls.CompletionItemKind.Value: return mItemKind.Value;
case ls.CompletionItemKind.Enum: return mItemKind.Enum;
case ls.CompletionItemKind.Keyword: return mItemKind.Keyword;
case ls.CompletionItemKind.Snippet: return mItemKind.Snippet;
case ls.CompletionItemKind.Color: return mItemKind.Color;
case ls.CompletionItemKind.File: return mItemKind.File;
case ls.CompletionItemKind.Reference: return mItemKind.Reference;
case jsonService.CompletionItemKind.Text: return mItemKind.Text;
case jsonService.CompletionItemKind.Method: return mItemKind.Method;
case jsonService.CompletionItemKind.Function: return mItemKind.Function;
case jsonService.CompletionItemKind.Constructor: return mItemKind.Constructor;
case jsonService.CompletionItemKind.Field: return mItemKind.Field;
case jsonService.CompletionItemKind.Variable: return mItemKind.Variable;
case jsonService.CompletionItemKind.Class: return mItemKind.Class;
case jsonService.CompletionItemKind.Interface: return mItemKind.Interface;
case jsonService.CompletionItemKind.Module: return mItemKind.Module;
case jsonService.CompletionItemKind.Property: return mItemKind.Property;
case jsonService.CompletionItemKind.Unit: return mItemKind.Unit;
case jsonService.CompletionItemKind.Value: return mItemKind.Value;
case jsonService.CompletionItemKind.Enum: return mItemKind.Enum;
case jsonService.CompletionItemKind.Keyword: return mItemKind.Keyword;
case jsonService.CompletionItemKind.Snippet: return mItemKind.Snippet;
case jsonService.CompletionItemKind.Color: return mItemKind.Color;
case jsonService.CompletionItemKind.File: return mItemKind.File;
case jsonService.CompletionItemKind.Reference: return mItemKind.Reference;
}

@@ -163,22 +163,22 @@ return mItemKind.Property;

switch (kind) {
case mItemKind.Text: return ls.CompletionItemKind.Text;
case mItemKind.Method: return ls.CompletionItemKind.Method;
case mItemKind.Function: return ls.CompletionItemKind.Function;
case mItemKind.Constructor: return ls.CompletionItemKind.Constructor;
case mItemKind.Field: return ls.CompletionItemKind.Field;
case mItemKind.Variable: return ls.CompletionItemKind.Variable;
case mItemKind.Class: return ls.CompletionItemKind.Class;
case mItemKind.Interface: return ls.CompletionItemKind.Interface;
case mItemKind.Module: return ls.CompletionItemKind.Module;
case mItemKind.Property: return ls.CompletionItemKind.Property;
case mItemKind.Unit: return ls.CompletionItemKind.Unit;
case mItemKind.Value: return ls.CompletionItemKind.Value;
case mItemKind.Enum: return ls.CompletionItemKind.Enum;
case mItemKind.Keyword: return ls.CompletionItemKind.Keyword;
case mItemKind.Snippet: return ls.CompletionItemKind.Snippet;
case mItemKind.Color: return ls.CompletionItemKind.Color;
case mItemKind.File: return ls.CompletionItemKind.File;
case mItemKind.Reference: return ls.CompletionItemKind.Reference;
case mItemKind.Text: return jsonService.CompletionItemKind.Text;
case mItemKind.Method: return jsonService.CompletionItemKind.Method;
case mItemKind.Function: return jsonService.CompletionItemKind.Function;
case mItemKind.Constructor: return jsonService.CompletionItemKind.Constructor;
case mItemKind.Field: return jsonService.CompletionItemKind.Field;
case mItemKind.Variable: return jsonService.CompletionItemKind.Variable;
case mItemKind.Class: return jsonService.CompletionItemKind.Class;
case mItemKind.Interface: return jsonService.CompletionItemKind.Interface;
case mItemKind.Module: return jsonService.CompletionItemKind.Module;
case mItemKind.Property: return jsonService.CompletionItemKind.Property;
case mItemKind.Unit: return jsonService.CompletionItemKind.Unit;
case mItemKind.Value: return jsonService.CompletionItemKind.Value;
case mItemKind.Enum: return jsonService.CompletionItemKind.Enum;
case mItemKind.Keyword: return jsonService.CompletionItemKind.Keyword;
case mItemKind.Snippet: return jsonService.CompletionItemKind.Snippet;
case mItemKind.Color: return jsonService.CompletionItemKind.Color;
case mItemKind.File: return jsonService.CompletionItemKind.File;
case mItemKind.Reference: return jsonService.CompletionItemKind.Reference;
}
return ls.CompletionItemKind.Property;
return jsonService.CompletionItemKind.Property;
}

@@ -233,3 +233,3 @@ function toTextEdit(textEdit) {

}
if (entry.insertTextFormat === ls.InsertTextFormat.Snippet) {
if (entry.insertTextFormat === jsonService.InsertTextFormat.Snippet) {
item.insertTextRules = monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet;

@@ -311,20 +311,20 @@ }

switch (kind) {
case ls.SymbolKind.File: return mKind.Array;
case ls.SymbolKind.Module: return mKind.Module;
case ls.SymbolKind.Namespace: return mKind.Namespace;
case ls.SymbolKind.Package: return mKind.Package;
case ls.SymbolKind.Class: return mKind.Class;
case ls.SymbolKind.Method: return mKind.Method;
case ls.SymbolKind.Property: return mKind.Property;
case ls.SymbolKind.Field: return mKind.Field;
case ls.SymbolKind.Constructor: return mKind.Constructor;
case ls.SymbolKind.Enum: return mKind.Enum;
case ls.SymbolKind.Interface: return mKind.Interface;
case ls.SymbolKind.Function: return mKind.Function;
case ls.SymbolKind.Variable: return mKind.Variable;
case ls.SymbolKind.Constant: return mKind.Constant;
case ls.SymbolKind.String: return mKind.String;
case ls.SymbolKind.Number: return mKind.Number;
case ls.SymbolKind.Boolean: return mKind.Boolean;
case ls.SymbolKind.Array: return mKind.Array;
case jsonService.SymbolKind.File: return mKind.Array;
case jsonService.SymbolKind.Module: return mKind.Module;
case jsonService.SymbolKind.Namespace: return mKind.Namespace;
case jsonService.SymbolKind.Package: return mKind.Package;
case jsonService.SymbolKind.Class: return mKind.Class;
case jsonService.SymbolKind.Method: return mKind.Method;
case jsonService.SymbolKind.Property: return mKind.Property;
case jsonService.SymbolKind.Field: return mKind.Field;
case jsonService.SymbolKind.Constructor: return mKind.Constructor;
case jsonService.SymbolKind.Enum: return mKind.Enum;
case jsonService.SymbolKind.Interface: return mKind.Interface;
case jsonService.SymbolKind.Function: return mKind.Function;
case jsonService.SymbolKind.Variable: return mKind.Variable;
case jsonService.SymbolKind.Constant: return mKind.Constant;
case jsonService.SymbolKind.String: return mKind.String;
case jsonService.SymbolKind.Number: return mKind.Number;
case jsonService.SymbolKind.Boolean: return mKind.Boolean;
case jsonService.SymbolKind.Array: return mKind.Array;
}

@@ -444,3 +444,3 @@ return mKind.Function;

var resource = model.uri;
return this._worker(resource).then(function (worker) { return worker.provideFoldingRanges(resource.toString(), context); }).then(function (ranges) {
return this._worker(resource).then(function (worker) { return worker.getFoldingRanges(resource.toString(), context); }).then(function (ranges) {
if (!ranges) {

@@ -466,7 +466,30 @@ return;

switch (kind) {
case ls.FoldingRangeKind.Comment: return monaco.languages.FoldingRangeKind.Comment;
case ls.FoldingRangeKind.Imports: return monaco.languages.FoldingRangeKind.Imports;
case ls.FoldingRangeKind.Region: return monaco.languages.FoldingRangeKind.Region;
case jsonService.FoldingRangeKind.Comment: return monaco.languages.FoldingRangeKind.Comment;
case jsonService.FoldingRangeKind.Imports: return monaco.languages.FoldingRangeKind.Imports;
case jsonService.FoldingRangeKind.Region: return monaco.languages.FoldingRangeKind.Region;
}
return void 0;
}
var SelectionRangeAdapter = /** @class */ (function () {
function SelectionRangeAdapter(_worker) {
this._worker = _worker;
}
SelectionRangeAdapter.prototype.provideSelectionRanges = function (model, positions, token) {
var resource = model.uri;
return this._worker(resource).then(function (worker) { return worker.getSelectionRanges(resource.toString(), positions.map(fromPosition)); }).then(function (selectionRanges) {
if (!selectionRanges) {
return;
}
return selectionRanges.map(function (selectionRange) {
var result = [];
while (selectionRange) {
result.push({ range: toRange(selectionRange.range) });
selectionRange = selectionRange.parent;
}
return result;
});
});
};
return SelectionRangeAdapter;
}());
export { SelectionRangeAdapter };

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

foldingRanges: true,
diagnostics: true
diagnostics: true,
selectionRanges: true
};

@@ -73,0 +74,0 @@ var jsonDefaults = new LanguageServiceDefaultsImpl('json', diagnosticDefault, modeConfigurationDefault);

@@ -0,0 +0,0 @@ /*---------------------------------------------------------------------------------------------

@@ -0,0 +0,0 @@ /*---------------------------------------------------------------------------------------------

/*!-----------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* monaco-json version: 2.7.0(f3afc1b721188b32506d5b8a924561e3ec7534e3)
* monaco-json version: 2.8.0(3bbef09ccfb2501e6e07453686a994c4cd1ce5b7)
* Released under the MIT license
* https://github.com/Microsoft/monaco-json/blob/master/LICENSE.md
*-----------------------------------------------------------------------------*/
define("vs/language/json/monaco.contribution",["require","exports"],(function(e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t=monaco.Emitter,o=function(){function e(e,n,o){this._onDidChange=new t,this._languageId=e,this.setDiagnosticsOptions(n),this.setModeConfiguration(o)}return Object.defineProperty(e.prototype,"onDidChange",{get:function(){return this._onDidChange.event},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"languageId",{get:function(){return this._languageId},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"modeConfiguration",{get:function(){return this._modeConfiguration},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"diagnosticsOptions",{get:function(){return this._diagnosticsOptions},enumerable:!0,configurable:!0}),e.prototype.setDiagnosticsOptions=function(e){this._diagnosticsOptions=e||Object.create(null),this._onDidChange.fire(this)},e.prototype.setModeConfiguration=function(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)},e}();n.LanguageServiceDefaultsImpl=o;var i=new o("json",{validate:!0,allowComments:!0,schemas:[],enableSchemaRequest:!1},{documentFormattingEdits:!0,documentRangeFormattingEdits:!0,completionItems:!0,hovers:!0,documentSymbols:!0,tokens:!0,colors:!0,foldingRanges:!0,diagnostics:!0});monaco.languages.json={jsonDefaults:i},monaco.languages.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]}),monaco.languages.onLanguage("json",(function(){new Promise((function(n,t){e(["./jsonMode"],n,t)})).then((function(e){return e.setupMode(i)}))}))}));
define("vs/language/json/monaco.contribution",["require","exports"],(function(e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var t=monaco.Emitter,o=function(){function e(e,n,o){this._onDidChange=new t,this._languageId=e,this.setDiagnosticsOptions(n),this.setModeConfiguration(o)}return Object.defineProperty(e.prototype,"onDidChange",{get:function(){return this._onDidChange.event},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"languageId",{get:function(){return this._languageId},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"modeConfiguration",{get:function(){return this._modeConfiguration},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"diagnosticsOptions",{get:function(){return this._diagnosticsOptions},enumerable:!0,configurable:!0}),e.prototype.setDiagnosticsOptions=function(e){this._diagnosticsOptions=e||Object.create(null),this._onDidChange.fire(this)},e.prototype.setModeConfiguration=function(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)},e}();n.LanguageServiceDefaultsImpl=o;var i=new o("json",{validate:!0,allowComments:!0,schemas:[],enableSchemaRequest:!1},{documentFormattingEdits:!0,documentRangeFormattingEdits:!0,completionItems:!0,hovers:!0,documentSymbols:!0,tokens:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0});monaco.languages.json={jsonDefaults:i},monaco.languages.register({id:"json",extensions:[".json",".bowerrc",".jshintrc",".jscsrc",".eslintrc",".babelrc",".har"],aliases:["JSON","json"],mimetypes:["application/json"]}),monaco.languages.onLanguage("json",(function(){new Promise((function(n,t){e(["./jsonMode"],n,t)})).then((function(e){return e.setupMode(i)}))}))}));

@@ -7,91 +7,96 @@ /*---------------------------------------------------------------------------------------------

declare module monaco.languages.json {
export interface DiagnosticsOptions {
/**
* If set, the validator will be enabled and perform syntax validation as well as schema based validation.
*/
readonly validate?: boolean;
/**
* If set, comments are tolerated. If set to false, syntax errors will be emitted for comments.
*/
readonly allowComments?: boolean;
/**
* A list of known schemas and/or associations of schemas to file names.
*/
readonly schemas?: {
/**
* The URI of the schema, which is also the identifier of the schema.
*/
readonly uri: string;
/**
* A list of file names that are associated to the schema. The '*' wildcard can be used. For example '*.schema.json', 'package.json'
*/
readonly fileMatch?: string[];
/**
* The schema for the given URI.
*/
readonly schema?: any;
}[];
/**
* If set, the schema service would load schema content on-demand with 'fetch' if available
*/
readonly enableSchemaRequest?: boolean;
}
export interface DiagnosticsOptions {
/**
* If set, the validator will be enabled and perform syntax validation as well as schema based validation.
*/
readonly validate?: boolean;
/**
* If set, comments are tolerated. If set to false, syntax errors will be emitted for comments.
*/
readonly allowComments?: boolean;
/**
* A list of known schemas and/or associations of schemas to file names.
*/
readonly schemas?: {
/**
* The URI of the schema, which is also the identifier of the schema.
*/
readonly uri: string;
/**
* A list of file names that are associated to the schema. The '*' wildcard can be used. For example '*.schema.json', 'package.json'
*/
readonly fileMatch?: string[];
/**
* The schema for the given URI.
*/
readonly schema?: any;
}[];
/**
* If set, the schema service would load schema content on-demand with 'fetch' if available
*/
readonly enableSchemaRequest?: boolean;
}
export interface ModeConfiguration {
/**
* Defines whether the built-in documentFormattingEdit provider is enabled.
*/
readonly documentFormattingEdits?: boolean;
export interface ModeConfiguration {
/**
* Defines whether the built-in documentFormattingEdit provider is enabled.
*/
readonly documentFormattingEdits?: boolean;
/**
* Defines whether the built-in documentRangeFormattingEdit provider is enabled.
*/
readonly documentRangeFormattingEdits?: boolean;
/**
* Defines whether the built-in documentRangeFormattingEdit provider is enabled.
*/
readonly documentRangeFormattingEdits?: boolean;
/**
* Defines whether the built-in completionItemProvider is enabled.
*/
readonly completionItems?: boolean;
/**
* Defines whether the built-in completionItemProvider is enabled.
*/
readonly completionItems?: boolean;
/**
* Defines whether the built-in hoverProvider is enabled.
*/
readonly hovers?: boolean;
/**
* Defines whether the built-in hoverProvider is enabled.
*/
readonly hovers?: boolean;
/**
* Defines whether the built-in documentSymbolProvider is enabled.
*/
readonly documentSymbols?: boolean;
/**
* Defines whether the built-in documentSymbolProvider is enabled.
*/
readonly documentSymbols?: boolean;
/**
* Defines whether the built-in tokens provider is enabled.
*/
readonly tokens?: boolean;
/**
* Defines whether the built-in tokens provider is enabled.
*/
readonly tokens?: boolean;
/**
* Defines whether the built-in color provider is enabled.
*/
readonly colors?: boolean;
/**
* Defines whether the built-in color provider is enabled.
*/
readonly colors?: boolean;
/**
* Defines whether the built-in foldingRange provider is enabled.
*/
readonly foldingRanges?: boolean;
/**
* Defines whether the built-in foldingRange provider is enabled.
*/
readonly foldingRanges?: boolean;
/**
* Defines whether the built-in diagnostic provider is enabled.
*/
readonly diagnostics?: boolean;
/**
* Defines whether the built-in diagnostic provider is enabled.
*/
readonly diagnostics?: boolean;
}
/**
* Defines whether the built-in selection range provider is enabled.
*/
readonly selectionRanges?: boolean;
export interface LanguageServiceDefaults {
readonly onDidChange: IEvent<LanguageServiceDefaults>;
readonly diagnosticsOptions: DiagnosticsOptions;
readonly modeConfiguration: ModeConfiguration;
setDiagnosticsOptions(options: DiagnosticsOptions): void;
setModeConfiguration(modeConfiguration: ModeConfiguration): void;
}
}
export var jsonDefaults: LanguageServiceDefaults;
export interface LanguageServiceDefaults {
readonly onDidChange: IEvent<LanguageServiceDefaults>;
readonly diagnosticsOptions: DiagnosticsOptions;
readonly modeConfiguration: ModeConfiguration;
setDiagnosticsOptions(options: DiagnosticsOptions): void;
setModeConfiguration(modeConfiguration: ModeConfiguration): void;
}
export var jsonDefaults: LanguageServiceDefaults;
}

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

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

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

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