yaml-language-server 1.9.1-44bce9b.0 → 1.9.1-eae5206.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.
@@ -41,13 +41,13 @@ describe('Auto Completion Tests', () => {
41
41
  * Generates a completion list for the given document and caret (cursor) position.
42
42
  * @param content The content of the document.
43
43
  * @param position The position of the caret in the document.
44
- * Alternatively, can be omitted if the caret is located in the content using the symbol `|:|`.
44
+ * Alternatively, `position` can be omitted if the caret is located in the content using `|` bookends.
45
+ * For example, `content = 'ab|c|d'` places the caret over the `'c'`, at `position = 2`
45
46
  * @returns A list of valid completions.
46
47
  */
47
48
  function parseSetup(content, position) {
48
49
  if (typeof position === 'undefined') {
49
- position = content.indexOf('|:|');
50
- content = content.replace('|:|', '');
50
+ ({ content, position } = testHelper_1.caretPosition(content));
51
51
  }
52
52
  const testTextDocument = testHelper_1.setupSchemaIDTextDocument(content);
53
53
  yamlSettings.documents = new yamlSettings_1.TextDocumentTestManager();
@@ -72,8 +72,8 @@ describe('Auto Completion Tests', () => {
72
72
  },
73
73
  },
74
74
  });
75
- const content = '|:|';
76
- const completion = parseSetup(content);
75
+ const content = '';
76
+ const completion = parseSetup(content, 0);
77
77
  completion
78
78
  .then(function (result) {
79
79
  assert.equal(result.items.length, 1);
@@ -92,8 +92,8 @@ describe('Auto Completion Tests', () => {
92
92
  },
93
93
  },
94
94
  });
95
- const content = 'na|:|';
96
- const completion = parseSetup(content);
95
+ const content = 'na'; // len: 2
96
+ const completion = parseSetup(content, 2);
97
97
  completion
98
98
  .then(function (result) {
99
99
  assert.equal(result.items.length, 1);
@@ -113,7 +113,7 @@ describe('Auto Completion Tests', () => {
113
113
  },
114
114
  },
115
115
  });
116
- const content = 'name';
116
+ const content = 'name'; // len: 4
117
117
  const completion = parseSetup(content, 10);
118
118
  completion
119
119
  .then(function (result) {
@@ -134,7 +134,7 @@ describe('Auto Completion Tests', () => {
134
134
  },
135
135
  },
136
136
  });
137
- const content = 'name: ';
137
+ const content = 'name: '; // len: 6
138
138
  const completion = parseSetup(content, 12);
139
139
  completion
140
140
  .then(function (result) {
@@ -155,7 +155,7 @@ describe('Auto Completion Tests', () => {
155
155
  },
156
156
  },
157
157
  });
158
- const content = 'name: ';
158
+ const content = 'name: '; // len: 6
159
159
  const completion = yield parseSetup(content, 6);
160
160
  assert.strictEqual(completion.items.length, 1);
161
161
  assert.deepStrictEqual(completion.items[0], verifyError_1.createExpectedCompletion('"yaml"', '"yaml"', 0, 6, 0, 6, 12, 2, {
@@ -172,7 +172,7 @@ describe('Auto Completion Tests', () => {
172
172
  },
173
173
  },
174
174
  });
175
- const content = 'nam|:|e';
175
+ const content = 'nam|e|'; // len: 4, pos: 3
176
176
  const completion = yield parseSetup(content);
177
177
  assert.strictEqual(completion.items.length, 1);
178
178
  assert.deepStrictEqual(completion.items[0], verifyError_1.createExpectedCompletion('name', 'name: ${1:"yaml"}', 0, 0, 0, 4, 10, 2, {
@@ -189,7 +189,7 @@ describe('Auto Completion Tests', () => {
189
189
  },
190
190
  },
191
191
  });
192
- const content = 'name: ya';
192
+ const content = 'name: ya'; // len: 8
193
193
  const completion = parseSetup(content, 15);
194
194
  completion
195
195
  .then(function (result) {
@@ -209,7 +209,7 @@ describe('Auto Completion Tests', () => {
209
209
  },
210
210
  },
211
211
  });
212
- const content = 'yaml: ';
212
+ const content = 'yaml: '; // len: 6
213
213
  const completion = parseSetup(content, 11);
214
214
  completion
215
215
  .then(function (result) {
@@ -232,7 +232,7 @@ describe('Auto Completion Tests', () => {
232
232
  },
233
233
  },
234
234
  });
235
- const content = 'yaml: fal';
235
+ const content = 'yaml: fal'; // len: 9
236
236
  const completion = parseSetup(content, 11);
237
237
  completion
238
238
  .then(function (result) {
@@ -256,7 +256,7 @@ describe('Auto Completion Tests', () => {
256
256
  },
257
257
  },
258
258
  });
259
- const content = 'timeout: ';
259
+ const content = 'timeout: '; // len: 9
260
260
  const completion = parseSetup(content, 9);
261
261
  completion
262
262
  .then(function (result) {
@@ -277,7 +277,7 @@ describe('Auto Completion Tests', () => {
277
277
  },
278
278
  },
279
279
  });
280
- const content = 'timeout: 6';
280
+ const content = 'timeout: 6'; // len: 10
281
281
  const completion = parseSetup(content, 10);
282
282
  completion
283
283
  .then(function (result) {
@@ -303,8 +303,8 @@ describe('Auto Completion Tests', () => {
303
303
  },
304
304
  },
305
305
  });
306
- const content = 'scripts:\n sample';
307
- const completion = parseSetup(content, 11);
306
+ const content = 'scripts:\n |s|ample'; // len: 17, pos: 11
307
+ const completion = parseSetup(content);
308
308
  completion
309
309
  .then(function (result) {
310
310
  assert.equal(result.items.length, 1);
@@ -329,8 +329,8 @@ describe('Auto Completion Tests', () => {
329
329
  },
330
330
  },
331
331
  });
332
- const content = 'scripts:\n sam';
333
- const completion = parseSetup(content, 11);
332
+ const content = 'scripts:\n |s|am'; // len: 14, pos: 11
333
+ const completion = parseSetup(content);
334
334
  completion
335
335
  .then(function (result) {
336
336
  assert.equal(result.items.length, 1);
@@ -416,8 +416,8 @@ describe('Auto Completion Tests', () => {
416
416
  },
417
417
  },
418
418
  });
419
- const content = 'scripts:\n sample: test\n myOther';
420
- const completion = parseSetup(content, 31);
419
+ const content = 'scripts:\n sample: test\n myOth|e|r'; // len: 33, pos: 31
420
+ const completion = parseSetup(content);
421
421
  completion
422
422
  .then(function (result) {
423
423
  assert.equal(result.items.length, 1);
@@ -437,7 +437,7 @@ describe('Auto Completion Tests', () => {
437
437
  },
438
438
  },
439
439
  });
440
- const content = 'timeout:';
440
+ const content = 'timeout:'; // len: 8
441
441
  const completion = parseSetup(content, 9);
442
442
  completion
443
443
  .then(function (result) {
@@ -464,7 +464,7 @@ describe('Auto Completion Tests', () => {
464
464
  },
465
465
  },
466
466
  });
467
- const content = 'scripts:\n sample:';
467
+ const content = 'scripts:\n sample:'; // len: 18
468
468
  const completion = parseSetup(content, 21);
469
469
  completion
470
470
  .then(function (result) {
@@ -489,8 +489,8 @@ describe('Auto Completion Tests', () => {
489
489
  },
490
490
  },
491
491
  });
492
- const content = 'scripts: |:|';
493
- const completion = parseSetup(content);
492
+ const content = 'scripts: ';
493
+ const completion = parseSetup(content, content.length);
494
494
  completion
495
495
  .then(function (result) {
496
496
  assert.equal(result.items.length, 1);
@@ -509,7 +509,7 @@ describe('Auto Completion Tests', () => {
509
509
  },
510
510
  },
511
511
  });
512
- const content = '---\ntimeout: 10\n...\n---\n...';
512
+ const content = '---\ntimeout: 10\n...\n---\n...'; // len: 27
513
513
  const completion = parseSetup(content, 28);
514
514
  completion
515
515
  .then(function (result) {
@@ -530,8 +530,8 @@ describe('Auto Completion Tests', () => {
530
530
  },
531
531
  },
532
532
  });
533
- const content = '---\ntimeout: 10\n...\n---\ntime \n...';
534
- const completion = parseSetup(content, 26);
533
+ const content = '---\ntimeout: 10\n...\n---\nti|m|e \n...'; // len: 33, pos: 26
534
+ const completion = parseSetup(content);
535
535
  completion
536
536
  .then(function (result) {
537
537
  assert.equal(result.items.length, 1);
@@ -550,7 +550,7 @@ describe('Auto Completion Tests', () => {
550
550
  },
551
551
  },
552
552
  });
553
- const content = 'time: ';
553
+ const content = 'time: '; // len: 6
554
554
  const completion = parseSetup(content, 6);
555
555
  completion
556
556
  .then(function (result) {
@@ -568,7 +568,7 @@ describe('Auto Completion Tests', () => {
568
568
  },
569
569
  },
570
570
  });
571
- const content = 'scripts: ';
571
+ const content = 'scripts: '; // len: 9
572
572
  const completion = parseSetup(content, 9);
573
573
  completion
574
574
  .then(function (result) {
@@ -611,7 +611,7 @@ describe('Auto Completion Tests', () => {
611
611
  ],
612
612
  };
613
613
  languageService.addSchema(testHelper_1.SCHEMA_ID, schema);
614
- const content = 'kind: ';
614
+ const content = 'kind: '; // len: 6
615
615
  const validator = parseSetup(content, 6);
616
616
  validator
617
617
  .then(function (result) {
@@ -812,8 +812,8 @@ describe('Auto Completion Tests', () => {
812
812
  it('Should insert empty array item', (done) => {
813
813
  const schema = require(path.join(__dirname, './fixtures/testStringArray.json'));
814
814
  languageService.addSchema(testHelper_1.SCHEMA_ID, schema);
815
- const content = 'fooBa';
816
- const completion = parseSetup(content, content.lastIndexOf('Ba') + 2);
815
+ const content = 'fooBa'; // len: 5
816
+ const completion = parseSetup(content, content.lastIndexOf('Ba') + 2); // pos: 3+2
817
817
  completion
818
818
  .then(function (result) {
819
819
  assert.strictEqual('fooBar:\n - ${1:""}', result.items[0].insertText);
@@ -837,7 +837,7 @@ describe('Auto Completion Tests', () => {
837
837
  },
838
838
  },
839
839
  });
840
- const content = 'authors:\n - ';
840
+ const content = 'authors:\n - '; // len: 13
841
841
  const completion = parseSetup(content, 14);
842
842
  completion
843
843
  .then(function (result) {
@@ -865,7 +865,7 @@ describe('Auto Completion Tests', () => {
865
865
  },
866
866
  },
867
867
  });
868
- const content = 'authors:\n -';
868
+ const content = 'authors:\n -'; // len: 12
869
869
  const completion = parseSetup(content, 13);
870
870
  completion
871
871
  .then(function (result) {
@@ -896,7 +896,7 @@ describe('Auto Completion Tests', () => {
896
896
  },
897
897
  },
898
898
  });
899
- const content = 'authors:\n - name: test\n ';
899
+ const content = 'authors:\n - name: test\n '; // len: 26
900
900
  const completion = parseSetup(content, 26);
901
901
  completion
902
902
  .then(function (result) {
@@ -927,7 +927,7 @@ describe('Auto Completion Tests', () => {
927
927
  },
928
928
  },
929
929
  });
930
- const content = 'authors:\n';
930
+ const content = 'authors:\n'; // len: 9
931
931
  const completion = parseSetup(content, 9);
932
932
  completion
933
933
  .then(function (result) {
@@ -955,7 +955,7 @@ describe('Auto Completion Tests', () => {
955
955
  },
956
956
  },
957
957
  });
958
- const content = 'authors:\n - n';
958
+ const content = 'authors:\n - n'; // len: 14
959
959
  const completion = parseSetup(content, 14);
960
960
  completion
961
961
  .then(function (result) {
@@ -986,7 +986,7 @@ describe('Auto Completion Tests', () => {
986
986
  },
987
987
  },
988
988
  });
989
- const content = 'authors:\n - name: test\n ';
989
+ const content = 'authors:\n - name: test\n '; // len: 28
990
990
  const completion = parseSetup(content, 32);
991
991
  completion
992
992
  .then(function (result) {
@@ -1017,8 +1017,8 @@ describe('Auto Completion Tests', () => {
1017
1017
  },
1018
1018
  },
1019
1019
  });
1020
- const content = 'authors:\n - name: test\n e';
1021
- const completion = parseSetup(content, 27);
1020
+ const content = 'authors:\n - name: test\n | |e'; // len: 29, pos: 27
1021
+ const completion = parseSetup(content);
1022
1022
  completion
1023
1023
  .then(function (result) {
1024
1024
  assert.equal(result.items.length, 1);
@@ -1051,7 +1051,7 @@ describe('Auto Completion Tests', () => {
1051
1051
  },
1052
1052
  },
1053
1053
  });
1054
- const content = 'authors:\n - name: test\n';
1054
+ const content = 'authors:\n - name: test\n'; // len: 24
1055
1055
  const completion = parseSetup(content, 24);
1056
1056
  completion
1057
1057
  .then(function (result) {
@@ -1089,8 +1089,8 @@ describe('Auto Completion Tests', () => {
1089
1089
  },
1090
1090
  },
1091
1091
  });
1092
- const content = 'archive:\n exclude:\n - name: test\n\n';
1093
- const completion = parseSetup(content, content.length - 1); //don't test on the last row
1092
+ const content = 'archive:\n exclude:\n - name: test\n|\n|'; // len: 38, pos: 37
1093
+ const completion = parseSetup(content); //don't test on the last row
1094
1094
  completion
1095
1095
  .then(function (result) {
1096
1096
  assert.equal(result.items.length, 1);
@@ -1127,8 +1127,8 @@ describe('Auto Completion Tests', () => {
1127
1127
  },
1128
1128
  },
1129
1129
  });
1130
- const content = 'archive:\n exclude:\n - nam\n ';
1131
- const completion = parseSetup(content, content.length - 1);
1130
+ const content = 'archive:\n exclude:\n - nam\n | |'; // len: 35, pos: 34
1131
+ const completion = parseSetup(content);
1132
1132
  completion
1133
1133
  .then(function (result) {
1134
1134
  assert.equal(result.items.length, 1);
@@ -1150,7 +1150,7 @@ describe('Auto Completion Tests', () => {
1150
1150
  },
1151
1151
  },
1152
1152
  });
1153
- const content = 'references:\n -';
1153
+ const content = 'references:\n -'; // len: 15
1154
1154
  const completion = parseSetup(content, 29);
1155
1155
  completion
1156
1156
  .then(function (result) {
@@ -1173,7 +1173,7 @@ describe('Auto Completion Tests', () => {
1173
1173
  },
1174
1174
  },
1175
1175
  });
1176
- const content = 'references:\n - ';
1176
+ const content = 'references:\n - '; // len: 16
1177
1177
  const completion = parseSetup(content, 30);
1178
1178
  completion
1179
1179
  .then(function (result) {
@@ -1196,7 +1196,7 @@ describe('Auto Completion Tests', () => {
1196
1196
  },
1197
1197
  },
1198
1198
  });
1199
- const content = 'references:\n - T';
1199
+ const content = 'references:\n - T'; // len: 17
1200
1200
  const completion = parseSetup(content, 31);
1201
1201
  completion
1202
1202
  .then(function (result) {
@@ -1241,7 +1241,7 @@ describe('Auto Completion Tests', () => {
1241
1241
  },
1242
1242
  },
1243
1243
  });
1244
- const content = 'metadata:\n ownerReferences';
1244
+ const content = 'metadata:\n ownerReferences'; // len: 29
1245
1245
  const completion = yield parseSetup(content, 29);
1246
1246
  chai_1.expect(completion.items[0]).deep.eq(verifyError_1.createExpectedCompletion('ownerReferences', 'ownerReferences:\n - apiVersion: $1\n kind: $2\n name: $3\n uid: $4', 1, 4, 1, 19, 10, 2, { documentation: '' }));
1247
1247
  }));
@@ -1280,7 +1280,7 @@ describe('Auto Completion Tests', () => {
1280
1280
  },
1281
1281
  },
1282
1282
  });
1283
- const content = 'metadata:\n ownerReferences';
1283
+ const content = 'metadata:\n ownerReferences'; // len: 27
1284
1284
  const completion = yield parseSetup(content, 27);
1285
1285
  chai_1.expect(completion.items[0]).deep.eq(verifyError_1.createExpectedCompletion('ownerReferences', 'ownerReferences:\n - apiVersion: $1\n kind: $2\n name: $3\n uid: $4', 1, 2, 1, 17, 10, 2, { documentation: '' }));
1286
1286
  }));
@@ -1318,8 +1318,8 @@ describe('Auto Completion Tests', () => {
1318
1318
  },
1319
1319
  },
1320
1320
  });
1321
- const content = 'metadata:\n ownerReferences';
1322
- const completion = yield parseSetup(content, 27);
1321
+ const content = 'metadata:\n ownerReference|s|'; // len: 28, pos: 27
1322
+ const completion = yield parseSetup(content);
1323
1323
  chai_1.expect(completion.items[0]).deep.eq(verifyError_1.createExpectedCompletion('ownerReferences', 'ownerReferences:\n - apiVersion: $1\n kind: $2\n name: $3\n uid: $4', 1, 3, 1, 18, 10, 2, { documentation: '' }));
1324
1324
  }));
