vscode-json-languageservice 4.2.1 → 5.0.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.
Files changed (49) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/SECURITY.md +41 -0
  3. package/lib/esm/jsonContributions.d.ts +17 -17
  4. package/lib/esm/jsonContributions.js +1 -1
  5. package/lib/esm/jsonLanguageService.d.ts +29 -29
  6. package/lib/esm/jsonLanguageService.js +66 -66
  7. package/lib/esm/jsonLanguageTypes.d.ts +279 -278
  8. package/lib/esm/jsonLanguageTypes.js +46 -45
  9. package/lib/esm/jsonSchema.d.ts +89 -70
  10. package/lib/esm/jsonSchema.js +1 -1
  11. package/lib/esm/parser/jsonParser.js +1214 -1218
  12. package/lib/esm/services/configuration.js +528 -528
  13. package/lib/esm/services/jsonCompletion.js +918 -934
  14. package/lib/esm/services/jsonDocumentSymbols.js +267 -278
  15. package/lib/esm/services/jsonFolding.js +120 -121
  16. package/lib/esm/services/jsonHover.js +109 -112
  17. package/lib/esm/services/jsonLinks.js +72 -73
  18. package/lib/esm/services/jsonSchemaService.js +586 -605
  19. package/lib/esm/services/jsonSelectionRanges.js +61 -61
  20. package/lib/esm/services/jsonValidation.js +151 -149
  21. package/lib/esm/utils/colors.js +68 -69
  22. package/lib/esm/utils/glob.js +124 -124
  23. package/lib/esm/utils/json.js +42 -42
  24. package/lib/esm/utils/objects.js +68 -65
  25. package/lib/esm/utils/strings.js +64 -64
  26. package/lib/umd/jsonContributions.d.ts +17 -17
  27. package/lib/umd/jsonContributions.js +12 -12
  28. package/lib/umd/jsonLanguageService.d.ts +29 -29
  29. package/lib/umd/jsonLanguageService.js +90 -90
  30. package/lib/umd/jsonLanguageTypes.d.ts +279 -278
  31. package/lib/umd/jsonLanguageTypes.js +93 -92
  32. package/lib/umd/jsonSchema.d.ts +89 -70
  33. package/lib/umd/jsonSchema.js +12 -12
  34. package/lib/umd/parser/jsonParser.js +1243 -1237
  35. package/lib/umd/services/configuration.js +541 -541
  36. package/lib/umd/services/jsonCompletion.js +932 -947
  37. package/lib/umd/services/jsonDocumentSymbols.js +281 -291
  38. package/lib/umd/services/jsonFolding.js +134 -135
  39. package/lib/umd/services/jsonHover.js +123 -125
  40. package/lib/umd/services/jsonLinks.js +86 -87
  41. package/lib/umd/services/jsonSchemaService.js +602 -618
  42. package/lib/umd/services/jsonSelectionRanges.js +75 -75
  43. package/lib/umd/services/jsonValidation.js +165 -162
  44. package/lib/umd/utils/colors.js +84 -85
  45. package/lib/umd/utils/glob.js +138 -138
  46. package/lib/umd/utils/json.js +56 -56
  47. package/lib/umd/utils/objects.js +87 -83
  48. package/lib/umd/utils/strings.js +82 -82
  49. package/package.json +10 -10
