vscode-json-languageservice 3.8.5 → 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +34 -26
- package/lib/esm/jsonLanguageService.d.ts +2 -0
- package/lib/esm/jsonLanguageService.js +4 -3
- package/lib/esm/jsonLanguageTypes.d.ts +8 -5
- package/lib/esm/jsonLanguageTypes.js +2 -2
- package/lib/esm/services/jsonCompletion.js +7 -2
- package/lib/esm/services/jsonDocumentSymbols.js +20 -2
- package/lib/esm/services/{jsonDefinition.js → jsonLinks.js} +19 -29
- package/lib/esm/services/jsonSchemaService.js +14 -3
- package/lib/esm/services/jsonValidation.js +1 -1
- package/lib/umd/jsonLanguageService.d.ts +2 -0
- package/lib/umd/jsonLanguageService.js +5 -4
- package/lib/umd/jsonLanguageTypes.d.ts +8 -5
- package/lib/umd/jsonLanguageTypes.js +1 -2
- package/lib/umd/services/jsonCompletion.js +7 -2
- package/lib/umd/services/jsonDocumentSymbols.js +20 -2
- package/lib/umd/services/{jsonDefinition.js → jsonLinks.js} +21 -31
- package/lib/umd/services/jsonSchemaService.js +14 -3
- package/lib/umd/services/jsonValidation.js +1 -1
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
3.11.0 / 2020-11-30
|
|
2
|
+
================
|
|
3
|
+
* new API `FormattingOptions.insertFinalNewline`
|
|
4
|
+
|
|
5
|
+
3.10.0 / 2020-11-03
|
|
6
|
+
================
|
|
7
|
+
* new API `findLinks` return links for local `$ref` links. Replaces `findDefinition` which no longer returns results ( kept for API compatibility)
|
|
8
|
+
|
|
1
9
|
3.9.0 / 2020-09-28
|
|
2
10
|
=================
|
|
3
11
|
* new API `DocumentLanguageSettings.schemaValidation`. The severity of problems from schema validation. If set to 'ignore', schema validation will be skipped. If not set, 'warning' is used.
|
package/README.md
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# vscode-json-languageservice
|
|
2
|
+
|
|
2
3
|
JSON language service extracted from VSCode to be reused, e.g in the Monaco editor.
|
|
3
4
|
|
|
4
5
|
[](https://www.npmjs.org/package/vscode-json-languageservice)
|
|
@@ -6,52 +7,59 @@ JSON language service extracted from VSCode to be reused, e.g in the Monaco edit
|
|
|
6
7
|
[](https://travis-ci.org/Microsoft/vscode-json-languageservice)
|
|
7
8
|
[](https://opensource.org/licenses/MIT)
|
|
8
9
|
|
|
9
|
-
Why?
|
|
10
|
-
|
|
10
|
+
## Why?
|
|
11
|
+
|
|
11
12
|
The _vscode-json-languageservice_ contains the language smarts behind the JSON editing experience of Visual Studio Code
|
|
12
13
|
and the Monaco editor.
|
|
13
|
-
- *doValidation* analyses an input string and returns syntax and lint errors.
|
|
14
|
-
- *doComplete* provides completion proposals for a given location. *doResolve* resolves a completion proposal
|
|
15
|
-
- *doResolve* resolves a completion proposals.
|
|
16
|
-
- *doHover* provides a hover text for a given location.
|
|
17
|
-
- *findDocumentSymbols* provides all symbols in the given document
|
|
18
|
-
- *findDocumentColors* provides all color symbols in the given document, *getColorPresentations* returns available color formats for a color symbol.
|
|
19
|
-
- *format* formats the code at the given range.
|
|
20
|
-
- *getFoldingRanges* gets folding ranges for the given document
|
|
21
|
-
- *getSelectionRanges* gets selection ranges for a given location.
|
|
22
|
-
- *getMatchingSchemas* matches a document against its schema and returns all AST nodes along with the matching sub schemas
|
|
23
14
|
|
|
24
|
-
|
|
15
|
+
- _doValidation_ analyses an input string and returns syntax and lint errors.
|
|
16
|
+
- _doComplete_ provides completion proposals for a given location.
|
|
17
|
+
- _doResolve_ resolves a completion proposals.
|
|
18
|
+
- _doHover_ provides a hover text for a given location.
|
|
19
|
+
- _findDocumentSymbols_ provides all symbols in the given document.
|
|
20
|
+
- _findDocumentColors_ provides all color symbols in the given document.
|
|
21
|
+
- _getColorPresentations_ returns available color formats for a color symbol.
|
|
22
|
+
- _format_ formats the code at the given range.
|
|
23
|
+
- _getFoldingRanges_ gets folding ranges for the given document.
|
|
24
|
+
- _getSelectionRanges_ gets selection ranges for a given location.
|
|
25
|
+
- _getMatchingSchemas_ matches a document against its schema and returns all AST nodes along with the matching sub schemas.
|
|
26
|
+
- _parseJSONDocument_ creates a JSON document from source code.
|
|
27
|
+
- _newJSONDocument_ creates a JSON document from an AST.
|
|
25
28
|
|
|
26
|
-
For the complete API see [jsonLanguageService.ts](./src/jsonLanguageService.ts) and [jsonLanguageTypes.ts](./src/jsonLanguageTypes.ts)
|
|
29
|
+
For the complete API see [jsonLanguageService.ts](./src/jsonLanguageService.ts) and [jsonLanguageTypes.ts](./src/jsonLanguageTypes.ts)
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
Installation
|
|
30
|
-
------------
|
|
31
|
+
## Installation
|
|
31
32
|
|
|
32
33
|
npm install --save vscode-json-languageservice
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
## Sample usage
|
|
36
|
+
|
|
37
|
+
See [sample.ts](./src/example/sample.ts) for an example on how to use the JSON language service.
|
|
36
38
|
|
|
39
|
+
To run the sample use `yarn sample`
|
|
37
40
|
|
|
38
|
-
|
|
39
|
-
- `yarn test` to compile and run tests
|
|
41
|
+
## Development
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
git clone https://github.com/microsoft/vscode-json-languageservice
|
|
44
|
+
cd vscode-json-languageservice
|
|
45
|
+
yarn
|
|
46
|
+
|
|
47
|
+
Use `yarn test` to compile and run tests
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
### How can I run and debug the service?
|
|
42
51
|
|
|
43
52
|
- open the folder in VSCode.
|
|
44
53
|
- set breakpoints, e.g. in `jsonCompletion.ts`
|
|
45
54
|
- run the Unit tests from the run viewlet and wait until a breakpoint is hit:
|
|
46
|
-

|
|
47
|
-
|
|
55
|
+

|
|
48
56
|
|
|
49
|
-
How can I run and debug the service inside an instance of VSCode?
|
|
57
|
+
### How can I run and debug the service inside an instance of VSCode?
|
|
50
58
|
|
|
51
59
|
- run VSCode out of sources setup as described here: https://github.com/Microsoft/vscode/wiki/How-to-Contribute
|
|
52
60
|
- use `yarn link vscode-json-languageservice` in `vscode/extensions/json-language-features/server` to run VSCode with the latest changes from `vscode-json-languageservice`
|
|
53
61
|
- run VSCode out of source (`vscode/scripts/code.sh|bat`) and open a `.json` file
|
|
54
62
|
- in VSCode window that is open on the `vscode-json-languageservice` sources, run command `Debug: Attach to Node process` and pick the `code-oss` process with the `json-language-features` path
|
|
55
|
-

|
|
63
|
+

|
|
56
64
|
- set breakpoints, e.g. in `jsonCompletion.ts`
|
|
57
65
|
- in the instance run from sources, invoke code completion in the `.json` file
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Thenable, ASTNode, Color, ColorInformation, ColorPresentation, LanguageServiceParams, LanguageSettings, DocumentLanguageSettings, FoldingRange, JSONSchema, SelectionRange, FoldingRangesContext, DocumentSymbolsContext, ColorInformationContext as DocumentColorsContext, TextDocument, Position, CompletionItem, CompletionList, Hover, Range, SymbolInformation, Diagnostic, TextEdit, FormattingOptions, DocumentSymbol, DefinitionLink, MatchingSchema } from './jsonLanguageTypes';
|
|
2
|
+
import { DocumentLink } from 'vscode-languageserver-types';
|
|
2
3
|
export declare type JSONDocument = {
|
|
3
4
|
root: ASTNode | undefined;
|
|
4
5
|
getNodeFromOffset(offset: number, includeRightBound?: boolean): ASTNode | undefined;
|
|
@@ -24,5 +25,6 @@ export interface LanguageService {
|
|
|
24
25
|
getFoldingRanges(document: TextDocument, context?: FoldingRangesContext): FoldingRange[];
|
|
25
26
|
getSelectionRanges(document: TextDocument, positions: Position[], doc: JSONDocument): SelectionRange[];
|
|
26
27
|
findDefinition(document: TextDocument, position: Position, doc: JSONDocument): Thenable<DefinitionLink[]>;
|
|
28
|
+
findLinks(document: TextDocument, doc: JSONDocument): Thenable<DocumentLink[]>;
|
|
27
29
|
}
|
|
28
30
|
export declare function getLanguageService(params: LanguageServiceParams): LanguageService;
|
|
@@ -13,7 +13,7 @@ import { getFoldingRanges } from './services/jsonFolding';
|
|
|
13
13
|
import { getSelectionRanges } from './services/jsonSelectionRanges';
|
|
14
14
|
import { format as formatJSON } from 'jsonc-parser';
|
|
15
15
|
import { Range, TextEdit } from './jsonLanguageTypes';
|
|
16
|
-
import {
|
|
16
|
+
import { findLinks } from './services/jsonLinks';
|
|
17
17
|
export * from './jsonLanguageTypes';
|
|
18
18
|
export function getLanguageService(params) {
|
|
19
19
|
var promise = params.promiseConstructor || Promise;
|
|
@@ -48,7 +48,8 @@ export function getLanguageService(params) {
|
|
|
48
48
|
doHover: jsonHover.doHover.bind(jsonHover),
|
|
49
49
|
getFoldingRanges: getFoldingRanges,
|
|
50
50
|
getSelectionRanges: getSelectionRanges,
|
|
51
|
-
findDefinition:
|
|
51
|
+
findDefinition: function () { return Promise.resolve([]); },
|
|
52
|
+
findLinks: findLinks,
|
|
52
53
|
format: function (d, r, o) {
|
|
53
54
|
var range = undefined;
|
|
54
55
|
if (r) {
|
|
@@ -56,7 +57,7 @@ export function getLanguageService(params) {
|
|
|
56
57
|
var length = d.offsetAt(r.end) - offset;
|
|
57
58
|
range = { offset: offset, length: length };
|
|
58
59
|
}
|
|
59
|
-
var options = { tabSize: o ? o.tabSize : 4, insertSpaces: o ? o.insertSpaces : true, eol: '\n' };
|
|
60
|
+
var options = { tabSize: o ? o.tabSize : 4, insertSpaces: (o === null || o === void 0 ? void 0 : o.insertSpaces) === true, insertFinalNewline: (o === null || o === void 0 ? void 0 : o.insertFinalNewline) === true, eol: '\n' };
|
|
60
61
|
return formatJSON(d.getText(), range, options).map(function (e) {
|
|
61
62
|
return TextEdit.replace(Range.create(d.positionAt(e.offset), d.positionAt(e.offset + e.length)), e.content);
|
|
62
63
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { JSONWorkerContribution, JSONPath, Segment, CompletionsCollector } from './jsonContributions';
|
|
2
2
|
import { JSONSchema } from './jsonSchema';
|
|
3
|
-
import { Range, TextEdit, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, MarkupKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, Position, InsertTextFormat, MarkupContent, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString, FormattingOptions, DefinitionLink } from 'vscode-languageserver-types';
|
|
3
|
+
import { Range, TextEdit, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, MarkupKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, Position, InsertTextFormat, MarkupContent, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString, FormattingOptions as LSPFormattingOptions, DefinitionLink } from 'vscode-languageserver-types';
|
|
4
4
|
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
5
|
-
export { TextDocument, Range, TextEdit, JSONSchema, JSONWorkerContribution, JSONPath, Segment, CompletionsCollector, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, Position, InsertTextFormat, MarkupContent, MarkupKind, DefinitionLink, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString
|
|
5
|
+
export { TextDocument, Range, TextEdit, JSONSchema, JSONWorkerContribution, JSONPath, Segment, CompletionsCollector, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, Position, InsertTextFormat, MarkupContent, MarkupKind, DefinitionLink, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString };
|
|
6
6
|
/**
|
|
7
7
|
* Error codes used by diagnostics
|
|
8
8
|
*/
|
|
@@ -129,8 +129,8 @@ export interface WorkspaceContextService {
|
|
|
129
129
|
resolveRelativePath(relativePath: string, resource: string): string;
|
|
130
130
|
}
|
|
131
131
|
/**
|
|
132
|
-
* The schema request service is used to fetch schemas.
|
|
133
|
-
*
|
|
132
|
+
* The schema request service is used to fetch schemas. If successful, returns a resolved promise with the content of the schema.
|
|
133
|
+
* In case of an error, returns a rejected promise with a displayable error string.
|
|
134
134
|
*/
|
|
135
135
|
export interface SchemaRequestService {
|
|
136
136
|
(uri: string): Thenable<string>;
|
|
@@ -142,7 +142,7 @@ export interface PromiseConstructor {
|
|
|
142
142
|
* a resolve callback used resolve the promise with a value or the result of another promise,
|
|
143
143
|
* and a reject callback used to reject the promise with a provided reason or error.
|
|
144
144
|
*/
|
|
145
|
-
new <T>(executor: (resolve: (value?: T | Thenable<T>) => void, reject: (reason?: any) => void) => void): Thenable<T>;
|
|
145
|
+
new <T>(executor: (resolve: (value?: T | Thenable<T | undefined>) => void, reject: (reason?: any) => void) => void): Thenable<T | undefined>;
|
|
146
146
|
/**
|
|
147
147
|
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
|
148
148
|
* resolve, or rejected when any Promise is rejected.
|
|
@@ -269,3 +269,6 @@ export interface ColorInformationContext {
|
|
|
269
269
|
*/
|
|
270
270
|
onResultLimitExceeded?: (uri: string) => void;
|
|
271
271
|
}
|
|
272
|
+
export interface FormattingOptions extends LSPFormattingOptions {
|
|
273
|
+
insertFinalNewline?: boolean;
|
|
274
|
+
}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { Range, TextEdit, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, MarkupKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, Position, InsertTextFormat, MarkupContent, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString
|
|
5
|
+
import { Range, TextEdit, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, MarkupKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, Position, InsertTextFormat, MarkupContent, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString } from 'vscode-languageserver-types';
|
|
6
6
|
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
7
|
-
export { TextDocument, Range, TextEdit, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, Position, InsertTextFormat, MarkupContent, MarkupKind, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString
|
|
7
|
+
export { TextDocument, Range, TextEdit, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, Position, InsertTextFormat, MarkupContent, MarkupKind, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString };
|
|
8
8
|
/**
|
|
9
9
|
* Error codes used by diagnostics
|
|
10
10
|
*/
|
|
@@ -89,8 +89,13 @@ var JSONCompletion = /** @class */ (function () {
|
|
|
89
89
|
proposed[label] = suggestion;
|
|
90
90
|
result.items.push(suggestion);
|
|
91
91
|
}
|
|
92
|
-
else
|
|
93
|
-
existing.documentation
|
|
92
|
+
else {
|
|
93
|
+
if (!existing.documentation) {
|
|
94
|
+
existing.documentation = suggestion.documentation;
|
|
95
|
+
}
|
|
96
|
+
if (!existing.detail) {
|
|
97
|
+
existing.detail = suggestion.detail;
|
|
98
|
+
}
|
|
94
99
|
}
|
|
95
100
|
},
|
|
96
101
|
setAsIncomplete: function () {
|
|
@@ -156,9 +156,10 @@ var JSONDocumentSymbols = /** @class */ (function () {
|
|
|
156
156
|
limit--;
|
|
157
157
|
var range = getRange(document, property);
|
|
158
158
|
var selectionRange = getRange(document, property.keyNode);
|
|
159
|
-
var
|
|
159
|
+
var children = [];
|
|
160
|
+
var symbol = { name: _this.getKeyLabel(property), kind: _this.getSymbolKind(valueNode.type), range: range, selectionRange: selectionRange, children: children, detail: _this.getDetail(valueNode) };
|
|
160
161
|
result.push(symbol);
|
|
161
|
-
toVisit.push({ result:
|
|
162
|
+
toVisit.push({ result: children, node: valueNode });
|
|
162
163
|
}
|
|
163
164
|
else {
|
|
164
165
|
limitExceeded = true;
|
|
@@ -203,6 +204,23 @@ var JSONDocumentSymbols = /** @class */ (function () {
|
|
|
203
204
|
}
|
|
204
205
|
return "\"" + name + "\"";
|
|
205
206
|
};
|
|
207
|
+
JSONDocumentSymbols.prototype.getDetail = function (node) {
|
|
208
|
+
if (!node) {
|
|
209
|
+
return undefined;
|
|
210
|
+
}
|
|
211
|
+
if (node.type === 'boolean' || node.type === 'number' || node.type === 'null' || node.type === 'string') {
|
|
212
|
+
return String(node.value);
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
if (node.type === 'array') {
|
|
216
|
+
return node.children.length ? undefined : '[]';
|
|
217
|
+
}
|
|
218
|
+
else if (node.type === 'object') {
|
|
219
|
+
return node.children.length ? undefined : '{}';
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return undefined;
|
|
223
|
+
};
|
|
206
224
|
JSONDocumentSymbols.prototype.findDocumentColors = function (document, doc, context) {
|
|
207
225
|
return this.schemaService.getSchemaForResource(document.uri, doc).then(function (schema) {
|
|
208
226
|
var result = [];
|
|
@@ -3,37 +3,27 @@
|
|
|
3
3
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { Range } from '../jsonLanguageTypes';
|
|
6
|
-
export function
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
return Promise.resolve([definition]);
|
|
6
|
+
export function findLinks(document, doc) {
|
|
7
|
+
var links = [];
|
|
8
|
+
doc.visit(function (node) {
|
|
9
|
+
var _a;
|
|
10
|
+
if (node.type === "property" && node.keyNode.value === "$ref" && ((_a = node.valueNode) === null || _a === void 0 ? void 0 : _a.type) === 'string') {
|
|
11
|
+
var path = node.valueNode.value;
|
|
12
|
+
var targetNode = findTargetNode(doc, path);
|
|
13
|
+
if (targetNode) {
|
|
14
|
+
var targetPos = document.positionAt(targetNode.offset);
|
|
15
|
+
links.push({
|
|
16
|
+
target: document.uri + "#" + (targetPos.line + 1) + "," + (targetPos.character + 1),
|
|
17
|
+
range: createRange(document, node.valueNode)
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return true;
|
|
22
|
+
});
|
|
23
|
+
return Promise.resolve(links);
|
|
26
24
|
}
|
|
27
25
|
function createRange(document, node) {
|
|
28
|
-
return Range.create(document.positionAt(node.offset), document.positionAt(node.offset + node.length));
|
|
29
|
-
}
|
|
30
|
-
function isRef(node) {
|
|
31
|
-
return node.type === 'string' &&
|
|
32
|
-
node.parent &&
|
|
33
|
-
node.parent.type === 'property' &&
|
|
34
|
-
node.parent.valueNode === node &&
|
|
35
|
-
node.parent.keyNode.value === "$ref" ||
|
|
36
|
-
false;
|
|
26
|
+
return Range.create(document.positionAt(node.offset + 1), document.positionAt(node.offset + node.length - 1));
|
|
37
27
|
}
|
|
38
28
|
function findTargetNode(doc, path) {
|
|
39
29
|
var tokens = parseJSONPointer(path);
|
|
@@ -331,6 +331,7 @@ var JSONSchemaService = /** @class */ (function () {
|
|
|
331
331
|
var loc = refSegment ? uri + '#' + refSegment : uri;
|
|
332
332
|
resolveErrors.push(localize('json.schema.problemloadingref', 'Problems loading reference \'{0}\': {1}', loc, unresolvedSchema.errors[0]));
|
|
333
333
|
}
|
|
334
|
+
delete node.$ref;
|
|
334
335
|
merge(node, unresolvedSchema.schema, uri, refSegment);
|
|
335
336
|
return resolveRefs(node, unresolvedSchema.schema, uri, referencedHandle.dependencies);
|
|
336
337
|
});
|
|
@@ -394,14 +395,14 @@ var JSONSchemaService = /** @class */ (function () {
|
|
|
394
395
|
while (next.$ref) {
|
|
395
396
|
var ref = next.$ref;
|
|
396
397
|
var segments = ref.split('#', 2);
|
|
397
|
-
delete next.$ref;
|
|
398
398
|
if (segments[0].length > 0) {
|
|
399
399
|
openPromises.push(resolveExternalLink(next, segments[0], segments[1], parentSchemaURL, parentSchemaDependencies));
|
|
400
400
|
return;
|
|
401
401
|
}
|
|
402
402
|
else {
|
|
403
|
+
delete next.$ref;
|
|
403
404
|
if (seenRefs.indexOf(ref) === -1) {
|
|
404
|
-
merge(next, parentSchema, parentSchemaURL, segments[1]); // can set next.$ref again, use seenRefs to avoid circle
|
|
405
|
+
merge(next, parentSchema, parentSchemaURL, segments[1]); // will remove $ref, can set next.$ref again, use seenRefs to avoid circle
|
|
405
406
|
seenRefs.push(ref);
|
|
406
407
|
}
|
|
407
408
|
}
|
|
@@ -445,9 +446,10 @@ var JSONSchemaService = /** @class */ (function () {
|
|
|
445
446
|
}
|
|
446
447
|
var seen = Object.create(null);
|
|
447
448
|
var schemas = [];
|
|
449
|
+
var normalizedResource = normalizeResourceForMatching(resource);
|
|
448
450
|
for (var _i = 0, _a = this.filePatternAssociations; _i < _a.length; _i++) {
|
|
449
451
|
var entry = _a[_i];
|
|
450
|
-
if (entry.matchesPattern(
|
|
452
|
+
if (entry.matchesPattern(normalizedResource)) {
|
|
451
453
|
for (var _b = 0, _c = entry.getURIs(); _b < _c.length; _b++) {
|
|
452
454
|
var schemaId = _c[_b];
|
|
453
455
|
if (!seen[schemaId]) {
|
|
@@ -500,6 +502,15 @@ function normalizeId(id) {
|
|
|
500
502
|
return id;
|
|
501
503
|
}
|
|
502
504
|
}
|
|
505
|
+
function normalizeResourceForMatching(resource) {
|
|
506
|
+
// remove querues and fragments, normalize drive capitalization
|
|
507
|
+
try {
|
|
508
|
+
return URI.parse(resource).with({ fragment: null, query: null }).toString();
|
|
509
|
+
}
|
|
510
|
+
catch (e) {
|
|
511
|
+
return resource;
|
|
512
|
+
}
|
|
513
|
+
}
|
|
503
514
|
function toDisplayString(url) {
|
|
504
515
|
try {
|
|
505
516
|
var uri = URI.parse(url);
|
|
@@ -15,7 +15,7 @@ var JSONValidation = /** @class */ (function () {
|
|
|
15
15
|
}
|
|
16
16
|
JSONValidation.prototype.configure = function (raw) {
|
|
17
17
|
if (raw) {
|
|
18
|
-
this.validationEnabled = raw.validate;
|
|
18
|
+
this.validationEnabled = raw.validate !== false;
|
|
19
19
|
this.commentSeverity = raw.allowComments ? undefined : DiagnosticSeverity.Error;
|
|
20
20
|
}
|
|
21
21
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Thenable, ASTNode, Color, ColorInformation, ColorPresentation, LanguageServiceParams, LanguageSettings, DocumentLanguageSettings, FoldingRange, JSONSchema, SelectionRange, FoldingRangesContext, DocumentSymbolsContext, ColorInformationContext as DocumentColorsContext, TextDocument, Position, CompletionItem, CompletionList, Hover, Range, SymbolInformation, Diagnostic, TextEdit, FormattingOptions, DocumentSymbol, DefinitionLink, MatchingSchema } from './jsonLanguageTypes';
|
|
2
|
+
import { DocumentLink } from 'vscode-languageserver-types';
|
|
2
3
|
export declare type JSONDocument = {
|
|
3
4
|
root: ASTNode | undefined;
|
|
4
5
|
getNodeFromOffset(offset: number, includeRightBound?: boolean): ASTNode | undefined;
|
|
@@ -24,5 +25,6 @@ export interface LanguageService {
|
|
|
24
25
|
getFoldingRanges(document: TextDocument, context?: FoldingRangesContext): FoldingRange[];
|
|
25
26
|
getSelectionRanges(document: TextDocument, positions: Position[], doc: JSONDocument): SelectionRange[];
|
|
26
27
|
findDefinition(document: TextDocument, position: Position, doc: JSONDocument): Thenable<DefinitionLink[]>;
|
|
28
|
+
findLinks(document: TextDocument, doc: JSONDocument): Thenable<DocumentLink[]>;
|
|
27
29
|
}
|
|
28
30
|
export declare function getLanguageService(params: LanguageServiceParams): LanguageService;
|
|
@@ -18,7 +18,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
18
18
|
if (v !== undefined) module.exports = v;
|
|
19
19
|
}
|
|
20
20
|
else if (typeof define === "function" && define.amd) {
|
|
21
|
-
define(["require", "exports", "./services/jsonCompletion", "./services/jsonHover", "./services/jsonValidation", "./services/jsonDocumentSymbols", "./parser/jsonParser", "./services/configuration", "./services/jsonSchemaService", "./services/jsonFolding", "./services/jsonSelectionRanges", "jsonc-parser", "./jsonLanguageTypes", "./services/
|
|
21
|
+
define(["require", "exports", "./services/jsonCompletion", "./services/jsonHover", "./services/jsonValidation", "./services/jsonDocumentSymbols", "./parser/jsonParser", "./services/configuration", "./services/jsonSchemaService", "./services/jsonFolding", "./services/jsonSelectionRanges", "jsonc-parser", "./jsonLanguageTypes", "./services/jsonLinks", "./jsonLanguageTypes"], factory);
|
|
22
22
|
}
|
|
23
23
|
})(function (require, exports) {
|
|
24
24
|
"use strict";
|
|
@@ -35,7 +35,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
35
35
|
var jsonSelectionRanges_1 = require("./services/jsonSelectionRanges");
|
|
36
36
|
var jsonc_parser_1 = require("jsonc-parser");
|
|
37
37
|
var jsonLanguageTypes_1 = require("./jsonLanguageTypes");
|
|
38
|
-
var
|
|
38
|
+
var jsonLinks_1 = require("./services/jsonLinks");
|
|
39
39
|
__exportStar(require("./jsonLanguageTypes"), exports);
|
|
40
40
|
function getLanguageService(params) {
|
|
41
41
|
var promise = params.promiseConstructor || Promise;
|
|
@@ -70,7 +70,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
70
70
|
doHover: jsonHover.doHover.bind(jsonHover),
|
|
71
71
|
getFoldingRanges: jsonFolding_1.getFoldingRanges,
|
|
72
72
|
getSelectionRanges: jsonSelectionRanges_1.getSelectionRanges,
|
|
73
|
-
findDefinition:
|
|
73
|
+
findDefinition: function () { return Promise.resolve([]); },
|
|
74
|
+
findLinks: jsonLinks_1.findLinks,
|
|
74
75
|
format: function (d, r, o) {
|
|
75
76
|
var range = undefined;
|
|
76
77
|
if (r) {
|
|
@@ -78,7 +79,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
78
79
|
var length = d.offsetAt(r.end) - offset;
|
|
79
80
|
range = { offset: offset, length: length };
|
|
80
81
|
}
|
|
81
|
-
var options = { tabSize: o ? o.tabSize : 4, insertSpaces: o ? o.insertSpaces : true, eol: '\n' };
|
|
82
|
+
var options = { tabSize: o ? o.tabSize : 4, insertSpaces: (o === null || o === void 0 ? void 0 : o.insertSpaces) === true, insertFinalNewline: (o === null || o === void 0 ? void 0 : o.insertFinalNewline) === true, eol: '\n' };
|
|
82
83
|
return jsonc_parser_1.format(d.getText(), range, options).map(function (e) {
|
|
83
84
|
return jsonLanguageTypes_1.TextEdit.replace(jsonLanguageTypes_1.Range.create(d.positionAt(e.offset), d.positionAt(e.offset + e.length)), e.content);
|
|
84
85
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { JSONWorkerContribution, JSONPath, Segment, CompletionsCollector } from './jsonContributions';
|
|
2
2
|
import { JSONSchema } from './jsonSchema';
|
|
3
|
-
import { Range, TextEdit, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, MarkupKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, Position, InsertTextFormat, MarkupContent, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString, FormattingOptions, DefinitionLink } from 'vscode-languageserver-types';
|
|
3
|
+
import { Range, TextEdit, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, MarkupKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, Position, InsertTextFormat, MarkupContent, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString, FormattingOptions as LSPFormattingOptions, DefinitionLink } from 'vscode-languageserver-types';
|
|
4
4
|
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
5
|
-
export { TextDocument, Range, TextEdit, JSONSchema, JSONWorkerContribution, JSONPath, Segment, CompletionsCollector, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, Position, InsertTextFormat, MarkupContent, MarkupKind, DefinitionLink, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString
|
|
5
|
+
export { TextDocument, Range, TextEdit, JSONSchema, JSONWorkerContribution, JSONPath, Segment, CompletionsCollector, Color, ColorInformation, ColorPresentation, FoldingRange, FoldingRangeKind, SelectionRange, Diagnostic, DiagnosticSeverity, CompletionItem, CompletionItemKind, CompletionList, Position, InsertTextFormat, MarkupContent, MarkupKind, DefinitionLink, SymbolInformation, SymbolKind, DocumentSymbol, Location, Hover, MarkedString };
|
|
6
6
|
/**
|
|
7
7
|
* Error codes used by diagnostics
|
|
8
8
|
*/
|
|
@@ -129,8 +129,8 @@ export interface WorkspaceContextService {
|
|
|
129
129
|
resolveRelativePath(relativePath: string, resource: string): string;
|
|
130
130
|
}
|
|
131
131
|
/**
|
|
132
|
-
* The schema request service is used to fetch schemas.
|
|
133
|
-
*
|
|
132
|
+
* The schema request service is used to fetch schemas. If successful, returns a resolved promise with the content of the schema.
|
|
133
|
+
* In case of an error, returns a rejected promise with a displayable error string.
|
|
134
134
|
*/
|
|
135
135
|
export interface SchemaRequestService {
|
|
136
136
|
(uri: string): Thenable<string>;
|
|
@@ -142,7 +142,7 @@ export interface PromiseConstructor {
|
|
|
142
142
|
* a resolve callback used resolve the promise with a value or the result of another promise,
|
|
143
143
|
* and a reject callback used to reject the promise with a provided reason or error.
|
|
144
144
|
*/
|
|
145
|
-
new <T>(executor: (resolve: (value?: T | Thenable<T>) => void, reject: (reason?: any) => void) => void): Thenable<T>;
|
|
145
|
+
new <T>(executor: (resolve: (value?: T | Thenable<T | undefined>) => void, reject: (reason?: any) => void) => void): Thenable<T | undefined>;
|
|
146
146
|
/**
|
|
147
147
|
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
|
148
148
|
* resolve, or rejected when any Promise is rejected.
|
|
@@ -269,3 +269,6 @@ export interface ColorInformationContext {
|
|
|
269
269
|
*/
|
|
270
270
|
onResultLimitExceeded?: (uri: string) => void;
|
|
271
271
|
}
|
|
272
|
+
export interface FormattingOptions extends LSPFormattingOptions {
|
|
273
|
+
insertFinalNewline?: boolean;
|
|
274
|
+
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
})(function (require, exports) {
|
|
14
14
|
"use strict";
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.ClientCapabilities = exports.ErrorCode = exports.
|
|
16
|
+
exports.ClientCapabilities = exports.ErrorCode = exports.MarkedString = exports.Hover = exports.Location = exports.DocumentSymbol = exports.SymbolKind = exports.SymbolInformation = exports.MarkupKind = exports.MarkupContent = exports.InsertTextFormat = exports.Position = exports.CompletionList = exports.CompletionItemKind = exports.CompletionItem = exports.DiagnosticSeverity = exports.Diagnostic = exports.SelectionRange = exports.FoldingRangeKind = exports.FoldingRange = exports.ColorPresentation = exports.ColorInformation = exports.Color = exports.TextEdit = exports.Range = exports.TextDocument = void 0;
|
|
17
17
|
var vscode_languageserver_types_1 = require("vscode-languageserver-types");
|
|
18
18
|
Object.defineProperty(exports, "Range", { enumerable: true, get: function () { return vscode_languageserver_types_1.Range; } });
|
|
19
19
|
Object.defineProperty(exports, "TextEdit", { enumerable: true, get: function () { return vscode_languageserver_types_1.TextEdit; } });
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
Object.defineProperty(exports, "Location", { enumerable: true, get: function () { return vscode_languageserver_types_1.Location; } });
|
|
39
39
|
Object.defineProperty(exports, "Hover", { enumerable: true, get: function () { return vscode_languageserver_types_1.Hover; } });
|
|
40
40
|
Object.defineProperty(exports, "MarkedString", { enumerable: true, get: function () { return vscode_languageserver_types_1.MarkedString; } });
|
|
41
|
-
Object.defineProperty(exports, "FormattingOptions", { enumerable: true, get: function () { return vscode_languageserver_types_1.FormattingOptions; } });
|
|
42
41
|
var vscode_languageserver_textdocument_1 = require("vscode-languageserver-textdocument");
|
|
43
42
|
Object.defineProperty(exports, "TextDocument", { enumerable: true, get: function () { return vscode_languageserver_textdocument_1.TextDocument; } });
|
|
44
43
|
/**
|
|
@@ -101,8 +101,13 @@
|
|
|
101
101
|
proposed[label] = suggestion;
|
|
102
102
|
result.items.push(suggestion);
|
|
103
103
|
}
|
|
104
|
-
else
|
|
105
|
-
existing.documentation
|
|
104
|
+
else {
|
|
105
|
+
if (!existing.documentation) {
|
|
106
|
+
existing.documentation = suggestion.documentation;
|
|
107
|
+
}
|
|
108
|
+
if (!existing.detail) {
|
|
109
|
+
existing.detail = suggestion.detail;
|
|
110
|
+
}
|
|
106
111
|
}
|
|
107
112
|
},
|
|
108
113
|
setAsIncomplete: function () {
|
|
@@ -168,9 +168,10 @@
|
|
|
168
168
|
limit--;
|
|
169
169
|
var range = getRange(document, property);
|
|
170
170
|
var selectionRange = getRange(document, property.keyNode);
|
|
171
|
-
var
|
|
171
|
+
var children = [];
|
|
172
|
+
var symbol = { name: _this.getKeyLabel(property), kind: _this.getSymbolKind(valueNode.type), range: range, selectionRange: selectionRange, children: children, detail: _this.getDetail(valueNode) };
|
|
172
173
|
result.push(symbol);
|
|
173
|
-
toVisit.push({ result:
|
|
174
|
+
toVisit.push({ result: children, node: valueNode });
|
|
174
175
|
}
|
|
175
176
|
else {
|
|
176
177
|
limitExceeded = true;
|
|
@@ -215,6 +216,23 @@
|
|
|
215
216
|
}
|
|
216
217
|
return "\"" + name + "\"";
|
|
217
218
|
};
|
|
219
|
+
JSONDocumentSymbols.prototype.getDetail = function (node) {
|
|
220
|
+
if (!node) {
|
|
221
|
+
return undefined;
|
|
222
|
+
}
|
|
223
|
+
if (node.type === 'boolean' || node.type === 'number' || node.type === 'null' || node.type === 'string') {
|
|
224
|
+
return String(node.value);
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
if (node.type === 'array') {
|
|
228
|
+
return node.children.length ? undefined : '[]';
|
|
229
|
+
}
|
|
230
|
+
else if (node.type === 'object') {
|
|
231
|
+
return node.children.length ? undefined : '{}';
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return undefined;
|
|
235
|
+
};
|
|
218
236
|
JSONDocumentSymbols.prototype.findDocumentColors = function (document, doc, context) {
|
|
219
237
|
return this.schemaService.getSchemaForResource(document.uri, doc).then(function (schema) {
|
|
220
238
|
var result = [];
|
|
@@ -13,40 +13,30 @@
|
|
|
13
13
|
})(function (require, exports) {
|
|
14
14
|
"use strict";
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.
|
|
16
|
+
exports.findLinks = void 0;
|
|
17
17
|
var jsonLanguageTypes_1 = require("../jsonLanguageTypes");
|
|
18
|
-
function
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
};
|
|
37
|
-
return Promise.resolve([definition]);
|
|
18
|
+
function findLinks(document, doc) {
|
|
19
|
+
var links = [];
|
|
20
|
+
doc.visit(function (node) {
|
|
21
|
+
var _a;
|
|
22
|
+
if (node.type === "property" && node.keyNode.value === "$ref" && ((_a = node.valueNode) === null || _a === void 0 ? void 0 : _a.type) === 'string') {
|
|
23
|
+
var path = node.valueNode.value;
|
|
24
|
+
var targetNode = findTargetNode(doc, path);
|
|
25
|
+
if (targetNode) {
|
|
26
|
+
var targetPos = document.positionAt(targetNode.offset);
|
|
27
|
+
links.push({
|
|
28
|
+
target: document.uri + "#" + (targetPos.line + 1) + "," + (targetPos.character + 1),
|
|
29
|
+
range: createRange(document, node.valueNode)
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return true;
|
|
34
|
+
});
|
|
35
|
+
return Promise.resolve(links);
|
|
38
36
|
}
|
|
39
|
-
exports.
|
|
37
|
+
exports.findLinks = findLinks;
|
|
40
38
|
function createRange(document, node) {
|
|
41
|
-
return jsonLanguageTypes_1.Range.create(document.positionAt(node.offset), document.positionAt(node.offset + node.length));
|
|
42
|
-
}
|
|
43
|
-
function isRef(node) {
|
|
44
|
-
return node.type === 'string' &&
|
|
45
|
-
node.parent &&
|
|
46
|
-
node.parent.type === 'property' &&
|
|
47
|
-
node.parent.valueNode === node &&
|
|
48
|
-
node.parent.keyNode.value === "$ref" ||
|
|
49
|
-
false;
|
|
39
|
+
return jsonLanguageTypes_1.Range.create(document.positionAt(node.offset + 1), document.positionAt(node.offset + node.length - 1));
|
|
50
40
|
}
|
|
51
41
|
function findTargetNode(doc, path) {
|
|
52
42
|
var tokens = parseJSONPointer(path);
|
|
@@ -343,6 +343,7 @@
|
|
|
343
343
|
var loc = refSegment ? uri + '#' + refSegment : uri;
|
|
344
344
|
resolveErrors.push(localize('json.schema.problemloadingref', 'Problems loading reference \'{0}\': {1}', loc, unresolvedSchema.errors[0]));
|
|
345
345
|
}
|
|
346
|
+
delete node.$ref;
|
|
346
347
|
merge(node, unresolvedSchema.schema, uri, refSegment);
|
|
347
348
|
return resolveRefs(node, unresolvedSchema.schema, uri, referencedHandle.dependencies);
|
|
348
349
|
});
|
|
@@ -406,14 +407,14 @@
|
|
|
406
407
|
while (next.$ref) {
|
|
407
408
|
var ref = next.$ref;
|
|
408
409
|
var segments = ref.split('#', 2);
|
|
409
|
-
delete next.$ref;
|
|
410
410
|
if (segments[0].length > 0) {
|
|
411
411
|
openPromises.push(resolveExternalLink(next, segments[0], segments[1], parentSchemaURL, parentSchemaDependencies));
|
|
412
412
|
return;
|
|
413
413
|
}
|
|
414
414
|
else {
|
|
415
|
+
delete next.$ref;
|
|
415
416
|
if (seenRefs.indexOf(ref) === -1) {
|
|
416
|
-
merge(next, parentSchema, parentSchemaURL, segments[1]); // can set next.$ref again, use seenRefs to avoid circle
|
|
417
|
+
merge(next, parentSchema, parentSchemaURL, segments[1]); // will remove $ref, can set next.$ref again, use seenRefs to avoid circle
|
|
417
418
|
seenRefs.push(ref);
|
|
418
419
|
}
|
|
419
420
|
}
|
|
@@ -457,9 +458,10 @@
|
|
|
457
458
|
}
|
|
458
459
|
var seen = Object.create(null);
|
|
459
460
|
var schemas = [];
|
|
461
|
+
var normalizedResource = normalizeResourceForMatching(resource);
|
|
460
462
|
for (var _i = 0, _a = this.filePatternAssociations; _i < _a.length; _i++) {
|
|
461
463
|
var entry = _a[_i];
|
|
462
|
-
if (entry.matchesPattern(
|
|
464
|
+
if (entry.matchesPattern(normalizedResource)) {
|
|
463
465
|
for (var _b = 0, _c = entry.getURIs(); _b < _c.length; _b++) {
|
|
464
466
|
var schemaId = _c[_b];
|
|
465
467
|
if (!seen[schemaId]) {
|
|
@@ -512,6 +514,15 @@
|
|
|
512
514
|
return id;
|
|
513
515
|
}
|
|
514
516
|
}
|
|
517
|
+
function normalizeResourceForMatching(resource) {
|
|
518
|
+
// remove querues and fragments, normalize drive capitalization
|
|
519
|
+
try {
|
|
520
|
+
return vscode_uri_1.URI.parse(resource).with({ fragment: null, query: null }).toString();
|
|
521
|
+
}
|
|
522
|
+
catch (e) {
|
|
523
|
+
return resource;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
515
526
|
function toDisplayString(url) {
|
|
516
527
|
try {
|
|
517
528
|
var uri = vscode_uri_1.URI.parse(url);
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
}
|
|
28
28
|
JSONValidation.prototype.configure = function (raw) {
|
|
29
29
|
if (raw) {
|
|
30
|
-
this.validationEnabled = raw.validate;
|
|
30
|
+
this.validationEnabled = raw.validate !== false;
|
|
31
31
|
this.commentSeverity = raw.allowComments ? undefined : jsonLanguageTypes_1.DiagnosticSeverity.Error;
|
|
32
32
|
}
|
|
33
33
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vscode-json-languageservice",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.11.0",
|
|
4
4
|
"description": "Language service for JSON",
|
|
5
5
|
"main": "./lib/umd/jsonLanguageService.js",
|
|
6
6
|
"typings": "./lib/umd/jsonLanguageService",
|
|
@@ -15,18 +15,17 @@
|
|
|
15
15
|
"url": "https://github.com/Microsoft/vscode-json-languageservice"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@types/mocha": "^8.0.
|
|
18
|
+
"@types/mocha": "^8.0.4",
|
|
19
19
|
"@types/node": "^10.12.21",
|
|
20
|
-
"@typescript-eslint/eslint-plugin": "^4.
|
|
21
|
-
"@typescript-eslint/parser": "^4.
|
|
22
|
-
"eslint": "^7.
|
|
23
|
-
"mocha": "^8.1
|
|
24
|
-
"nyc": "^15.1.0",
|
|
20
|
+
"@typescript-eslint/eslint-plugin": "^4.8.2",
|
|
21
|
+
"@typescript-eslint/parser": "^4.8.2",
|
|
22
|
+
"eslint": "^7.14.0",
|
|
23
|
+
"mocha": "^8.2.1",
|
|
25
24
|
"rimraf": "^3.0.2",
|
|
26
|
-
"typescript": "^4.
|
|
25
|
+
"typescript": "^4.1.2"
|
|
27
26
|
},
|
|
28
27
|
"dependencies": {
|
|
29
|
-
"jsonc-parser": "^
|
|
28
|
+
"jsonc-parser": "^3.0.0",
|
|
30
29
|
"vscode-languageserver-textdocument": "^1.0.1",
|
|
31
30
|
"vscode-languageserver-types": "3.16.0-next.2",
|
|
32
31
|
"vscode-nls": "^5.0.0",
|
|
@@ -43,10 +42,11 @@
|
|
|
43
42
|
"pretest": "npm run compile",
|
|
44
43
|
"test": "mocha",
|
|
45
44
|
"posttest": "npm run lint",
|
|
46
|
-
"coverage": "nyc -r lcov npm run test",
|
|
45
|
+
"coverage": "npx nyc -r lcov npm run test",
|
|
47
46
|
"lint": "eslint src/**/*.ts",
|
|
48
47
|
"install-types-next": "npm install vscode-languageserver-types@next -f -S && npm install vscode-languageserver-textdocument@next -f -S",
|
|
49
48
|
"preversion": "npm test",
|
|
50
|
-
"postversion": "git push && git push --tags"
|
|
49
|
+
"postversion": "git push && git push --tags",
|
|
50
|
+
"sample": "npm run compile && node ./lib/umd/example/sample.js"
|
|
51
51
|
}
|
|
52
52
|
}
|