1325
1325
  it('Array completion - should not suggest const', () => __awaiter(this, void 0, void 0, function* () {
@@ -1409,8 +1409,8 @@ describe('Auto Completion Tests', () => {
1409
1409
  },
1410
1410
  },
1411
1411
  });
1412
- const content = 'rules:\n -\n';
1413
- const completion = yield parseSetup(content, 12);
1412
+ const content = 'rules:\n -|\n|'; // len: 13, pos: 12
1413
+ const completion = yield parseSetup(content);
1414
1414
  chai_1.expect(completion.items.find((i) => i.label === 'rules item').textEdit.newText).equal(' id: $1\n nomination: $2\n weight: ${3:0}\n criteria:\n - field: $4\n operator: $5\n operand: $6');
1415
1415
  }));
1416
1416
  });
@@ -1426,7 +1426,7 @@ describe('Auto Completion Tests', () => {
1426
1426
  },
1427
1427
  },
1428
1428
  });
1429
- const content = 'foodItems: ';
1429
+ const content = 'foodItems: '; // len: 11
1430
1430
  const completion = parseSetup(content, 12);
1431
1431
  completion
1432
1432
  .then(function (result) {
@@ -1448,8 +1448,8 @@ describe('Auto Completion Tests', () => {
1448
1448
  },
1449
1449
  },
1450
1450
  });