@@ -1,124 +1,124 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Copyright (c) 2013, Nick Fitzgerald
4
- * Licensed under the MIT License. See LICENCE.md in the project root for license information.
5
- *--------------------------------------------------------------------------------------------*/
6
- export function createRegex(glob, opts) {
7
- if (typeof glob !== 'string') {
8
- throw new TypeError('Expected a string');
9
- }
10
- var str = String(glob);
11
- // The regexp we are building, as a string.
12
- var reStr = "";
13
- // Whether we are matching so called "extended" globs (like bash) and should
14
- // support single character matching, matching ranges of characters, group
15
- // matching, etc.
16
- var extended = opts ? !!opts.extended : false;
17
- // When globstar is _false_ (default), '/foo/*' is translated a regexp like
18
- // '^\/foo\/.*$' which will match any string beginning with '/foo/'
19
- // When globstar is _true_, '/foo/*' is translated to regexp like
20
- // '^\/foo\/[^/]*$' which will match any string beginning with '/foo/' BUT
21
- // which does not have a '/' to the right of it.
22
- // E.g. with '/foo/*' these will match: '/foo/bar', '/foo/bar.txt' but
23
- // these will not '/foo/bar/baz', '/foo/bar/baz.txt'
24
- // Lastely, when globstar is _true_, '/foo/**' is equivelant to '/foo/*' when
25
- // globstar is _false_
26
- var globstar = opts ? !!opts.globstar : false;
27
- // If we are doing extended matching, this boolean is true when we are inside
28
- // a group (eg {*.html,*.js}), and false otherwise.
29
- var inGroup = false;
30
- // RegExp flags (eg "i" ) to pass in to RegExp constructor.
31
- var flags = opts && typeof (opts.flags) === "string" ? opts.flags : "";
32
- var c;
33
- for (var i = 0, len = str.length; i < len; i++) {
34
- c = str[i];
35
- switch (c) {
36
- case "/":
37
- case "$":
38
- case "^":
39
- case "+":
40
- case ".":
41
- case "(":
42
- case ")":
43
- case "=":
44
- case "!":
45
- case "|":
46
- reStr += "\\" + c;
47
- break;
48
- case "?":
49
- if (extended) {
50
- reStr += ".";
51
- break;
52
- }
53
- case "[":
54
- case "]":
55
- if (extended) {
56
- reStr += c;
57
- break;
58
- }
59
- case "{":
60
- if (extended) {
61
- inGroup = true;
62
- reStr += "(";
63
- break;
64
- }
65
- case "}":
66
- if (extended) {
67
- inGroup = false;
68
- reStr += ")";
69
- break;
70
- }
71
- case ",":
72
- if (inGroup) {
73
- reStr += "|";
74
- break;
75
- }
76
- reStr += "\\" + c;
77
- break;
78
- case "*":
79
- // Move over all consecutive "*"'s.
80
- // Also store the previous and next characters
81
- var prevChar = str[i - 1];
82
- var starCount = 1;
83
- while (str[i + 1] === "*") {
84
- starCount++;
85
- i++;
86
- }
87
- var nextChar = str[i + 1];
88
- if (!globstar) {
89
- // globstar is disabled, so treat any number of "*" as one
90
- reStr += ".*";
91
- }
92
- else {
93
- // globstar is enabled, so determine if this is a globstar segment
94
- var isGlobstar = starCount > 1 // multiple "*"'s
95
- && (prevChar === "/" || prevChar === undefined || prevChar === '{' || prevChar === ',') // from the start of the segment
96
- && (nextChar === "/" || nextChar === undefined || nextChar === ',' || nextChar === '}'); // to the end of the segment
97
- if (isGlobstar) {
98
- if (nextChar === "/") {
99
- i++; // move over the "/"
100
- }
101
- else if (prevChar === '/' && reStr.endsWith('\\/')) {
102
- reStr = reStr.substr(0, reStr.length - 2);
103
- }
104
- // it's a globstar, so match zero or more path segments
105
- reStr += "((?:[^/]*(?:\/|$))*)";
106
- }
107
- else {
108
- // it's not a globstar, so only match one path segment
109
- reStr += "([^/]*)";
110
- }
111
- }
112
- break;
113
- default:
114
- reStr += c;
115
- }
116
- }
117
- // When regexp 'g' flag is specified don't
118
- // constrain the regular expression with ^ & $
119
- if (!flags || !~flags.indexOf('g')) {
120
- reStr = "^" + reStr + "$";
121
- }
122
- return new RegExp(reStr, flags);
123
- }
124
- ;
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Copyright (c) 2013, Nick Fitzgerald
4
+ * Licensed under the MIT License. See LICENCE.md in the project root for license information.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ export function createRegex(glob, opts) {
7
+ if (typeof glob !== 'string') {
8
+ throw new TypeError('Expected a string');
9
+ }
10
+ const str = String(glob);
11
+ // The regexp we are building, as a string.
12
+ let reStr = "";
13
+ // Whether we are matching so called "extended" globs (like bash) and should
14
+ // support single character matching, matching ranges of characters, group
15
+ // matching, etc.
16
+ const extended = opts ? !!opts.extended : false;
17
+ // When globstar is _false_ (default), '/foo/*' is translated a regexp like
18
+ // '^\/foo\/.*$' which will match any string beginning with '/foo/'
19
+ // When globstar is _true_, '/foo/*' is translated to regexp like
20
+ // '^\/foo\/[^/]*$' which will match any string beginning with '/foo/' BUT
21
+ // which does not have a '/' to the right of it.
22
+ // E.g. with '/foo/*' these will match: '/foo/bar', '/foo/bar.txt' but
23
+ // these will not '/foo/bar/baz', '/foo/bar/baz.txt'
24
+ // Lastely, when globstar is _true_, '/foo/**' is equivelant to '/foo/*' when
25
+ // globstar is _false_
26
+ const globstar = opts ? !!opts.globstar : false;
27
+ // If we are doing extended matching, this boolean is true when we are inside
28
+ // a group (eg {*.html,*.js}), and false otherwise.
29
+ let inGroup = false;
30
+ // RegExp flags (eg "i" ) to pass in to RegExp constructor.
31
+ const flags = opts && typeof (opts.flags) === "string" ? opts.flags : "";
32
+ let c;
33
+ for (let i = 0, len = str.length; i < len; i++) {
34
+ c = str[i];
35
+ switch (c) {
36
+ case "/":
37
+ case "$":
38
+ case "^":
39
+ case "+":
40
+ case ".":
41
+ case "(":
42
+ case ")":
43
+ case "=":
44
+ case "!":
45
+ case "|":
46
+ reStr += "\\" + c;
47
+ break;
48
+ case "?":
49
+ if (extended) {
50
+ reStr += ".";
51
+ break;
52
+ }
53
+ case "[":
54
+ case "]":
55
+ if (extended) {
56
+ reStr += c;
57
+ break;
58
+ }
59
+ case "{":
60
+ if (extended) {
61
+ inGroup = true;
62
+ reStr += "(";
63
+ break;
64
+ }
65
+ case "}":
66
+ if (extended) {
67
+ inGroup = false;
68
+ reStr += ")";
69
+ break;
70
+ }
71
+ case ",":
72
+ if (inGroup) {
73
+ reStr += "|";
74
+ break;
75
+ }
76
+ reStr += "\\" + c;
77
+ break;
78
+ case "*":
79
+ // Move over all consecutive "*"'s.
80
+ // Also store the previous and next characters
81
+ const prevChar = str[i - 1];
82
+ let starCount = 1;
83
+ while (str[i + 1] === "*") {
84
+ starCount++;
85
+ i++;
86
+ }
87
+ const nextChar = str[i + 1];
88
+ if (!globstar) {
89
+ // globstar is disabled, so treat any number of "*" as one
90
+ reStr += ".*";
91
+ }
92
+ else {
93
+ // globstar is enabled, so determine if this is a globstar segment
94
+ const isGlobstar = starCount > 1 // multiple "*"'s
95
+ && (prevChar === "/" || prevChar === undefined || prevChar === '{' || prevChar === ',') // from the start of the segment
96
+ && (nextChar === "/" || nextChar === undefined || nextChar === ',' || nextChar === '}'); // to the end of the segment
97
+ if (isGlobstar) {
98
+ if (nextChar === "/") {
99
+ i++; // move over the "/"
100
+ }
101
+ else if (prevChar === '/' && reStr.endsWith('\\/')) {
102
+ reStr = reStr.substr(0, reStr.length - 2);
103
+ }
104
+ // it's a globstar, so match zero or more path segments
105
+ reStr += "((?:[^/]*(?:\/|$))*)";
106
+ }
107
+ else {
108
+ // it's not a globstar, so only match one path segment
109
+ reStr += "([^/]*)";
110
+ }
111
+ }
112
+ break;
113
+ default:
114
+ reStr += c;
115
+ }
116
+ }
117
+ // When regexp 'g' flag is specified don't
118
+ // constrain the regular expression with ^ & $
119
+ if (!flags || !~flags.indexOf('g')) {
120
+ reStr = "^" + reStr + "$";
121
+ }
122
+ return new RegExp(reStr, flags);
123
+ }
124
+ ;
@@ -1,42 +1,42 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the MIT License. See License.txt in the project root for license information.
4
- *--------------------------------------------------------------------------------------------*/
5
- export function stringifyObject(obj, indent, stringifyLiteral) {
6
- if (obj !== null && typeof obj === 'object') {
7
- var newIndent = indent + '\t';
8
- if (Array.isArray(obj)) {
9
- if (obj.length === 0) {
10
- return '[]';
11
- }
12
- var result = '[\n';
13
- for (var i = 0; i < obj.length; i++) {
14
- result += newIndent + stringifyObject(obj[i], newIndent, stringifyLiteral);
15
- if (i < obj.length - 1) {
16
- result += ',';
17
- }
18
- result += '\n';
19
- }
20
- result += indent + ']';
21
- return result;
22
- }
23
- else {
24
- var keys = Object.keys(obj);
25
- if (keys.length === 0) {
26
- return '{}';
27
- }
28
- var result = '{\n';
29
- for (var i = 0; i < keys.length; i++) {
30
- var key = keys[i];
31
- result += newIndent + JSON.stringify(key) + ': ' + stringifyObject(obj[key], newIndent, stringifyLiteral);
32
- if (i < keys.length - 1) {
33
- result += ',';
34
- }
35
- result += '\n';
36
- }
37
- result += indent + '}';
38
- return result;
39
- }
40
- }
41
- return stringifyLiteral(obj);
42
- }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ export function stringifyObject(obj, indent, stringifyLiteral) {
6
+ if (obj !== null && typeof obj === 'object') {
7
+ const newIndent = indent + '\t';
8
+ if (Array.isArray(obj)) {
9
+ if (obj.length === 0) {
10
+ return '[]';
11
+ }
12
+ let result = '[\n';
13
+ for (let i = 0; i < obj.length; i++) {
14
+ result += newIndent + stringifyObject(obj[i], newIndent, stringifyLiteral);
15
+ if (i < obj.length - 1) {
16
+ result += ',';
17
+ }
18
+ result += '\n';
19
+ }
20
+ result += indent + ']';
21
+ return result;
22
+ }
23
+ else {
24
+ const keys = Object.keys(obj);
25
+ if (keys.length === 0) {
26
+ return '{}';
27
+ }
28
+ let result = '{\n';
29
+ for (let i = 0; i < keys.length; i++) {
30
+ const key = keys[i];
31
+ result += newIndent + JSON.stringify(key) + ': ' + stringifyObject(obj[key], newIndent, stringifyLiteral);
32
+ if (i < keys.length - 1) {
33
+ result += ',';
34
+ }
35
+ result += '\n';
36
+ }
37
+ result += indent + '}';
38
+ return result;
39
+ }
40
+ }
41
+ return stringifyLiteral(obj);
42
+ }
@@ -1,65 +1,68 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the MIT License. See License.txt in the project root for license information.
4
- *--------------------------------------------------------------------------------------------*/
5
- export function equals(one, other) {
6
- if (one === other) {
7
- return true;
8
- }
9
- if (one === null || one === undefined || other === null || other === undefined) {
10
- return false;
11
- }
12
- if (typeof one !== typeof other) {
13
- return false;
14
- }
15
- if (typeof one !== 'object') {
16
- return false;
17
- }
18
- if ((Array.isArray(one)) !== (Array.isArray(other))) {
19
- return false;
20
- }
21
- var i, key;
22
- if (Array.isArray(one)) {
23
- if (one.length !== other.length) {
24
- return false;
25
- }
26
- for (i = 0; i < one.length; i++) {
27
- if (!equals(one[i], other[i])) {
28
- return false;
29
- }
30
- }
31
- }
32
- else {
33
- var oneKeys = [];
34
- for (key in one) {
35
- oneKeys.push(key);
36
- }
37
- oneKeys.sort();
38
- var otherKeys = [];
39
- for (key in other) {
40
- otherKeys.push(key);
41
- }
42
- otherKeys.sort();
43
- if (!equals(oneKeys, otherKeys)) {
44
- return false;
45
- }
46
- for (i = 0; i < oneKeys.length; i++) {
47
- if (!equals(one[oneKeys[i]], other[oneKeys[i]])) {
48
- return false;
49
- }
50
- }
51
- }
52
- return true;
53
- }
54
- export function isNumber(val) {
55
- return typeof val === 'number';
56
- }
57
- export function isDefined(val) {
58
- return typeof val !== 'undefined';
59
- }
60
- export function isBoolean(val) {
61
- return typeof val === 'boolean';
62
- }
63
- export function isString(val) {
64
- return typeof val === 'string';
65
- }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ export function equals(one, other) {
6
+ if (one === other) {
7
+ return true;
8
+ }
9
+ if (one === null || one === undefined || other === null || other === undefined) {
10
+ return false;
11
+ }
12
+ if (typeof one !== typeof other) {
13
+ return false;
14
+ }
15
+ if (typeof one !== 'object') {
16
+ return false;
17
+ }
18
+ if ((Array.isArray(one)) !== (Array.isArray(other))) {
19
+ return false;
20
+ }
21
+ var i, key;
22
+ if (Array.isArray(one)) {
23
+ if (one.length !== other.length) {
24
+ return false;
25
+ }
26
+ for (i = 0; i < one.length; i++) {
27
+ if (!equals(one[i], other[i])) {
28
+ return false;
29
+ }
30
+ }
31
+ }
32
+ else {
33
+ var oneKeys = [];
34
+ for (key in one) {
35
+ oneKeys.push(key);
36
+ }
37
+ oneKeys.sort();
38
+ var otherKeys = [];
39
+ for (key in other) {
40
+ otherKeys.push(key);
41
+ }
42
+ otherKeys.sort();
43
+ if (!equals(oneKeys, otherKeys)) {
44
+ return false;
45
+ }
46
+ for (i = 0; i < oneKeys.length; i++) {
47
+ if (!equals(one[oneKeys[i]], other[oneKeys[i]])) {
48
+ return false;
49
+ }
50
+ }
51
+ }
52
+ return true;
53
+ }
54
+ export function isNumber(val) {
55
+ return typeof val === 'number';
56
+ }
57
+ export function isDefined(val) {
58
+ return typeof val !== 'undefined';
59
+ }
60
+ export function isBoolean(val) {
61
+ return typeof val === 'boolean';
62
+ }
63
+ export function isString(val) {
64
+ return typeof val === 'string';
65
+ }
66
+ export function isObject(val) {
67
+ return typeof val === 'object' && val !== null && !Array.isArray(val);
68
+ }
@@ -1,64 +1,64 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the MIT License. See License.txt in the project root for license information.
4
- *--------------------------------------------------------------------------------------------*/
5
- export function startsWith(haystack, needle) {
6
- if (haystack.length < needle.length) {
7
- return false;
8
- }
9
- for (var i = 0; i < needle.length; i++) {
10
- if (haystack[i] !== needle[i]) {
11
- return false;
12
- }
13
- }
14
- return true;
15
- }
16
- /**
17
- * Determines if haystack ends with needle.
18
- */
19
- export function endsWith(haystack, needle) {
20
- var diff = haystack.length - needle.length;
21
- if (diff > 0) {
22
- return haystack.lastIndexOf(needle) === diff;
23
- }
24
- else if (diff === 0) {
25
- return haystack === needle;
26
- }
27
- else {
28
- return false;
29
- }
30
- }
31
- export function convertSimple2RegExpPattern(pattern) {
32
- return pattern.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g, '\\$&').replace(/[\*]/g, '.*');
33
- }
34
- export function repeat(value, count) {
35
- var s = '';
36
- while (count > 0) {
37
- if ((count & 1) === 1) {
38
- s += value;
39
- }
40
- value += value;
41
- count = count >>> 1;
42
- }
43
- return s;
44
- }
45
- export function extendedRegExp(pattern) {
46
- var flags = '';
47
- if (startsWith(pattern, '(?i)')) {
48
- pattern = pattern.substring(4);
49
- flags = 'i';
50
- }
51
- try {
52
- return new RegExp(pattern, flags + 'u');
53
- }
54
- catch (e) {
55
- // could be an exception due to the 'u ' flag
56
- try {
57
- return new RegExp(pattern, flags);
58
- }
59
- catch (e) {
60
- // invalid pattern
61
- return undefined;
62
- }
63
- }
64
- }
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ export function startsWith(haystack, needle) {
6
+ if (haystack.length < needle.length) {
7
+ return false;
8
+ }
9
+ for (let i = 0; i < needle.length; i++) {
10
+ if (haystack[i] !== needle[i]) {
11
+ return false;
12
+ }
13
+ }
14
+ return true;
15
+ }
16
+ /**
17
+ * Determines if haystack ends with needle.
18
+ */
19
+ export function endsWith(haystack, needle) {
20
+ const diff = haystack.length - needle.length;
21
+ if (diff > 0) {
22
+ return haystack.lastIndexOf(needle) === diff;
23
+ }
24
+ else if (diff === 0) {
25
+ return haystack === needle;
26
+ }
27
+ else {
28
+ return false;
29
+ }
30
+ }
31
+ export function convertSimple2RegExpPattern(pattern) {
32
+ return pattern.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g, '\\$&').replace(/[\*]/g, '.*');
33
+ }
34
+ export function repeat(value, count) {
35
+ var s = '';
36
+ while (count > 0) {
37
+ if ((count & 1) === 1) {
38
+ s += value;
39
+ }
40
+ value += value;
41
+ count = count >>> 1;
42
+ }
43
+ return s;
44
+ }
45
+ export function extendedRegExp(pattern) {
46
+ let flags = '';
47
+ if (startsWith(pattern, '(?i)')) {
48
+ pattern = pattern.substring(4);
49
+ flags = 'i';
50
+ }
51
+ try {
52
+ return new RegExp(pattern, flags + 'u');
53
+ }
54
+ catch (e) {
55
+ // could be an exception due to the 'u ' flag
56
+ try {
57
+ return new RegExp(pattern, flags);
58
+ }
59
+ catch (e) {
60
+ // invalid pattern
61
+ return undefined;
62
+ }
63
+ }
64
+ }
@@ -1,17 +1,17 @@
1
- import { Thenable, MarkedString, CompletionItem } from './jsonLanguageService';
2
- export interface JSONWorkerContribution {
3
- getInfoContribution(uri: string, location: JSONPath): Thenable<MarkedString[]>;
4
- collectPropertyCompletions(uri: string, location: JSONPath, currentWord: string, addValue: boolean, isLast: boolean, result: CompletionsCollector): Thenable<any>;
5
- collectValueCompletions(uri: string, location: JSONPath, propertyKey: string, result: CompletionsCollector): Thenable<any>;
6
- collectDefaultCompletions(uri: string, result: CompletionsCollector): Thenable<any>;
7
- resolveCompletion?(item: CompletionItem): Thenable<CompletionItem>;
8
- }
9
- export declare type Segment = string | number;
10
- export declare type JSONPath = Segment[];
11
- export interface CompletionsCollector {
12
- add(suggestion: CompletionItem): void;
13
- error(message: string): void;
14
- log(message: string): void;
15
- setAsIncomplete(): void;
16
- getNumberOfProposals(): number;
17
- }
1
+ import { Thenable, MarkedString, CompletionItem } from './jsonLanguageService';
2
+ export interface JSONWorkerContribution {
3
+ getInfoContribution(uri: string, location: JSONPath): Thenable<MarkedString[]>;
4
+ collectPropertyCompletions(uri: string, location: JSONPath, currentWord: string, addValue: boolean, isLast: boolean, result: CompletionsCollector): Thenable<any>;
5
+ collectValueCompletions(uri: string, location: JSONPath, propertyKey: string, result: CompletionsCollector): Thenable<any>;
6
+ collectDefaultCompletions(uri: string, result: CompletionsCollector): Thenable<any>;
7
+ resolveCompletion?(item: CompletionItem): Thenable<CompletionItem>;
8
+ }
9
+ export declare type Segment = string | number;
10
+ export declare type JSONPath = Segment[];
11
+ export interface CompletionsCollector {
12
+ add(suggestion: CompletionItem): void;
13
+ error(message: string): void;
14
+ log(message: string): void;
15
+ setAsIncomplete(): void;
16
+ getNumberOfProposals(): number;
17
+ }
@@ -1,12 +1,12 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- });
1
+ (function (factory) {
2
+ if (typeof module === "object" && typeof module.exports === "object") {
3
+ var v = factory(require, exports);
4
+ if (v !== undefined) module.exports = v;
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ define(["require", "exports"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ });