yaml-language-server 1.13.1-e701d27.0 → 1.14.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 +20 -0
- package/lib/esm/languageserver/handlers/languageHandlers.d.ts +3 -3
- package/lib/esm/languageserver/handlers/languageHandlers.js +12 -0
- package/lib/esm/languageserver/handlers/languageHandlers.js.map +1 -1
- package/lib/esm/languageservice/parser/ast-converter.js +9 -6
- package/lib/esm/languageservice/parser/ast-converter.js.map +1 -1
- package/lib/esm/languageservice/parser/jsonParser07.js +6 -1
- package/lib/esm/languageservice/parser/jsonParser07.js.map +1 -1
- package/lib/esm/languageservice/services/yamlHover.js +2 -2
- package/lib/esm/languageservice/services/yamlHover.js.map +1 -1
- package/lib/esm/languageservice/services/yamlSchemaService.js +3 -13
- package/lib/esm/languageservice/services/yamlSchemaService.js.map +1 -1
- package/lib/esm/languageservice/services/yamlSelectionRanges.d.ts +3 -0
- package/lib/esm/languageservice/services/yamlSelectionRanges.js +102 -0
- package/lib/esm/languageservice/services/yamlSelectionRanges.js.map +1 -0
- package/lib/esm/languageservice/utils/objects.d.ts +1 -1
- package/lib/esm/languageservice/yamlLanguageService.d.ts +2 -1
- package/lib/esm/languageservice/yamlLanguageService.js +2 -0
- package/lib/esm/languageservice/yamlLanguageService.js.map +1 -1
- package/lib/esm/yamlServerInit.js +1 -0
- package/lib/esm/yamlServerInit.js.map +1 -1
- package/lib/umd/languageserver/handlers/languageHandlers.d.ts +3 -3
- package/lib/umd/languageserver/handlers/languageHandlers.js +12 -0
- package/lib/umd/languageserver/handlers/languageHandlers.js.map +1 -1
- package/lib/umd/languageservice/parser/ast-converter.js +9 -6
- package/lib/umd/languageservice/parser/ast-converter.js.map +1 -1
- package/lib/umd/languageservice/parser/jsonParser07.js +6 -1
- package/lib/umd/languageservice/parser/jsonParser07.js.map +1 -1
- package/lib/umd/languageservice/services/yamlHover.js +2 -2
- package/lib/umd/languageservice/services/yamlHover.js.map +1 -1
- package/lib/umd/languageservice/services/yamlSchemaService.js +3 -13
- package/lib/umd/languageservice/services/yamlSchemaService.js.map +1 -1
- package/lib/umd/languageservice/services/yamlSelectionRanges.d.ts +3 -0
- package/lib/umd/languageservice/services/yamlSelectionRanges.js +116 -0
- package/lib/umd/languageservice/services/yamlSelectionRanges.js.map +1 -0
- package/lib/umd/languageservice/utils/objects.d.ts +1 -1
- package/lib/umd/languageservice/yamlLanguageService.d.ts +2 -1
- package/lib/umd/languageservice/yamlLanguageService.js +3 -1
- package/lib/umd/languageservice/yamlLanguageService.js.map +1 -1
- package/lib/umd/yamlServerInit.js +1 -0
- package/lib/umd/yamlServerInit.js.map +1 -1
- package/out/server/src/languageserver/handlers/languageHandlers.d.ts +3 -3
- package/out/server/src/languageserver/handlers/languageHandlers.js +12 -0
- package/out/server/src/languageserver/handlers/languageHandlers.js.map +1 -1
- package/out/server/src/languageservice/parser/ast-converter.js +9 -6
- package/out/server/src/languageservice/parser/ast-converter.js.map +1 -1
- package/out/server/src/languageservice/parser/jsonParser07.js +6 -1
- package/out/server/src/languageservice/parser/jsonParser07.js.map +1 -1
- package/out/server/src/languageservice/services/yamlHover.js +2 -2
- package/out/server/src/languageservice/services/yamlHover.js.map +1 -1
- package/out/server/src/languageservice/services/yamlSchemaService.js +3 -13
- package/out/server/src/languageservice/services/yamlSchemaService.js.map +1 -1
- package/out/server/src/languageservice/services/yamlSelectionRanges.d.ts +3 -0
- package/out/server/src/languageservice/services/yamlSelectionRanges.js +106 -0
- package/out/server/src/languageservice/services/yamlSelectionRanges.js.map +1 -0
- package/out/server/src/languageservice/utils/objects.d.ts +1 -1
- package/out/server/src/languageservice/yamlLanguageService.d.ts +2 -1
- package/out/server/src/languageservice/yamlLanguageService.js +2 -0
- package/out/server/src/languageservice/yamlLanguageService.js.map +1 -1
- package/out/server/src/yamlServerInit.js +1 -0
- package/out/server/src/yamlServerInit.js.map +1 -1
- package/out/server/test/autoCompletion.test.js +109 -107
- package/out/server/test/autoCompletion.test.js.map +1 -1
- package/out/server/test/autoCompletionFix.test.js +49 -47
- package/out/server/test/autoCompletionFix.test.js.map +1 -1
- package/out/server/test/code-action-schema.test.js +6 -6
- package/out/server/test/code-action-schema.test.js.map +1 -1
- package/out/server/test/hover.test.js +25 -25
- package/out/server/test/hover.test.js.map +1 -1
- package/out/server/test/schemaValidation.test.js +134 -80
- package/out/server/test/schemaValidation.test.js.map +1 -1
- package/out/server/test/utils/testHelper.d.ts +46 -0
- package/out/server/test/utils/testHelper.js +100 -1
- package/out/server/test/utils/testHelper.js.map +1 -1
- package/out/server/test/yamlParser.test.js +6 -0
- package/out/server/test/yamlParser.test.js.map +1 -1
- package/out/server/test/yamlSelectionRanges.test.d.ts +1 -0
- package/out/server/test/yamlSelectionRanges.test.js +180 -0
- package/out/server/test/yamlSelectionRanges.test.js.map +1 -0
- package/package.json +2 -2
- package/eslint-result.sarif +0 -3491
|
@@ -18,15 +18,17 @@ describe('Auto Completion Tests', () => {
|
|
|
18
18
|
let languageService;
|
|
19
19
|
let languageHandler;
|
|
20
20
|
let yamlSettings;
|
|
21
|
+
let schemaProvider;
|
|
21
22
|
before(() => {
|
|
22
23
|
languageSettingsSetup = new serviceSetup_1.ServiceSetup().withCompletion().withSchemaFileMatch({
|
|
23
24
|
uri: 'http://google.com',
|
|
24
25
|
fileMatch: ['bad-schema.yaml'],
|
|
25
26
|
});
|
|
26
|
-
const { languageService: langService, languageHandler: langHandler, yamlSettings: settings, } = (0, testHelper_1.setupLanguageService)(languageSettingsSetup.languageSettings);
|
|
27
|
+
const { languageService: langService, languageHandler: langHandler, yamlSettings: settings, schemaProvider: testSchemaProvider, } = (0, testHelper_1.setupLanguageService)(languageSettingsSetup.languageSettings);
|
|
27
28
|
languageService = langService;
|
|
28
29
|
languageHandler = langHandler;
|
|
29
30
|
yamlSettings = settings;
|
|
31
|
+
schemaProvider = testSchemaProvider;
|
|
30
32
|
});
|
|
31
33
|
/**
|
|
32
34
|
* Generates a completion list for the given document and caret (cursor) position.
|
|
@@ -49,13 +51,13 @@ describe('Auto Completion Tests', () => {
|
|
|
49
51
|
});
|
|
50
52
|
}
|
|
51
53
|
afterEach(() => {
|
|
52
|
-
|
|
54
|
+
schemaProvider.deleteSchema(testHelper_1.SCHEMA_ID);
|
|
53
55
|
languageService.configure(languageSettingsSetup.languageSettings);
|
|
54
56
|
});
|
|
55
57
|
describe('YAML Completion Tests', function () {
|
|
56
58
|
describe('JSON Schema Tests', function () {
|
|
57
59
|
it('Autocomplete on root without word', (done) => {
|
|
58
|
-
|
|
60
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
59
61
|
type: 'object',
|
|
60
62
|
properties: {
|
|
61
63
|
name: {
|
|
@@ -75,7 +77,7 @@ describe('Auto Completion Tests', () => {
|
|
|
75
77
|
.then(done, done);
|
|
76
78
|
});
|
|
77
79
|
it('Autocomplete on root with partial word', (done) => {
|
|
78
|
-
|
|
80
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
79
81
|
type: 'object',
|
|
80
82
|
properties: {
|
|
81
83
|
name: {
|
|
@@ -95,7 +97,7 @@ describe('Auto Completion Tests', () => {
|
|
|
95
97
|
.then(done, done);
|
|
96
98
|
});
|
|
97
99
|
it('Autocomplete on default value (without :)', (done) => {
|
|
98
|
-
|
|
100
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
99
101
|
type: 'object',
|
|
100
102
|
properties: {
|
|
101
103
|
name: {
|
|
@@ -116,7 +118,7 @@ describe('Auto Completion Tests', () => {
|
|
|
116
118
|
.then(done, done);
|
|
117
119
|
});
|
|
118
120
|
it('Autocomplete on default value (without value content)', (done) => {
|
|
119
|
-
|
|
121
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
120
122
|
type: 'object',
|
|
121
123
|
properties: {
|
|
122
124
|
name: {
|
|
@@ -137,7 +139,7 @@ describe('Auto Completion Tests', () => {
|
|
|
137
139
|
.then(done, done);
|
|
138
140
|
});
|
|
139
141
|
it('Autocomplete on default value with \\"', async () => {
|
|
140
|
-
|
|
142
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
141
143
|
type: 'object',
|
|
142
144
|
properties: {
|
|
143
145
|
name: {
|
|
@@ -154,7 +156,7 @@ describe('Auto Completion Tests', () => {
|
|
|
154
156
|
}));
|
|
155
157
|
});
|
|
156
158
|
it('Autocomplete name and value with \\"', async () => {
|
|
157
|
-
|
|
159
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
158
160
|
type: 'object',
|
|
159
161
|
properties: {
|
|
160
162
|
name: {
|
|
@@ -171,7 +173,7 @@ describe('Auto Completion Tests', () => {
|
|
|
171
173
|
}));
|
|
172
174
|
});
|
|
173
175
|
it('Autocomplete on default value (with value content)', (done) => {
|
|
174
|
-
|
|
176
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
175
177
|
type: 'object',
|
|
176
178
|
properties: {
|
|
177
179
|
name: {
|
|
@@ -192,7 +194,7 @@ describe('Auto Completion Tests', () => {
|
|
|
192
194
|
.then(done, done);
|
|
193
195
|
});
|
|
194
196
|
it('Autocomplete on default value (with value content contains dash)', (done) => {
|
|
195
|
-
|
|
197
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
196
198
|
type: 'object',
|
|
197
199
|
properties: {
|
|
198
200
|
name: {
|
|
@@ -213,7 +215,7 @@ describe('Auto Completion Tests', () => {
|
|
|
213
215
|
.then(done, done);
|
|
214
216
|
});
|
|
215
217
|
it('Autocomplete on boolean value (without value content)', (done) => {
|
|
216
|
-
|
|
218
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
217
219
|
type: 'object',
|
|
218
220
|
properties: {
|
|
219
221
|
yaml: {
|
|
@@ -236,7 +238,7 @@ describe('Auto Completion Tests', () => {
|
|
|
236
238
|
.then(done, done);
|
|
237
239
|
});
|
|
238
240
|
it('Autocomplete on boolean value with key of `null`', () => {
|
|
239
|
-
|
|
241
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
240
242
|
type: 'object',
|
|
241
243
|
properties: {
|
|
242
244
|
validation: {
|
|
@@ -259,7 +261,7 @@ describe('Auto Completion Tests', () => {
|
|
|
259
261
|
});
|
|
260
262
|
});
|
|
261
263
|
it('Autocomplete on boolean value (with value content)', (done) => {
|
|
262
|
-
|
|
264
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
263
265
|
type: 'object',
|
|
264
266
|
properties: {
|
|
265
267
|
yaml: {
|
|
@@ -282,7 +284,7 @@ describe('Auto Completion Tests', () => {
|
|
|
282
284
|
.then(done, done);
|
|
283
285
|
});
|
|
284
286
|
it('Autocomplete on number value (without value content)', (done) => {
|
|
285
|
-
|
|
287
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
286
288
|
type: 'object',
|
|
287
289
|
properties: {
|
|
288
290
|
timeout: {
|
|
@@ -303,7 +305,7 @@ describe('Auto Completion Tests', () => {
|
|
|
303
305
|
.then(done, done);
|
|
304
306
|
});
|
|
305
307
|
it('Autocomplete on number value (with value content)', (done) => {
|
|
306
|
-
|
|
308
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
307
309
|
type: 'object',
|
|
308
310
|
properties: {
|
|
309
311
|
timeout: {
|
|
@@ -324,7 +326,7 @@ describe('Auto Completion Tests', () => {
|
|
|
324
326
|
.then(done, done);
|
|
325
327
|
});
|
|
326
328
|
it('Autocomplete key in middle of file', (done) => {
|
|
327
|
-
|
|
329
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
328
330
|
type: 'object',
|
|
329
331
|
properties: {
|
|
330
332
|
scripts: {
|
|
@@ -350,7 +352,7 @@ describe('Auto Completion Tests', () => {
|
|
|
350
352
|
.then(done, done);
|
|
351
353
|
});
|
|
352
354
|
it('Autocomplete key with default value in middle of file', (done) => {
|
|
353
|
-
|
|
355
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
354
356
|
type: 'object',
|
|
355
357
|
properties: {
|
|
356
358
|
scripts: {
|
|
@@ -379,7 +381,7 @@ describe('Auto Completion Tests', () => {
|
|
|
379
381
|
const languageSettingsSetup = new serviceSetup_1.ServiceSetup().withCompletion();
|
|
380
382
|
languageSettingsSetup.languageSettings.disableDefaultProperties = true;
|
|
381
383
|
languageService.configure(languageSettingsSetup.languageSettings);
|
|
382
|
-
|
|
384
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
383
385
|
type: 'object',
|
|
384
386
|
properties: {
|
|
385
387
|
scripts: {
|
|
@@ -407,7 +409,7 @@ describe('Auto Completion Tests', () => {
|
|
|
407
409
|
const languageSettingsSetup = new serviceSetup_1.ServiceSetup().withCompletion();
|
|
408
410
|
languageSettingsSetup.languageSettings.disableDefaultProperties = true;
|
|
409
411
|
languageService.configure(languageSettingsSetup.languageSettings);
|
|
410
|
-
|
|
412
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
411
413
|
type: 'object',
|
|
412
414
|
properties: {
|
|
413
415
|
scripts: {
|
|
@@ -433,7 +435,7 @@ describe('Auto Completion Tests', () => {
|
|
|
433
435
|
}));
|
|
434
436
|
});
|
|
435
437
|
it('Autocomplete second key in middle of file', (done) => {
|
|
436
|
-
|
|
438
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
437
439
|
type: 'object',
|
|
438
440
|
properties: {
|
|
439
441
|
scripts: {
|
|
@@ -463,7 +465,7 @@ describe('Auto Completion Tests', () => {
|
|
|
463
465
|
.then(done, done);
|
|
464
466
|
});
|
|
465
467
|
it('Autocomplete does not happen right after key object', (done) => {
|
|
466
|
-
|
|
468
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
467
469
|
type: 'object',
|
|
468
470
|
properties: {
|
|
469
471
|
timeout: {
|
|
@@ -481,7 +483,7 @@ describe('Auto Completion Tests', () => {
|
|
|
481
483
|
.then(done, done);
|
|
482
484
|
});
|
|
483
485
|
it('Autocomplete does not happen right after : under an object', (done) => {
|
|
484
|
-
|
|
486
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
485
487
|
type: 'object',
|
|
486
488
|
properties: {
|
|
487
489
|
scripts: {
|
|
@@ -508,7 +510,7 @@ describe('Auto Completion Tests', () => {
|
|
|
508
510
|
.then(done, done);
|
|
509
511
|
});
|
|
510
512
|
it('Autocomplete with defaultSnippet markdown', (done) => {
|
|
511
|
-
|
|
513
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
512
514
|
type: 'object',
|
|
513
515
|
properties: {
|
|
514
516
|
scripts: {
|
|
@@ -535,7 +537,7 @@ describe('Auto Completion Tests', () => {
|
|
|
535
537
|
.then(done, done);
|
|
536
538
|
});
|
|
537
539
|
it('Autocomplete on multi yaml documents in a single file on root', (done) => {
|
|
538
|
-
|
|
540
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
539
541
|
type: 'object',
|
|
540
542
|
properties: {
|
|
541
543
|
timeout: {
|
|
@@ -556,7 +558,7 @@ describe('Auto Completion Tests', () => {
|
|
|
556
558
|
.then(done, done);
|
|
557
559
|
});
|
|
558
560
|
it('Autocomplete on multi yaml documents in a single file on scalar', (done) => {
|
|
559
|
-
|
|
561
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
560
562
|
type: 'object',
|
|
561
563
|
properties: {
|
|
562
564
|
timeout: {
|
|
@@ -577,7 +579,7 @@ describe('Auto Completion Tests', () => {
|
|
|
577
579
|
.then(done, done);
|
|
578
580
|
});
|
|
579
581
|
it('Autocompletion has no results on value when they are not available', (done) => {
|
|
580
|
-
|
|
582
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
581
583
|
type: 'object',
|
|
582
584
|
properties: {
|
|
583
585
|
time: {
|
|
@@ -594,7 +596,7 @@ describe('Auto Completion Tests', () => {
|
|
|
594
596
|
.then(done, done);
|
|
595
597
|
});
|
|
596
598
|
it('Test that properties that have multiple types get auto completed properly', (done) => {
|
|
597
|
-
|
|
599
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
598
600
|
type: 'object',
|
|
599
601
|
properties: {
|
|
600
602
|
scripts: {
|
|
@@ -645,7 +647,7 @@ describe('Auto Completion Tests', () => {
|
|
|
645
647
|
},
|
|
646
648
|
],
|
|
647
649
|
};
|
|
648
|
-
|
|
650
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
649
651
|
const content = 'kind: '; // len: 6
|
|
650
652
|
const validator = parseSetup(content, 6);
|
|
651
653
|
validator
|
|
@@ -668,7 +670,7 @@ describe('Auto Completion Tests', () => {
|
|
|
668
670
|
});
|
|
669
671
|
it('Insert required attributes at correct level', (done) => {
|
|
670
672
|
const schema = require(path.join(__dirname, './fixtures/testRequiredProperties.json'));
|
|
671
|
-
|
|
673
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
672
674
|
const content = '- top:\n prop1: demo\n- ';
|
|
673
675
|
const completion = parseSetup(content, content.length);
|
|
674
676
|
completion
|
|
@@ -682,7 +684,7 @@ describe('Auto Completion Tests', () => {
|
|
|
682
684
|
});
|
|
683
685
|
it('Insert required attributes at correct level even on first element', (done) => {
|
|
684
686
|
const schema = require(path.join(__dirname, './fixtures/testRequiredProperties.json'));
|
|
685
|
-
|
|
687
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
686
688
|
const content = '- ';
|
|
687
689
|
const completion = parseSetup(content, content.length);
|
|
688
690
|
completion
|
|
@@ -696,7 +698,7 @@ describe('Auto Completion Tests', () => {
|
|
|
696
698
|
});
|
|
697
699
|
it('Provide the 3 types when none provided', (done) => {
|
|
698
700
|
const schema = require(path.join(__dirname, './fixtures/testArrayMaxProperties.json'));
|
|
699
|
-
|
|
701
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
700
702
|
const content = '- ';
|
|
701
703
|
const completion = parseSetup(content, content.length);
|
|
702
704
|
completion
|
|
@@ -716,7 +718,7 @@ describe('Auto Completion Tests', () => {
|
|
|
716
718
|
});
|
|
717
719
|
it('Provide the 2 types when one is provided', (done) => {
|
|
718
720
|
const schema = require(path.join(__dirname, './fixtures/testArrayMaxProperties.json'));
|
|
719
|
-
|
|
721
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
720
722
|
const content = '- prop1:\n ';
|
|
721
723
|
const completion = parseSetup(content, content.length);
|
|
722
724
|
completion
|
|
@@ -733,7 +735,7 @@ describe('Auto Completion Tests', () => {
|
|
|
733
735
|
});
|
|
734
736
|
it('Provide the 2 types when one is provided and the second is typed', (done) => {
|
|
735
737
|
const schema = require(path.join(__dirname, './fixtures/testArrayMaxProperties.json'));
|
|
736
|
-
|
|
738
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
737
739
|
const content = '- prop1:\n p';
|
|
738
740
|
const completion = parseSetup(content, content.length);
|
|
739
741
|
completion
|
|
@@ -750,7 +752,7 @@ describe('Auto Completion Tests', () => {
|
|
|
750
752
|
});
|
|
751
753
|
it('Provide no completion when maxProperties reached', (done) => {
|
|
752
754
|
const schema = require(path.join(__dirname, './fixtures/testArrayMaxProperties.json'));
|
|
753
|
-
|
|
755
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
754
756
|
const content = '- prop1:\n prop2:\n ';
|
|
755
757
|
const completion = parseSetup(content, content.length);
|
|
756
758
|
completion
|
|
@@ -760,7 +762,7 @@ describe('Auto Completion Tests', () => {
|
|
|
760
762
|
.then(done, done);
|
|
761
763
|
});
|
|
762
764
|
it('Autocompletion should escape @', async () => {
|
|
763
|
-
|
|
765
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
764
766
|
type: 'object',
|
|
765
767
|
properties: {
|
|
766
768
|
'@type': {
|
|
@@ -777,7 +779,7 @@ describe('Auto Completion Tests', () => {
|
|
|
777
779
|
}));
|
|
778
780
|
});
|
|
779
781
|
it('Autocompletion should escape colon when indicating map', async () => {
|
|
780
|
-
|
|
782
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
781
783
|
type: 'object',
|
|
782
784
|
properties: {
|
|
783
785
|
'test: colon': {
|
|
@@ -799,7 +801,7 @@ describe('Auto Completion Tests', () => {
|
|
|
799
801
|
}));
|
|
800
802
|
});
|
|
801
803
|
it('Autocompletion should not escape colon when no white-space following', async () => {
|
|
802
|
-
|
|
804
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
803
805
|
type: 'object',
|
|
804
806
|
properties: {
|
|
805
807
|
'test:colon': {
|
|
@@ -821,7 +823,7 @@ describe('Auto Completion Tests', () => {
|
|
|
821
823
|
}));
|
|
822
824
|
});
|
|
823
825
|
it('Autocompletion should not escape colon when no key part present', async () => {
|
|
824
|
-
|
|
826
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
825
827
|
type: 'object',
|
|
826
828
|
properties: {
|
|
827
829
|
':colon': {
|
|
@@ -867,7 +869,7 @@ describe('Auto Completion Tests', () => {
|
|
|
867
869
|
};
|
|
868
870
|
it('should suggest "then" block if "if" match filePatternAssociation', async () => {
|
|
869
871
|
schema.if.filePatternAssociation = testHelper_1.SCHEMA_ID;
|
|
870
|
-
|
|
872
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
871
873
|
const content = 'name: aName\n ';
|
|
872
874
|
const completion = await parseSetup(content, content.length);
|
|
873
875
|
(0, chai_1.expect)(completion.items.map((i) => i.label)).to.deep.equal(['pineapple', 'basket']);
|
|
@@ -877,7 +879,7 @@ describe('Auto Completion Tests', () => {
|
|
|
877
879
|
describe('Array Specific Tests', function () {
|
|
878
880
|
it('Should insert empty array item', (done) => {
|
|
879
881
|
const schema = require(path.join(__dirname, './fixtures/testStringArray.json'));
|
|
880
|
-
|
|
882
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
881
883
|
const content = 'fooBa'; // len: 5
|
|
882
884
|
const completion = parseSetup(content, content.lastIndexOf('Ba') + 2); // pos: 3+2
|
|
883
885
|
completion
|
|
@@ -887,7 +889,7 @@ describe('Auto Completion Tests', () => {
|
|
|
887
889
|
.then(done, done);
|
|
888
890
|
});
|
|
889
891
|
it('Array autocomplete without word and extra space', (done) => {
|
|
890
|
-
|
|
892
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
891
893
|
type: 'object',
|
|
892
894
|
properties: {
|
|
893
895
|
authors: {
|
|
@@ -915,7 +917,7 @@ describe('Auto Completion Tests', () => {
|
|
|
915
917
|
.then(done, done);
|
|
916
918
|
});
|
|
917
919
|
it('Array autocomplete without word and autocompletion beside -', (done) => {
|
|
918
|
-
|
|
920
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
919
921
|
type: 'object',
|
|
920
922
|
properties: {
|
|
921
923
|
authors: {
|
|
@@ -943,7 +945,7 @@ describe('Auto Completion Tests', () => {
|
|
|
943
945
|
.then(done, done);
|
|
944
946
|
});
|
|
945
947
|
it('Array autocomplete without word on space before array symbol', (done) => {
|
|
946
|
-
|
|
948
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
947
949
|
type: 'object',
|
|
948
950
|
properties: {
|
|
949
951
|
authors: {
|
|
@@ -974,7 +976,7 @@ describe('Auto Completion Tests', () => {
|
|
|
974
976
|
.then(done, done);
|
|
975
977
|
});
|
|
976
978
|
it('Array autocomplete on empty node with array from schema', (done) => {
|
|
977
|
-
|
|
979
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
978
980
|
type: 'object',
|
|
979
981
|
properties: {
|
|
980
982
|
authors: {
|
|
@@ -1005,7 +1007,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1005
1007
|
.then(done, done);
|
|
1006
1008
|
});
|
|
1007
1009
|
it('Array autocomplete with letter', (done) => {
|
|
1008
|
-
|
|
1010
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1009
1011
|
type: 'object',
|
|
1010
1012
|
properties: {
|
|
1011
1013
|
authors: {
|
|
@@ -1033,7 +1035,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1033
1035
|
.then(done, done);
|
|
1034
1036
|
});
|
|
1035
1037
|
it('Array autocomplete without word (second item)', (done) => {
|
|
1036
|
-
|
|
1038
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1037
1039
|
type: 'object',
|
|
1038
1040
|
properties: {
|
|
1039
1041
|
authors: {
|
|
@@ -1064,7 +1066,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1064
1066
|
.then(done, done);
|
|
1065
1067
|
});
|
|
1066
1068
|
it('Array autocomplete with letter (second item)', (done) => {
|
|
1067
|
-
|
|
1069
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1068
1070
|
type: 'object',
|
|
1069
1071
|
properties: {
|
|
1070
1072
|
authors: {
|
|
@@ -1095,7 +1097,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1095
1097
|
.then(done, done);
|
|
1096
1098
|
});
|
|
1097
1099
|
it('Autocompletion after array', (done) => {
|
|
1098
|
-
|
|
1100
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1099
1101
|
type: 'object',
|
|
1100
1102
|
properties: {
|
|
1101
1103
|
authors: {
|
|
@@ -1129,7 +1131,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1129
1131
|
.then(done, done);
|
|
1130
1132
|
});
|
|
1131
1133
|
it('Autocompletion after array with depth - no indent', (done) => {
|
|
1132
|
-
|
|
1134
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1133
1135
|
type: 'object',
|
|
1134
1136
|
properties: {
|
|
1135
1137
|
archive: {
|
|
@@ -1168,7 +1170,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1168
1170
|
.then(done, done);
|
|
1169
1171
|
});
|
|
1170
1172
|
it('Autocompletion after array with depth - indent', (done) => {
|
|
1171
|
-
|
|
1173
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1172
1174
|
type: 'object',
|
|
1173
1175
|
properties: {
|
|
1174
1176
|
archive: {
|
|
@@ -1205,7 +1207,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1205
1207
|
.then(done, done);
|
|
1206
1208
|
});
|
|
1207
1209
|
it('Array of enum autocomplete without word on array symbol', (done) => {
|
|
1208
|
-
|
|
1210
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1209
1211
|
type: 'object',
|
|
1210
1212
|
properties: {
|
|
1211
1213
|
references: {
|
|
@@ -1228,7 +1230,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1228
1230
|
.then(done, done);
|
|
1229
1231
|
});
|
|
1230
1232
|
it('Array of enum autocomplete without word', (done) => {
|
|
1231
|
-
|
|
1233
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1232
1234
|
type: 'object',
|
|
1233
1235
|
properties: {
|
|
1234
1236
|
references: {
|
|
@@ -1251,7 +1253,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1251
1253
|
.then(done, done);
|
|
1252
1254
|
});
|
|
1253
1255
|
it('Array of enum autocomplete with letter', (done) => {
|
|
1254
|
-
|
|
1256
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1255
1257
|
type: 'object',
|
|
1256
1258
|
properties: {
|
|
1257
1259
|
references: {
|
|
@@ -1276,7 +1278,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1276
1278
|
it('Array of objects autocomplete with 4 space indentation check', async () => {
|
|
1277
1279
|
const languageSettingsSetup = new serviceSetup_1.ServiceSetup().withCompletion().withIndentation(' ');
|
|
1278
1280
|
languageService.configure(languageSettingsSetup.languageSettings);
|
|
1279
|
-
|
|
1281
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1280
1282
|
type: 'object',
|
|
1281
1283
|
properties: {
|
|
1282
1284
|
metadata: {
|
|
@@ -1315,7 +1317,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1315
1317
|
it('Array of objects autocomplete with 2 space indentation check', async () => {
|
|
1316
1318
|
const languageSettingsSetup = new serviceSetup_1.ServiceSetup().withCompletion().withIndentation(' ');
|
|
1317
1319
|
languageService.configure(languageSettingsSetup.languageSettings);
|
|
1318
|
-
|
|
1320
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1319
1321
|
type: 'object',
|
|
1320
1322
|
properties: {
|
|
1321
1323
|
metadata: {
|
|
@@ -1353,7 +1355,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1353
1355
|
it('Array of objects autocomplete with 3 space indentation check', async () => {
|
|
1354
1356
|
const languageSettingsSetup = new serviceSetup_1.ServiceSetup().withCompletion().withIndentation(' ');
|
|
1355
1357
|
languageService.configure(languageSettingsSetup.languageSettings);
|
|
1356
|
-
|
|
1358
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1357
1359
|
type: 'object',
|
|
1358
1360
|
properties: {
|
|
1359
1361
|
metadata: {
|
|
@@ -1413,7 +1415,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1413
1415
|
it('Object in array with 4 space indentation check', async () => {
|
|
1414
1416
|
const languageSettingsSetup = new serviceSetup_1.ServiceSetup().withCompletion().withIndentation(' ');
|
|
1415
1417
|
languageService.configure(languageSettingsSetup.languageSettings);
|
|
1416
|
-
|
|
1418
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1417
1419
|
type: 'object',
|
|
1418
1420
|
properties: {
|
|
1419
1421
|
rules: {
|
|
@@ -1482,7 +1484,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1482
1484
|
});
|
|
1483
1485
|
describe('JSON Schema 7 Specific Tests', function () {
|
|
1484
1486
|
it('Autocomplete works with examples', (done) => {
|
|
1485
|
-
|
|
1487
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1486
1488
|
type: 'object',
|
|
1487
1489
|
properties: {
|
|
1488
1490
|
foodItems: {
|
|
@@ -1506,7 +1508,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1506
1508
|
.then(done, done);
|
|
1507
1509
|
});
|
|
1508
1510
|
it('Autocomplete works with const', (done) => {
|
|
1509
|
-
|
|
1511
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1510
1512
|
type: 'object',
|
|
1511
1513
|
properties: {
|
|
1512
1514
|
fruit: {
|
|
@@ -1526,7 +1528,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1526
1528
|
.then(done, done);
|
|
1527
1529
|
});
|
|
1528
1530
|
it('Autocomplete should suggest prop with const value', (done) => {
|
|
1529
|
-
|
|
1531
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1530
1532
|
type: 'object',
|
|
1531
1533
|
properties: {
|
|
1532
1534
|
fruit: {
|
|
@@ -1546,7 +1548,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1546
1548
|
.then(done, done);
|
|
1547
1549
|
});
|
|
1548
1550
|
it('Should insert quotation value if there is special char', async () => {
|
|
1549
|
-
|
|
1551
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1550
1552
|
type: 'object',
|
|
1551
1553
|
properties: {
|
|
1552
1554
|
from: {
|
|
@@ -1566,7 +1568,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1566
1568
|
describe('Indentation Specific Tests', function () {
|
|
1567
1569
|
it('Indent should be considered with position relative to slash', (done) => {
|
|
1568
1570
|
const schema = require(path.join(__dirname, './fixtures/testArrayIndent.json'));
|
|
1569
|
-
|
|
1571
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
1570
1572
|
const content = 'install:\n - he'; // len: 15
|
|
1571
1573
|
const completion = parseSetup(content, content.lastIndexOf('he') + 2); // pos: 13+2
|
|
1572
1574
|
completion
|
|
@@ -1580,7 +1582,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1580
1582
|
});
|
|
1581
1583
|
it('Large indent should be considered with position relative to slash', (done) => {
|
|
1582
1584
|
const schema = require(path.join(__dirname, './fixtures/testArrayIndent.json'));
|
|
1583
|
-
|
|
1585
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
1584
1586
|
const content = 'install:\n - he'; // len: 25
|
|
1585
1587
|
const completion = parseSetup(content, content.lastIndexOf('he') + 2); // pos: 23+2
|
|
1586
1588
|
completion
|
|
@@ -1594,7 +1596,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1594
1596
|
});
|
|
1595
1597
|
it('Tab indent should be considered with position relative to slash', (done) => {
|
|
1596
1598
|
const schema = require(path.join(__dirname, './fixtures/testArrayIndent.json'));
|
|
1597
|
-
|
|
1599
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
1598
1600
|
const content = 'install:\n -\t he'; // len: 27
|
|
1599
1601
|
const completion = parseSetup(content, content.lastIndexOf('he') + 2); // pos: 25+2
|
|
1600
1602
|
completion
|
|
@@ -1668,7 +1670,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1668
1670
|
it('should not provide modeline completion on first character when schema is associated', async () => {
|
|
1669
1671
|
const specificSchemaId = path.join(__dirname, 'test.yaml');
|
|
1670
1672
|
const testTextDocument = (0, testHelper_1.setupSchemaIDTextDocument)('', specificSchemaId);
|
|
1671
|
-
|
|
1673
|
+
schemaProvider.addSchema(specificSchemaId, {
|
|
1672
1674
|
type: 'object',
|
|
1673
1675
|
properties: {
|
|
1674
1676
|
name: {
|
|
@@ -1724,7 +1726,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1724
1726
|
it('4 space indentation', async () => {
|
|
1725
1727
|
const languageSettingsSetup = new serviceSetup_1.ServiceSetup().withCompletion().withIndentation(' ');
|
|
1726
1728
|
languageService.configure(languageSettingsSetup.languageSettings);
|
|
1727
|
-
|
|
1729
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1728
1730
|
type: 'object',
|
|
1729
1731
|
properties: {
|
|
1730
1732
|
scripts: {
|
|
@@ -1752,7 +1754,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1752
1754
|
});
|
|
1753
1755
|
describe('Bug fixes', () => {
|
|
1754
1756
|
it('Object in array completion indetetion', async () => {
|
|
1755
|
-
|
|
1757
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1756
1758
|
type: 'object',
|
|
1757
1759
|
properties: {
|
|
1758
1760
|
components: {
|
|
@@ -1802,7 +1804,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1802
1804
|
(0, chai_1.expect)(completion.items[0].textEdit.newText).to.equal('settings:\n data:\n arrayItems:\n - show: ${1:true}\n id: $2');
|
|
1803
1805
|
});
|
|
1804
1806
|
it('Object completion', (done) => {
|
|
1805
|
-
|
|
1807
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1806
1808
|
type: 'object',
|
|
1807
1809
|
properties: {
|
|
1808
1810
|
env: {
|
|
@@ -1825,7 +1827,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1825
1827
|
.then(done, done);
|
|
1826
1828
|
});
|
|
1827
1829
|
it('Complex default object completion', (done) => {
|
|
1828
|
-
|
|
1830
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1829
1831
|
type: 'object',
|
|
1830
1832
|
properties: {
|
|
1831
1833
|
env: {
|
|
@@ -1852,7 +1854,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1852
1854
|
.then(done, done);
|
|
1853
1855
|
});
|
|
1854
1856
|
it('should handle array schema without items', async () => {
|
|
1855
|
-
|
|
1857
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1856
1858
|
type: 'array',
|
|
1857
1859
|
items: {
|
|
1858
1860
|
anyOf: [
|
|
@@ -1883,7 +1885,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1883
1885
|
(0, chai_1.expect)(completion.items[0].insertText).eq('fooBar:\n name: $1\n aaa:\n - $2');
|
|
1884
1886
|
});
|
|
1885
1887
|
it('auto completion based on the list indentation', async () => {
|
|
1886
|
-
|
|
1888
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1887
1889
|
type: 'array',
|
|
1888
1890
|
items: {
|
|
1889
1891
|
type: 'object',
|
|
@@ -1915,7 +1917,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1915
1917
|
(0, chai_1.expect)(completion.items[0].insertText).eq('prop2: ');
|
|
1916
1918
|
});
|
|
1917
1919
|
it('should complete string which contains number in default value', async () => {
|
|
1918
|
-
|
|
1920
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1919
1921
|
type: 'object',
|
|
1920
1922
|
properties: {
|
|
1921
1923
|
env: {
|
|
@@ -1938,7 +1940,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1938
1940
|
(0, chai_1.expect)(envItem.textEdit.newText).equal('env: ${1:1}');
|
|
1939
1941
|
});
|
|
1940
1942
|
it('should complete string which contains number in examples values', async () => {
|
|
1941
|
-
|
|
1943
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1942
1944
|
type: 'object',
|
|
1943
1945
|
properties: {
|
|
1944
1946
|
fooBar: {
|
|
@@ -1960,7 +1962,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1960
1962
|
(0, chai_1.expect)(trueItem.textEdit.newText).equal('"true"');
|
|
1961
1963
|
});
|
|
1962
1964
|
it('should provide label as string for examples completion item', async () => {
|
|
1963
|
-
|
|
1965
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1964
1966
|
type: 'object',
|
|
1965
1967
|
properties: {
|
|
1966
1968
|
fooBar: {
|
|
@@ -1977,7 +1979,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1977
1979
|
(0, chai_1.expect)(completion.items).length(1);
|
|
1978
1980
|
});
|
|
1979
1981
|
it('should provide completion for flow map', async () => {
|
|
1980
|
-
|
|
1982
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1981
1983
|
type: 'object',
|
|
1982
1984
|
properties: { A: { type: 'string', enum: ['a1', 'a2'] }, B: { type: 'string', enum: ['b1', 'b2'] } },
|
|
1983
1985
|
});
|
|
@@ -1988,7 +1990,7 @@ describe('Auto Completion Tests', () => {
|
|
|
1988
1990
|
(0, chai_1.expect)(completion.items[1]).eql((0, verifyError_1.createExpectedCompletion)('a2', 'a2', 0, 4, 0, 4, 12, vscode_languageserver_types_1.InsertTextFormat.Snippet, { documentation: undefined }));
|
|
1989
1991
|
});
|
|
1990
1992
|
it('should provide completion for "null" enum value', async () => {
|
|
1991
|
-
|
|
1993
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
1992
1994
|
type: 'object',
|
|
1993
1995
|
properties: {
|
|
1994
1996
|
kind: {
|
|
@@ -2003,7 +2005,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2003
2005
|
(0, chai_1.expect)(completion.items[1]).eql((0, verifyError_1.createExpectedCompletion)('null', 'null', 0, 6, 0, 6, 12, vscode_languageserver_types_1.InsertTextFormat.Snippet, { documentation: undefined }));
|
|
2004
2006
|
});
|
|
2005
2007
|
it('should provide completion for empty file', async () => {
|
|
2006
|
-
|
|
2008
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
2007
2009
|
oneOf: [
|
|
2008
2010
|
{
|
|
2009
2011
|
type: 'object',
|
|
@@ -2036,7 +2038,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2036
2038
|
(0, chai_1.expect)(completion.items[1]).eql((0, verifyError_1.createExpectedCompletion)('name', 'name: ', 2, 0, 2, 0, 10, vscode_languageserver_types_1.InsertTextFormat.Snippet, { documentation: '' }));
|
|
2037
2039
|
});
|
|
2038
2040
|
it('should not provide additional ":" on existing property completion', async () => {
|
|
2039
|
-
|
|
2041
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
2040
2042
|
type: 'object',
|
|
2041
2043
|
properties: {
|
|
2042
2044
|
kind: {
|
|
@@ -2051,7 +2053,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2051
2053
|
(0, chai_1.expect)(completion.items[0]).eql((0, verifyError_1.createExpectedCompletion)('kind', 'kind', 0, 0, 0, 4, 10, vscode_languageserver_types_1.InsertTextFormat.Snippet, { documentation: '' }));
|
|
2052
2054
|
});
|
|
2053
2055
|
it('should not provide additional ":" on existing property completion when try to complete partial property', async () => {
|
|
2054
|
-
|
|
2056
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
2055
2057
|
type: 'object',
|
|
2056
2058
|
properties: {
|
|
2057
2059
|
kind: {
|
|
@@ -2066,7 +2068,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2066
2068
|
(0, chai_1.expect)(completion.items[0]).eql((0, verifyError_1.createExpectedCompletion)('kind', 'kind', 0, 0, 0, 2, 10, vscode_languageserver_types_1.InsertTextFormat.Snippet, { documentation: '' }));
|
|
2067
2069
|
});
|
|
2068
2070
|
it('should use markdownDescription for property completion', async () => {
|
|
2069
|
-
|
|
2071
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
2070
2072
|
type: 'object',
|
|
2071
2073
|
properties: {
|
|
2072
2074
|
kind: {
|
|
@@ -2088,7 +2090,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2088
2090
|
}));
|
|
2089
2091
|
});
|
|
2090
2092
|
it('should follow $ref in additionalItems', async () => {
|
|
2091
|
-
|
|
2093
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
2092
2094
|
type: 'object',
|
|
2093
2095
|
properties: {
|
|
2094
2096
|
test: {
|
|
@@ -2116,7 +2118,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2116
2118
|
(0, chai_1.expect)(completion.items[0]).eql((0, verifyError_1.createExpectedCompletion)('and', 'and', 2, 6, 2, 6, 12, vscode_languageserver_types_1.InsertTextFormat.Snippet, { documentation: undefined }));
|
|
2117
2119
|
});
|
|
2118
2120
|
it('should follow $ref in additionalItems: extra space after cursor', async () => {
|
|
2119
|
-
|
|
2121
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
2120
2122
|
type: 'object',
|
|
2121
2123
|
properties: {
|
|
2122
2124
|
test: {
|
|
@@ -2144,7 +2146,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2144
2146
|
(0, chai_1.expect)(completion.items[0]).eql((0, verifyError_1.createExpectedCompletion)('and', 'and', 2, 6, 2, 8, 12, vscode_languageserver_types_1.InsertTextFormat.Snippet, { documentation: undefined }));
|
|
2145
2147
|
});
|
|
2146
2148
|
it('should follow $ref in additionalItems for flow style array', async () => {
|
|
2147
|
-
|
|
2149
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
2148
2150
|
type: 'object',
|
|
2149
2151
|
properties: {
|
|
2150
2152
|
test: {
|
|
@@ -2182,7 +2184,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2182
2184
|
(0, chai_1.expect)(result.items).to.be.empty;
|
|
2183
2185
|
});
|
|
2184
2186
|
it('should convert to string non string completion label', async () => {
|
|
2185
|
-
|
|
2187
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
2186
2188
|
type: 'object',
|
|
2187
2189
|
properties: {
|
|
2188
2190
|
version: {
|
|
@@ -2201,7 +2203,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2201
2203
|
describe('Array completion', () => {
|
|
2202
2204
|
it('Simple array object completion with "-" without any item', (done) => {
|
|
2203
2205
|
const schema = require(path.join(__dirname, './fixtures/testArrayCompletionSchema.json'));
|
|
2204
|
-
|
|
2206
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
2205
2207
|
const content = 'test_simpleArrayObject:\n -';
|
|
2206
2208
|
const completion = parseSetup(content, content.length);
|
|
2207
2209
|
completion
|
|
@@ -2214,7 +2216,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2214
2216
|
});
|
|
2215
2217
|
it('Simple array object completion without "-" after array item', (done) => {
|
|
2216
2218
|
const schema = require(path.join(__dirname, './fixtures/testArrayCompletionSchema.json'));
|
|
2217
|
-
|
|
2219
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
2218
2220
|
const content = 'test_simpleArrayObject:\n - obj1:\n name: 1\n ';
|
|
2219
2221
|
const completion = parseSetup(content, content.length);
|
|
2220
2222
|
completion
|
|
@@ -2226,7 +2228,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2226
2228
|
});
|
|
2227
2229
|
it('Simple array object completion with "-" after array item', (done) => {
|
|
2228
2230
|
const schema = require(path.join(__dirname, './fixtures/testArrayCompletionSchema.json'));
|
|
2229
|
-
|
|
2231
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
2230
2232
|
const content = 'test_simpleArrayObject:\n - obj1:\n name: 1\n -';
|
|
2231
2233
|
const completion = parseSetup(content, content.length);
|
|
2232
2234
|
completion
|
|
@@ -2239,7 +2241,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2239
2241
|
});
|
|
2240
2242
|
it('Array anyOf two objects completion with "- " without any item', (done) => {
|
|
2241
2243
|
const schema = require(path.join(__dirname, './fixtures/testArrayCompletionSchema.json'));
|
|
2242
|
-
|
|
2244
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
2243
2245
|
const content = 'test_array_anyOf_2objects:\n - ';
|
|
2244
2246
|
const completion = parseSetup(content, content.length);
|
|
2245
2247
|
completion
|
|
@@ -2254,7 +2256,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2254
2256
|
});
|
|
2255
2257
|
it('Array anyOf two objects completion with "-" without any item', (done) => {
|
|
2256
2258
|
const schema = require(path.join(__dirname, './fixtures/testArrayCompletionSchema.json'));
|
|
2257
|
-
|
|
2259
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
2258
2260
|
const content = 'test_array_anyOf_2objects:\n -';
|
|
2259
2261
|
const completion = parseSetup(content, content.length);
|
|
2260
2262
|
completion
|
|
@@ -2267,7 +2269,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2267
2269
|
});
|
|
2268
2270
|
it('Simple array object completion without "-" befor array empty item', (done) => {
|
|
2269
2271
|
const schema = require(path.join(__dirname, './fixtures/testArrayCompletionSchema.json'));
|
|
2270
|
-
|
|
2272
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
2271
2273
|
const content = 'test_simpleArrayObject:\n |\n| -'; // len: 30, pos: 26
|
|
2272
2274
|
const completion = parseSetup(content);
|
|
2273
2275
|
completion
|
|
@@ -2279,7 +2281,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2279
2281
|
});
|
|
2280
2282
|
it('Array anyOf two objects completion without "-" after array item', (done) => {
|
|
2281
2283
|
const schema = require(path.join(__dirname, './fixtures/testArrayCompletionSchema.json'));
|
|
2282
|
-
|
|
2284
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
2283
2285
|
const content = 'test_array_anyOf_2objects:\n - obj1:\n name: 1\n ';
|
|
2284
2286
|
const completion = parseSetup(content, content.length);
|
|
2285
2287
|
completion
|
|
@@ -2290,7 +2292,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2290
2292
|
});
|
|
2291
2293
|
it('Array nested anyOf without "-" should return all array items', (done) => {
|
|
2292
2294
|
const schema = require(path.join(__dirname, './fixtures/testArrayCompletionSchema.json'));
|
|
2293
|
-
|
|
2295
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
2294
2296
|
const content = 'test_array_nested_anyOf:\n - obj1:\n name:1\n ';
|
|
2295
2297
|
const completion = parseSetup(content, content.length);
|
|
2296
2298
|
completion
|
|
@@ -2301,7 +2303,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2301
2303
|
});
|
|
2302
2304
|
it('Array anyOf two objects completion with "-" after array item', (done) => {
|
|
2303
2305
|
const schema = require(path.join(__dirname, './fixtures/testArrayCompletionSchema.json'));
|
|
2304
|
-
|
|
2306
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
2305
2307
|
const content = 'test_array_anyOf_2objects:\n - obj1:\n name: 1\n -';
|
|
2306
2308
|
const completion = parseSetup(content, content.length);
|
|
2307
2309
|
completion
|
|
@@ -2314,7 +2316,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2314
2316
|
});
|
|
2315
2317
|
it('Array anyOf two objects completion indentation', async () => {
|
|
2316
2318
|
const schema = require(path.join(__dirname, './fixtures/testArrayCompletionSchema.json'));
|
|
2317
|
-
|
|
2319
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
2318
2320
|
const content = 'test_array_anyOf_2objects:\n - obj';
|
|
2319
2321
|
const completion = await parseSetup(content, content.length);
|
|
2320
2322
|
(0, chai_1.expect)(completion.items.length).is.equal(4);
|
|
@@ -2323,7 +2325,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2323
2325
|
(0, chai_1.expect)(obj1.textEdit.newText).equal('obj1:\n ');
|
|
2324
2326
|
});
|
|
2325
2327
|
it('Autocomplete key in nested object while typing', (done) => {
|
|
2326
|
-
|
|
2328
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, {
|
|
2327
2329
|
type: 'object',
|
|
2328
2330
|
properties: {
|
|
2329
2331
|
parent: {
|
|
@@ -2417,7 +2419,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2417
2419
|
},
|
|
2418
2420
|
],
|
|
2419
2421
|
};
|
|
2420
|
-
|
|
2422
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
2421
2423
|
const content = '';
|
|
2422
2424
|
const result = await parseSetup(content, content.length);
|
|
2423
2425
|
(0, chai_1.expect)(result.items.length).equal(4);
|
|
@@ -2440,7 +2442,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2440
2442
|
},
|
|
2441
2443
|
],
|
|
2442
2444
|
};
|
|
2443
|
-
|
|
2445
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
2444
2446
|
const content = '';
|
|
2445
2447
|
const result = await parseSetup(content, content.length);
|
|
2446
2448
|
(0, chai_1.expect)(result.items.length).equal(5);
|
|
@@ -2477,7 +2479,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2477
2479
|
},
|
|
2478
2480
|
type: 'array',
|
|
2479
2481
|
};
|
|
2480
|
-
|
|
2482
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
2481
2483
|
const content = '- ';
|
|
2482
2484
|
const result = await parseSetup(content, content.length);
|
|
2483
2485
|
(0, chai_1.expect)(result.items.length).equal(5);
|
|
@@ -2511,7 +2513,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2511
2513
|
},
|
|
2512
2514
|
],
|
|
2513
2515
|
};
|
|
2514
|
-
|
|
2516
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
2515
2517
|
const content = '';
|
|
2516
2518
|
const result = await parseSetup(content, content.length);
|
|
2517
2519
|
(0, chai_1.expect)(result.items.length).equal(3);
|
|
@@ -2528,7 +2530,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2528
2530
|
definitions: { obj1 },
|
|
2529
2531
|
$ref: '#/definitions/obj1',
|
|
2530
2532
|
};
|
|
2531
|
-
|
|
2533
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
2532
2534
|
const content = 'type: typeObj1\n';
|
|
2533
2535
|
const result = await parseSetup(content, content.length);
|
|
2534
2536
|
(0, chai_1.expect)(result.items.length).equal(2);
|
|
@@ -2559,7 +2561,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2559
2561
|
required: ['type', 'options', 'prop1'],
|
|
2560
2562
|
type: 'object',
|
|
2561
2563
|
};
|
|
2562
|
-
|
|
2564
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
2563
2565
|
const content = '';
|
|
2564
2566
|
const result = await parseSetup(content, content.length);
|
|
2565
2567
|
(0, chai_1.expect)(result.items.length).equal(3);
|
|
@@ -2589,7 +2591,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2589
2591
|
},
|
|
2590
2592
|
],
|
|
2591
2593
|
};
|
|
2592
|
-
|
|
2594
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
2593
2595
|
const content = '';
|
|
2594
2596
|
const result = await parseSetup(content, content.length);
|
|
2595
2597
|
(0, chai_1.expect)(result.items.map((i) => i.label)).to.have.members(['Object1', 'obj2']);
|
|
@@ -2610,7 +2612,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2610
2612
|
},
|
|
2611
2613
|
},
|
|
2612
2614
|
};
|
|
2613
|
-
|
|
2615
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
2614
2616
|
const content = 'name:\n ';
|
|
2615
2617
|
const result = await parseSetup(content, content.length);
|
|
2616
2618
|
(0, chai_1.expect)(result.items.map((i) => i.label)).to.have.members(['Object1', 'obj2']);
|
|
@@ -2630,7 +2632,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2630
2632
|
},
|
|
2631
2633
|
type: 'array',
|
|
2632
2634
|
};
|
|
2633
|
-
|
|
2635
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
2634
2636
|
const content = '- ';
|
|
2635
2637
|
const result = await parseSetup(content, content.length);
|
|
2636
2638
|
(0, chai_1.expect)(result.items.map((i) => i.label)).to.have.members(['Object1', 'obj2']);
|
|
@@ -2640,7 +2642,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2640
2642
|
definitions: { obj1 },
|
|
2641
2643
|
$ref: '#/definitions/obj1',
|
|
2642
2644
|
};
|
|
2643
|
-
|
|
2645
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
2644
2646
|
const content = 'type: typeObj1\n';
|
|
2645
2647
|
const result = await parseSetup(content, content.length);
|
|
2646
2648
|
(0, chai_1.expect)(result.items.map((i) => i.label)).to.have.members(['options', 'Object1']);
|
|
@@ -2650,7 +2652,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2650
2652
|
definitions: { obj1 },
|
|
2651
2653
|
$ref: '#/definitions/obj1',
|
|
2652
2654
|
};
|
|
2653
|
-
|
|
2655
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
2654
2656
|
const content = 'ty';
|
|
2655
2657
|
const result = await parseSetup(content, content.length);
|
|
2656
2658
|
(0, chai_1.expect)(result.items.map((i) => i.label)).to.have.members(['type', 'options', 'Object1']);
|
|
@@ -2662,7 +2664,7 @@ describe('Auto Completion Tests', () => {
|
|
|
2662
2664
|
vegetable: {},
|
|
2663
2665
|
},
|
|
2664
2666
|
};
|
|
2665
|
-
|
|
2667
|
+
schemaProvider.addSchema(testHelper_1.SCHEMA_ID, schema);
|
|
2666
2668
|
const content = '';
|
|
2667
2669
|
const result = await parseSetup(content, content.length);
|
|
2668
2670
|
(0, chai_1.expect)(result.items.map((i) => i.label)).to.have.members(['fruit', 'vegetable']);
|