1451
- const content = 'fruit: App';
1452
- const completion = parseSetup(content, 9);
1451
+ const content = 'fruit: Ap|p|'; // len: 10, pos: 9
1452
+ const completion = parseSetup(content);
1453
1453
  completion
1454
1454
  .then(function (result) {
1455
1455
  assert.equal(result.items.length, 1);
@@ -1501,8 +1501,8 @@ describe('Auto Completion Tests', () => {
1501
1501
  it('Indent should be considered with position relative to slash', (done) => {
1502
1502
  const schema = require(path.join(__dirname, './fixtures/testArrayIndent.json'));
1503
1503
  languageService.addSchema(testHelper_1.SCHEMA_ID, schema);
1504
- const content = 'install:\n - he';
1505
- const completion = parseSetup(content, content.lastIndexOf('he') + 2);
1504
+ const content = 'install:\n - he'; // len: 15
1505
+ const completion = parseSetup(content, content.lastIndexOf('he') + 2); // pos: 13+2
1506
1506
  completion
1507
1507
  .then(function (result) {
1508
1508
  assert.equal(result.items.length, 2);
@@ -1515,8 +1515,8 @@ describe('Auto Completion Tests', () => {
1515
1515
  it('Large indent should be considered with position relative to slash', (done) => {
1516
1516
  const schema = require(path.join(__dirname, './fixtures/testArrayIndent.json'));
1517
1517
  languageService.addSchema(testHelper_1.SCHEMA_ID, schema);
1518
- const content = 'install:\n - he';
1519
- const completion = parseSetup(content, content.lastIndexOf('he') + 2);
1518
+ const content = 'install:\n - he'; // len: 25
1519
+ const completion = parseSetup(content, content.lastIndexOf('he') + 2); // pos: 23+2
1520
1520
  completion
1521
1521
  .then(function (result) {
1522
1522
  assert.equal(result.items.length, 2);
@@ -1529,8 +1529,8 @@ describe('Auto Completion Tests', () => {
1529
1529
  it('Tab indent should be considered with position relative to slash', (done) => {
1530
1530
  const schema = require(path.join(__dirname, './fixtures/testArrayIndent.json'));
1531
1531
  languageService.addSchema(testHelper_1.SCHEMA_ID, schema);
1532
- const content = 'install:\n -\t he';
1533
- const completion = parseSetup(content, content.lastIndexOf('he') + 2);
1532
+ const content = 'install:\n -\t he'; // len: 27
1533
+ const completion = parseSetup(content, content.lastIndexOf('he') + 2); // pos: 25+2
1534
1534
  completion
1535
1535
  .then(function (result) {
1536
1536
  assert.equal(result.items.length, 2);
@@ -1562,21 +1562,21 @@ describe('Auto Completion Tests', () => {
1562
1562
  .then(done, done);
1563
1563
  });
1564
1564
  it('Provide completion from schema declared in file with several documents', () => __awaiter(this, void 0, void 0, function* () {
1565
- const documentContent1 = `# yaml-language-server: $schema=${uri} anothermodeline=value\n- `;
1566
- const content = `${documentContent1}\n---\n- `;
1567
- const result = yield parseSetup(content, documentContent1.length);
1565
+ const documentContent1 = `# yaml-language-server: $schema=${uri} anothermodeline=value\n- `; // 149
1566
+ const content = `${documentContent1}|\n|---\n- `; // len: 156, pos: 149
1567
+ const result = yield parseSetup(content);
1568
1568
  assert.equal(result.items.length, 3, `Expecting 3 items in completion but found ${result.items.length}`);
1569
1569
  const resultDoc2 = yield parseSetup(content, content.length);
1570
1570
  assert.equal(resultDoc2.items.length, 0, `Expecting no items in completion but found ${resultDoc2.items.length}`);
1571
1571
  }));
1572
1572
  it('should handle absolute path', () => __awaiter(this, void 0, void 0, function* () {
1573
- const documentContent = `# yaml-language-server: $schema=${path.join(__dirname, './fixtures/testArrayMaxProperties.json')} anothermodeline=value\n- `;
1574
- const content = `${documentContent}\n---\n- `;
1575
- const result = yield parseSetup(content, documentContent.length);
1573
+ const documentContent = `# yaml-language-server: $schema=${path.join(__dirname, './fixtures/testArrayMaxProperties.json')} anothermodeline=value\n- `; // len: 142
1574
+ const content = `${documentContent}|\n|---\n- `; // len: 149, pos: 142
1575
+ const result = yield parseSetup(content);
1576
1576
  assert.strictEqual(result.items.length, 3, `Expecting 3 items in completion but found ${result.items.length}`);
1577
1577
  }));
1578
1578
  it('should handle relative path', () => __awaiter(this, void 0, void 0, function* () {
1579
- const documentContent = `# yaml-language-server: $schema=./fixtures/testArrayMaxProperties.json anothermodeline=value\n- `;
1579
+ const documentContent = `# yaml-language-server: $schema=./fixtures/testArrayMaxProperties.json anothermodeline=value\n- `; // 95
1580
1580
  const content = `${documentContent}\n---\n- `;
1581
1581
  const testTextDocument = testHelper_1.setupSchemaIDTextDocument(content, path.join(__dirname, 'test.yaml'));
1582
1582
  yamlSettings.documents = new yamlSettings_1.TextDocumentTestManager();
@@ -1676,8 +1676,8 @@ describe('Auto Completion Tests', () => {
1676
1676
  },
1677
1677
  },
1678
1678
  });
1679
- const content = 'scripts:\n sample: test\n myOther';
1680
- const completion = yield parseSetup(content, 34);
1679
+ const content = 'scripts:\n sample: test\n myOt|h|er'; // len: 37, pos: 34
1680
+ const completion = yield parseSetup(content);
1681
1681
  assert.strictEqual(completion.items.length, 1);
1682
1682
  assert.deepStrictEqual(completion.items[0], verifyError_1.createExpectedCompletion('myOtherSample', 'myOtherSample: ${1:test}', 2, 4, 2, 11, 10, 2, {
1683
1683
  documentation: '',
@@ -1730,7 +1730,7 @@ describe('Auto Completion Tests', () => {
1730
1730
  },
1731
1731
  },
1732
1732
  });
1733
- const content = 'components:\n - id: jsakdh\n setti';
1733
+ const content = 'components:\n - id: jsakdh\n setti'; // len: 36
1734
1734
  const completion = yield parseSetup(content, 36);
1735
1735
  chai_1.expect(completion.items).lengthOf(1);
1736
1736
  chai_1.expect(completion.items[0].textEdit.newText).to.equal('settings:\n data:\n arrayItems:\n - show: ${1:true}\n id: $2');
@@ -1747,7 +1747,7 @@ describe('Auto Completion Tests', () => {
1747
1747
  },
1748
1748
  },
1749
1749
  });
1750
- const content = 'env: ';
1750
+ const content = 'env: '; // len: 5
1751
1751
  const completion = parseSetup(content, 5);
1752
1752
  completion
1753
1753
  .then(function (result) {
@@ -1774,7 +1774,7 @@ describe('Auto Completion Tests', () => {
1774
1774
  },
1775
1775
  },
1776
1776
  });
1777
- const content = 'env: ';
1777
+ const content = 'env: '; // len: 5
1778
1778
  const completion = parseSetup(content, 5);
1779
1779
  completion
1780
1780
  .then(function (result) {
@@ -1810,8 +1810,8 @@ describe('Auto Completion Tests', () => {
1810
1810
  ],
1811
1811
  },
1812
1812
  });
1813
- const content = '---\n- \n';
1814
- const completion = yield parseSetup(content, 6);
1813
+ const content = '---\n- |\n|'; // len: 7, pos: 6
1814
+ const completion = yield parseSetup(content);
1815
1815
  chai_1.expect(completion.items).lengthOf(1);
1816
1816
  chai_1.expect(completion.items[0].label).eq('fooBar');
1817
1817
  chai_1.expect(completion.items[0].insertText).eq('fooBar:\n name: $1\n aaa:\n - $2');
@@ -1842,7 +1842,7 @@ describe('Auto Completion Tests', () => {
1842
1842
  },
1843
1843
  },
1844
1844
  });
1845
- const content = '- prop1: value\n object:\n - env_prop1: value\n ';
1845
+ const content = '- prop1: value\n object:\n - env_prop1: value\n '; // len: 48
1846
1846
  const completion = yield parseSetup(content, 49);
1847
1847
  chai_1.expect(completion.items).lengthOf(2);
1848
1848
  chai_1.expect(completion.items[0].label).eq('prop2');
@@ -1862,8 +1862,8 @@ describe('Auto Completion Tests', () => {
1862
1862
  },
1863
1863
  },
1864
1864
  });
1865
- const content = 'enum';
1866
- const completion = yield parseSetup(content, 3);
1865
+ const content = 'enu|m|'; // len: 4, pos: 3
1866
+ const completion = yield parseSetup(content);
1867
1867
  const enumItem = completion.items.find((i) => i.label === 'enum');
1868
1868
  chai_1.expect(enumItem).to.not.undefined;
1869
1869
  chai_1.expect(enumItem.textEdit.newText).equal('enum: ${1:"1"}');
@@ -1881,8 +1881,8 @@ describe('Auto Completion Tests', () => {
1881
1881
  },
1882
1882
  },
1883
1883
  });
1884
- const content = 'fooBar: \n';
1885
- const completion = yield parseSetup(content, 8);
1884
+ const content = 'fooBar: |\n|'; // len: 9, pos: 8
1885
+ const completion = yield parseSetup(content);
1886
1886
  const testItem = completion.items.find((i) => i.label === 'test');
1887
1887
  chai_1.expect(testItem).to.not.undefined;
1888
1888
  chai_1.expect(testItem.textEdit.newText).equal('test');
@@ -1906,8 +1906,8 @@ describe('Auto Completion Tests', () => {
1906
1906
  },
1907
1907
  },
1908
1908
  });
1909
- const content = 'fooBar: \n';
1910
- const completion = yield parseSetup(content, 8);
1909
+ const content = 'fooBar: |\n|'; // len: 9, pos: 8
1910
+ const completion = yield parseSetup(content);
1911
1911
  chai_1.expect(completion.items).length(1);
1912
1912
  }));
1913
1913
  it('should provide completion for flow map', () => __awaiter(void 0, void 0, void 0, function* () {
@@ -1915,8 +1915,8 @@ describe('Auto Completion Tests', () => {
1915
1915
  type: 'object',
1916
1916
  properties: { A: { type: 'string', enum: ['a1', 'a2'] }, B: { type: 'string', enum: ['b1', 'b2'] } },
1917
1917
  });
1918
- const content = '{A: , B: b1}';
1919
- const completion = yield parseSetup(content, 4);
1918
+ const content = '{A: |,| B: b1}'; // len: 12, pos: 4
1919
+ const completion = yield parseSetup(content);
1920
1920
  chai_1.expect(completion.items).lengthOf(2);
1921
1921
  chai_1.expect(completion.items[0]).eql(verifyError_1.createExpectedCompletion('a1', 'a1', 0, 4, 0, 4, 12, vscode_languageserver_types_1.InsertTextFormat.Snippet, { documentation: undefined }));
1922
1922
  chai_1.expect(completion.items[1]).eql(verifyError_1.createExpectedCompletion('a2', 'a2', 0, 4, 0, 4, 12, vscode_languageserver_types_1.InsertTextFormat.Snippet, { documentation: undefined }));
@@ -1930,8 +1930,8 @@ describe('Auto Completion Tests', () => {
1930
1930
  },
1931
1931
  },
1932
1932
  });
1933
- const content = 'kind: \n';
1934
- const completion = yield parseSetup(content, 6);
1933
+ const content = 'kind: |\n|'; // len: 7, pos: 6
1934
+ const completion = yield parseSetup(content);
1935
1935
  chai_1.expect(completion.items).lengthOf(2);
1936
1936
  chai_1.expect(completion.items[0]).eql(verifyError_1.createExpectedCompletion('project', 'project', 0, 6, 0, 6, 12, vscode_languageserver_types_1.InsertTextFormat.Snippet, { documentation: undefined }));
1937
1937
  chai_1.expect(completion.items[1]).eql(verifyError_1.createExpectedCompletion('null', 'null', 0, 6, 0, 6, 12, vscode_languageserver_types_1.InsertTextFormat.Snippet, { documentation: undefined }));
@@ -1963,8 +1963,8 @@ describe('Auto Completion Tests', () => {
1963
1963
  },
1964
1964
  ],
1965
1965
  });
1966
- const content = ' \n\n\n';
1967
- const completion = yield parseSetup(content, 3);
1966
+ const content = ' \n\n|\n|'; // len: 4, pos: 3
1967
+ const completion = yield parseSetup(content);
1968
1968
  chai_1.expect(completion.items).lengthOf(2);
1969
1969
  chai_1.expect(completion.items[0]).eql(verifyError_1.createExpectedCompletion('kind', 'kind: ', 2, 0, 2, 0, 10, vscode_languageserver_types_1.InsertTextFormat.Snippet, { documentation: '' }));
1970
1970
  chai_1.expect(completion.items[1]).eql(verifyError_1.createExpectedCompletion('name', 'name: ', 2, 0, 2, 0, 10, vscode_languageserver_types_1.InsertTextFormat.Snippet, { documentation: '' }));
@@ -1979,8 +1979,8 @@ describe('Auto Completion Tests', () => {
1979
1979
  },
1980
1980
  required: ['kind'],
1981
1981
  });
1982
- const content = 'kind: 111\n';
1983
- const completion = yield parseSetup(content, 3);
1982
+ const content = 'kin|d|: 111\n'; // len: 10, pos: 3
1983
+ const completion = yield parseSetup(content);
1984
1984
  chai_1.expect(completion.items).lengthOf(2);
1985
1985
  chai_1.expect(completion.items[0]).eql(verifyError_1.createExpectedCompletion('kind', 'kind', 0, 0, 0, 4, 10, vscode_languageserver_types_1.InsertTextFormat.Snippet, { documentation: '' }));
1986
1986
  }));
@@ -1994,8 +1994,8 @@ describe('Auto Completion Tests', () => {
1994
1994
  },
1995
1995
  required: ['kind'],
1996
1996
  });
1997
- const content = 'ki: 111\n';
1998
- const completion = yield parseSetup(content, 1);
1997
+ const content = 'k|i|: 111\n'; // len: 8, pos: 1
1998
+ const completion = yield parseSetup(content);
1999
1999
  chai_1.expect(completion.items).lengthOf(2);
2000
2000
  chai_1.expect(completion.items[0]).eql(verifyError_1.createExpectedCompletion('kind', 'kind', 0, 0, 0, 2, 10, vscode_languageserver_types_1.InsertTextFormat.Snippet, { documentation: '' }));
2001
2001
  }));
@@ -2011,8 +2011,8 @@ describe('Auto Completion Tests', () => {
2011
2011
  },
2012
2012
  required: ['kind'],
2013
2013
  });
2014
- const content = 'kin';
2015
- const completion = yield parseSetup(content, 1);
2014
+ const content = 'k|i|n'; // len: 3, pos: 1
2015
+ const completion = yield parseSetup(content);
2016
2016
  chai_1.expect(completion.items).lengthOf(2);
2017
2017
  chai_1.expect(completion.items[0]).eql(verifyError_1.createExpectedCompletion('kind', 'kind: ', 0, 0, 0, 3, 10, vscode_languageserver_types_1.InsertTextFormat.Snippet, {
2018
2018
  documentation: {
@@ -2044,7 +2044,7 @@ describe('Auto Completion Tests', () => {
2044
2044
  },
2045
2045
  },
2046
2046
  });
2047
- const content = 'test:\n - and\n - - ';
2047
+ const content = 'test:\n - and\n - - '; // len: 20
2048
2048
  const completion = yield parseSetup(content, 20);
2049
2049
  chai_1.expect(completion.items).lengthOf(1);
2050
2050
  chai_1.expect(completion.items[0]).eql(verifyError_1.createExpectedCompletion('and', 'and', 2, 6, 2, 6, 12, vscode_languageserver_types_1.InsertTextFormat.Snippet, { documentation: undefined }));
@@ -2072,8 +2072,8 @@ describe('Auto Completion Tests', () => {
2072
2072
  },
2073
2073
  },
2074
2074
  });
2075
- const content = 'test:\n - and\n - - ';
2076
- const completion = yield parseSetup(content, 20);
2075
+ const content = 'test:\n - and\n - - | | '; // len: 22, pos: 20
2076
+ const completion = yield parseSetup(content);
2077
2077
  chai_1.expect(completion.items).lengthOf(1);
2078
2078
  chai_1.expect(completion.items[0]).eql(verifyError_1.createExpectedCompletion('and', 'and', 2, 6, 2, 8, 12, vscode_languageserver_types_1.InsertTextFormat.Snippet, { documentation: undefined }));
2079
2079
  }));
@@ -2100,8 +2100,8 @@ describe('Auto Completion Tests', () => {
2100
2100
  },
2101
2101
  },
2102
2102
  });
2103
- const content = 'test:\n - and\n - []';
2104
- const completion = yield parseSetup(content, 18);
2103
+ const content = 'test:\n - and\n - |[|]'; // len: 20, pos: 18
2104
+ const completion = yield parseSetup(content);
2105
2105
  chai_1.expect(completion.items).lengthOf(1);
2106
2106
  chai_1.expect(completion.items[0]).eql(verifyError_1.createExpectedCompletion('and', 'and', 2, 4, 2, 4, 12, vscode_languageserver_types_1.InsertTextFormat.Snippet, { documentation: undefined }));
2107
2107
  }));
@@ -2125,7 +2125,7 @@ describe('Auto Completion Tests', () => {
2125
2125
  },
2126
2126
  },
2127
2127
  });
2128
- const content = 'version: ';
2128
+ const content = 'version: '; // len: 9
2129
2129
  const completion = yield parseSetup(content, 9);
2130
2130
  chai_1.expect(completion.items).lengthOf(2);
2131
2131
  chai_1.expect(completion.items[0]).eql(verifyError_1.createExpectedCompletion('2', '2', 0, 9, 0, 9, 12, vscode_languageserver_types_1.InsertTextFormat.Snippet, { documentation: undefined }));
@@ -2202,8 +2202,8 @@ describe('Auto Completion Tests', () => {
2202
2202
  it('Simple array object completion without "-" befor array empty item', (done) => {
2203
2203
  const schema = require(path.join(__dirname, './fixtures/testArrayCompletionSchema.json'));
2204
2204
  languageService.addSchema(testHelper_1.SCHEMA_ID, schema);
2205
- const content = 'test_simpleArrayObject:\n \n -';
2206
- const completion = parseSetup(content, 'test_simpleArrayObject:\n '.length);
2205
+ const content = 'test_simpleArrayObject:\n |\n| -'; // len: 30, pos: 26
2206
+ const completion = parseSetup(content);
2207
2207
  completion
2208
2208
  .then(function (result) {
2209
2209
  assert.equal(result.items.length, 1);