typescript-language-server 1.1.2 → 2.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 (110) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/LICENSE +39 -0
  3. package/README.md +43 -2
  4. package/lib/cli.js +6 -6
  5. package/lib/cli.js.map +1 -1
  6. package/lib/completion.d.ts +1 -2
  7. package/lib/completion.d.ts.map +1 -1
  8. package/lib/completion.js +38 -19
  9. package/lib/completion.js.map +1 -1
  10. package/lib/configuration-manager.d.ts +3 -10
  11. package/lib/configuration-manager.d.ts.map +1 -1
  12. package/lib/configuration-manager.js +24 -4
  13. package/lib/configuration-manager.js.map +1 -1
  14. package/lib/diagnostic-queue.d.ts +1 -1
  15. package/lib/diagnostic-queue.d.ts.map +1 -1
  16. package/lib/features/inlay-hints.js +2 -2
  17. package/lib/features/inlay-hints.js.map +1 -1
  18. package/lib/lsp-connection.d.ts +5 -5
  19. package/lib/lsp-connection.d.ts.map +1 -1
  20. package/lib/lsp-connection.js +2 -3
  21. package/lib/lsp-connection.js.map +1 -1
  22. package/lib/lsp-server.d.ts +7 -10
  23. package/lib/lsp-server.d.ts.map +1 -1
  24. package/lib/lsp-server.js +61 -115
  25. package/lib/lsp-server.js.map +1 -1
  26. package/lib/lsp-server.spec.js +382 -81
  27. package/lib/lsp-server.spec.js.map +1 -1
  28. package/lib/refactor.d.ts +2 -1
  29. package/lib/refactor.d.ts.map +1 -1
  30. package/lib/refactor.js +17 -7
  31. package/lib/refactor.js.map +1 -1
  32. package/lib/test-utils.d.ts +18 -0
  33. package/lib/test-utils.d.ts.map +1 -1
  34. package/lib/test-utils.js +24 -12
  35. package/lib/test-utils.js.map +1 -1
  36. package/lib/ts-protocol.d.ts +30 -8
  37. package/lib/ts-protocol.d.ts.map +1 -1
  38. package/lib/ts-protocol.js +7 -1
  39. package/lib/ts-protocol.js.map +1 -1
  40. package/lib/tsServer/callbackMap.d.ts +17 -0
  41. package/lib/tsServer/callbackMap.d.ts.map +1 -0
  42. package/lib/tsServer/callbackMap.js +47 -0
  43. package/lib/tsServer/callbackMap.js.map +1 -0
  44. package/lib/tsServer/cancellation.d.ts +22 -0
  45. package/lib/tsServer/cancellation.d.ts.map +1 -0
  46. package/lib/tsServer/cancellation.js +51 -0
  47. package/lib/tsServer/cancellation.js.map +1 -0
  48. package/lib/tsServer/logDirectoryProvider.d.ts +13 -0
  49. package/lib/tsServer/logDirectoryProvider.d.ts.map +1 -0
  50. package/lib/tsServer/logDirectoryProvider.js +49 -0
  51. package/lib/tsServer/logDirectoryProvider.js.map +1 -0
  52. package/lib/tsServer/requestQueue.d.ts +34 -0
  53. package/lib/tsServer/requestQueue.d.ts.map +1 -0
  54. package/lib/tsServer/requestQueue.js +74 -0
  55. package/lib/tsServer/requestQueue.js.map +1 -0
  56. package/lib/tsServer/requests.d.ts +68 -0
  57. package/lib/tsServer/requests.d.ts.map +1 -0
  58. package/lib/tsServer/requests.js +28 -0
  59. package/lib/tsServer/requests.js.map +1 -0
  60. package/lib/tsServer/server.d.ts +95 -0
  61. package/lib/tsServer/server.d.ts.map +1 -0
  62. package/lib/tsServer/server.js +209 -0
  63. package/lib/tsServer/server.js.map +1 -0
  64. package/lib/tsServer/serverError.d.ts +18 -0
  65. package/lib/tsServer/serverError.d.ts.map +1 -0
  66. package/lib/tsServer/serverError.js +53 -0
  67. package/lib/tsServer/serverError.js.map +1 -0
  68. package/lib/tsServer/serverProcess.d.ts +7 -0
  69. package/lib/tsServer/serverProcess.d.ts.map +1 -0
  70. package/lib/tsServer/serverProcess.js +238 -0
  71. package/lib/tsServer/serverProcess.js.map +1 -0
  72. package/lib/tsServer/spawner.d.ts +19 -0
  73. package/lib/tsServer/spawner.d.ts.map +1 -0
  74. package/lib/tsServer/spawner.js +130 -0
  75. package/lib/tsServer/spawner.js.map +1 -0
  76. package/lib/tsServer/tracer.d.ts +26 -0
  77. package/lib/tsServer/tracer.d.ts.map +1 -0
  78. package/lib/tsServer/tracer.js +80 -0
  79. package/lib/tsServer/tracer.js.map +1 -0
  80. package/lib/{utils → tsServer}/versionProvider.d.ts +8 -8
  81. package/lib/tsServer/versionProvider.d.ts.map +1 -0
  82. package/lib/{utils → tsServer}/versionProvider.js +28 -22
  83. package/lib/tsServer/versionProvider.js.map +1 -0
  84. package/lib/tsp-client.d.ts +25 -55
  85. package/lib/tsp-client.d.ts.map +1 -1
  86. package/lib/tsp-client.js +186 -140
  87. package/lib/tsp-client.js.map +1 -1
  88. package/lib/tsp-client.spec.js +23 -8
  89. package/lib/tsp-client.spec.js.map +1 -1
  90. package/lib/utils/api.d.ts +1 -0
  91. package/lib/utils/api.d.ts.map +1 -1
  92. package/lib/utils/api.js +1 -0
  93. package/lib/utils/api.js.map +1 -1
  94. package/lib/utils/configuration.d.ts +17 -8
  95. package/lib/utils/configuration.d.ts.map +1 -1
  96. package/lib/utils/configuration.js +43 -1
  97. package/lib/utils/configuration.js.map +1 -1
  98. package/lib/utils/logger.d.ts +65 -0
  99. package/lib/utils/logger.d.ts.map +1 -0
  100. package/lib/utils/logger.js +189 -0
  101. package/lib/utils/logger.js.map +1 -0
  102. package/lib/utils/modules-resolver.spec.js +1 -1
  103. package/lib/utils/modules-resolver.spec.js.map +1 -1
  104. package/package.json +12 -12
  105. package/lib/logger.d.ts +0 -48
  106. package/lib/logger.d.ts.map +0 -1
  107. package/lib/logger.js +0 -106
  108. package/lib/logger.js.map +0 -1
  109. package/lib/utils/versionProvider.d.ts.map +0 -1
  110. package/lib/utils/versionProvider.js.map +0 -1
@@ -7,10 +7,11 @@
7
7
  import * as chai from 'chai';
8
8
  import fs from 'fs-extra';
9
9
  import * as lsp from 'vscode-languageserver';
10
+ import { TextDocument } from 'vscode-languageserver-textdocument';
10
11
  import * as lspcalls from './lsp-protocol.calls.proposed.js';
11
12
  import { uri, createServer, position, lastPosition, filePath, positionAfter, readContents, toPlatformEOL } from './test-utils.js';
12
- import { TextDocument } from 'vscode-languageserver-textdocument';
13
13
  import { Commands } from './commands.js';
14
+ import { SemicolonPreference } from './ts-protocol.js';
14
15
  import { CodeActionKind } from './utils/types.js';
15
16
  const assert = chai.assert;
16
17
  const diagnostics = new Map();
@@ -20,13 +21,6 @@ before(async () => {
20
21
  rootUri: uri(),
21
22
  publishDiagnostics: args => diagnostics.set(args.uri, args),
22
23
  });
23
- server.didChangeConfiguration({
24
- settings: {
25
- completions: {
26
- completeFunctionCalls: true,
27
- },
28
- },
29
- });
30
24
  });
31
25
  beforeEach(() => {
32
26
  server.closeAll();
@@ -144,7 +138,8 @@ describe('completion', () => {
144
138
  });
145
139
  const pos = position(doc, 'foo');
146
140
  const proposals = await server.completion({ textDocument: doc, position: pos });
147
- assert.isNull(proposals);
141
+ assert.isNotNull(proposals);
142
+ assert.strictEqual(proposals?.items.length, 0);
148
143
  server.didCloseTextDocument({ textDocument: doc });
149
144
  });
150
145
  it('includes completions from global modules', async () => {
@@ -184,6 +179,125 @@ describe('completion', () => {
184
179
  assert.equal(completion.textEdit.newText, '["invalid-identifier-name"]');
185
180
  server.didCloseTextDocument({ textDocument: doc });
186
181
  });
182
+ it('completions for clients that support insertReplaceSupport', async () => {
183
+ const doc = {
184
+ uri: uri('bar.ts'),
185
+ languageId: 'typescript',
186
+ version: 1,
187
+ text: `
188
+ class Foo {
189
+ getById() {};
190
+ }
191
+
192
+ const foo = new Foo()
193
+ foo.getById()
194
+ `,
195
+ };
196
+ server.didOpenTextDocument({ textDocument: doc });
197
+ const proposals = await server.completion({ textDocument: doc, position: positionAfter(doc, '.get') });
198
+ assert.isNotNull(proposals);
199
+ const completion = proposals.items.find(completion => completion.label === 'getById');
200
+ assert.isDefined(completion);
201
+ assert.deepInclude(completion, {
202
+ label: 'getById',
203
+ kind: lsp.CompletionItemKind.Method,
204
+ textEdit: {
205
+ newText: 'getById',
206
+ insert: {
207
+ start: {
208
+ line: 6,
209
+ character: 20,
210
+ },
211
+ end: {
212
+ line: 6,
213
+ character: 23,
214
+ },
215
+ },
216
+ replace: {
217
+ start: {
218
+ line: 6,
219
+ character: 20,
220
+ },
221
+ end: {
222
+ line: 6,
223
+ character: 27,
224
+ },
225
+ },
226
+ },
227
+ });
228
+ server.didCloseTextDocument({ textDocument: doc });
229
+ });
230
+ it('completions for clients that do not support insertReplaceSupport', async () => {
231
+ const clientCapabilitiesOverride = {
232
+ textDocument: {
233
+ completion: {
234
+ completionItem: {
235
+ insertReplaceSupport: false,
236
+ },
237
+ },
238
+ },
239
+ };
240
+ const localServer = await createServer({
241
+ rootUri: null,
242
+ publishDiagnostics: () => { },
243
+ clientCapabilitiesOverride,
244
+ });
245
+ const doc = {
246
+ uri: uri('bar.ts'),
247
+ languageId: 'typescript',
248
+ version: 1,
249
+ text: `
250
+ class Foo {
251
+ getById() {};
252
+ }
253
+
254
+ const foo = new Foo()
255
+ foo.getById()
256
+ `,
257
+ };
258
+ localServer.didOpenTextDocument({ textDocument: doc });
259
+ const proposals = await localServer.completion({ textDocument: doc, position: positionAfter(doc, '.get') });
260
+ assert.isNotNull(proposals);
261
+ const completion = proposals.items.find(completion => completion.label === 'getById');
262
+ assert.isDefined(completion);
263
+ assert.isUndefined(completion.textEdit);
264
+ localServer.didCloseTextDocument({ textDocument: doc });
265
+ localServer.closeAll();
266
+ localServer.shutdown();
267
+ });
268
+ it('provides snippet completion in import statement', async () => {
269
+ const doc = {
270
+ uri: uri('bar.ts'),
271
+ languageId: 'typescript',
272
+ version: 1,
273
+ text: 'import { readFile }',
274
+ };
275
+ server.didOpenTextDocument({ textDocument: doc });
276
+ const proposals = await server.completion({ textDocument: doc, position: positionAfter(doc, 'readFile') });
277
+ assert.isNotNull(proposals);
278
+ const completion = proposals.items.find(completion => completion.label === 'readFile');
279
+ assert.isDefined(completion);
280
+ assert.deepInclude(completion, {
281
+ label: 'readFile',
282
+ kind: lsp.CompletionItemKind.Function,
283
+ insertTextFormat: lsp.InsertTextFormat.Snippet,
284
+ detail: 'fs',
285
+ textEdit: {
286
+ newText: 'import { readFile$1 } from "fs";',
287
+ range: {
288
+ start: {
289
+ line: 0,
290
+ character: 0,
291
+ },
292
+ end: {
293
+ line: 0,
294
+ character: 19,
295
+ },
296
+ },
297
+ },
298
+ });
299
+ server.didCloseTextDocument({ textDocument: doc });
300
+ });
187
301
  it('includes detail field with package name for auto-imports', async () => {
188
302
  const doc = {
189
303
  uri: uri('bar.ts'),
@@ -197,7 +311,6 @@ describe('completion', () => {
197
311
  const completion = proposals.items.find(completion => completion.label === 'readFile');
198
312
  assert.isDefined(completion);
199
313
  assert.strictEqual(completion.detail, 'fs');
200
- assert.strictEqual(completion.insertTextFormat, /* snippet */ 2);
201
314
  server.didCloseTextDocument({ textDocument: doc });
202
315
  });
203
316
  it('resolves text edit for auto-import completion', async () => {
@@ -231,13 +344,11 @@ describe('completion', () => {
231
344
  server.didCloseTextDocument({ textDocument: doc });
232
345
  });
233
346
  it('resolves text edit for auto-import completion in right format', async () => {
234
- server.didChangeConfiguration({
235
- settings: {
236
- typescript: {
237
- format: {
238
- semicolons: 'remove',
239
- insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: false,
240
- },
347
+ server.updateWorkspaceSettings({
348
+ typescript: {
349
+ format: {
350
+ semicolons: SemicolonPreference.Remove,
351
+ insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: false,
241
352
  },
242
353
  },
243
354
  });
@@ -269,21 +380,21 @@ describe('completion', () => {
269
380
  },
270
381
  ]);
271
382
  server.didCloseTextDocument({ textDocument: doc });
272
- server.didChangeConfiguration({
273
- settings: {
274
- completions: {
275
- completeFunctionCalls: true,
276
- },
277
- typescript: {
278
- format: {
279
- semicolons: 'ignore',
280
- insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: true,
281
- },
383
+ server.updateWorkspaceSettings({
384
+ typescript: {
385
+ format: {
386
+ semicolons: SemicolonPreference.Ignore,
387
+ insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: true,
282
388
  },
283
389
  },
284
390
  });
285
391
  });
286
392
  it('resolves a snippet for method completion', async () => {
393
+ server.updateWorkspaceSettings({
394
+ completions: {
395
+ completeFunctionCalls: true,
396
+ },
397
+ });
287
398
  const doc = {
288
399
  uri: uri('bar.ts'),
289
400
  languageId: 'typescript',
@@ -297,13 +408,197 @@ describe('completion', () => {
297
408
  const proposals = await server.completion({ textDocument: doc, position: positionAfter(doc, 'readFile') });
298
409
  assert.isNotNull(proposals);
299
410
  const completion = proposals.items.find(completion => completion.label === 'readFile');
300
- assert.strictEqual(completion.insertTextFormat, lsp.InsertTextFormat.Snippet);
301
- assert.strictEqual(completion.label, 'readFile');
302
411
  const resolvedItem = await server.completionResolve(completion);
303
- assert.strictEqual(resolvedItem.insertTextFormat, lsp.InsertTextFormat.Snippet);
304
- // eslint-disable-next-line no-template-curly-in-string
305
- assert.strictEqual(resolvedItem.insertText, 'readFile(${1:path}, ${2:options}, ${3:callback})$0');
412
+ assert.deepInclude(resolvedItem, {
413
+ label: 'readFile',
414
+ insertTextFormat: lsp.InsertTextFormat.Snippet,
415
+ // eslint-disable-next-line no-template-curly-in-string
416
+ insertText: 'readFile(${1:path}, ${2:options}, ${3:callback})$0',
417
+ textEdit: {
418
+ // eslint-disable-next-line no-template-curly-in-string
419
+ newText: 'readFile(${1:path}, ${2:options}, ${3:callback})$0',
420
+ insert: {
421
+ start: {
422
+ line: 2,
423
+ character: 19,
424
+ },
425
+ end: {
426
+ line: 2,
427
+ character: 27,
428
+ },
429
+ },
430
+ replace: {
431
+ start: {
432
+ line: 2,
433
+ character: 19,
434
+ },
435
+ end: {
436
+ line: 2,
437
+ character: 27,
438
+ },
439
+ },
440
+ },
441
+ });
306
442
  server.didCloseTextDocument({ textDocument: doc });
443
+ server.updateWorkspaceSettings({
444
+ completions: {
445
+ completeFunctionCalls: false,
446
+ },
447
+ });
448
+ });
449
+ it('does not provide snippet completion for "$" function when completeFunctionCalls disabled', async () => {
450
+ const doc = {
451
+ uri: uri('bar.ts'),
452
+ languageId: 'typescript',
453
+ version: 1,
454
+ text: `
455
+ function $(): void {}
456
+ /**/$
457
+ `,
458
+ };
459
+ server.didOpenTextDocument({ textDocument: doc });
460
+ const proposals = await server.completion({ textDocument: doc, position: positionAfter(doc, '/**/') });
461
+ assert.isNotNull(proposals);
462
+ const completion = proposals.items.find(completion => completion.label === '$');
463
+ assert.deepInclude(completion, {
464
+ label: '$',
465
+ textEdit: {
466
+ newText: '$',
467
+ insert: {
468
+ start: {
469
+ line: 2,
470
+ character: 20,
471
+ },
472
+ end: {
473
+ line: 2,
474
+ character: 20,
475
+ },
476
+ },
477
+ replace: {
478
+ start: {
479
+ line: 2,
480
+ character: 20,
481
+ },
482
+ end: {
483
+ line: 2,
484
+ character: 21,
485
+ },
486
+ },
487
+ },
488
+ });
489
+ const resolvedItem = await server.completionResolve(completion);
490
+ assert.deepInclude(resolvedItem, {
491
+ label: '$',
492
+ textEdit: {
493
+ newText: '$',
494
+ insert: {
495
+ start: {
496
+ line: 2,
497
+ character: 20,
498
+ },
499
+ end: {
500
+ line: 2,
501
+ character: 20,
502
+ },
503
+ },
504
+ replace: {
505
+ start: {
506
+ line: 2,
507
+ character: 20,
508
+ },
509
+ end: {
510
+ line: 2,
511
+ character: 21,
512
+ },
513
+ },
514
+ },
515
+ });
516
+ server.didCloseTextDocument({ textDocument: doc });
517
+ });
518
+ it('provides snippet completions for "$" function when completeFunctionCalls enabled', async () => {
519
+ server.updateWorkspaceSettings({
520
+ completions: {
521
+ completeFunctionCalls: true,
522
+ },
523
+ });
524
+ const doc = {
525
+ uri: uri('bar.ts'),
526
+ languageId: 'typescript',
527
+ version: 1,
528
+ text: `
529
+ function $(): void {}
530
+ /**/$
531
+ `,
532
+ };
533
+ server.didOpenTextDocument({ textDocument: doc });
534
+ const proposals = await server.completion({ textDocument: doc, position: positionAfter(doc, '/**/') });
535
+ assert.isNotNull(proposals);
536
+ const completion = proposals.items.find(completion => completion.label === '$');
537
+ // NOTE: Technically not valid until resolved.
538
+ assert.deepInclude(completion, {
539
+ label: '$',
540
+ insertTextFormat: lsp.InsertTextFormat.Snippet,
541
+ textEdit: {
542
+ newText: '$',
543
+ insert: {
544
+ start: {
545
+ line: 2,
546
+ character: 20,
547
+ },
548
+ end: {
549
+ line: 2,
550
+ character: 20,
551
+ },
552
+ },
553
+ replace: {
554
+ start: {
555
+ line: 2,
556
+ character: 20,
557
+ },
558
+ end: {
559
+ line: 2,
560
+ character: 21,
561
+ },
562
+ },
563
+ },
564
+ });
565
+ const resolvedItem = await server.completionResolve(completion);
566
+ assert.deepInclude(resolvedItem, {
567
+ label: '$',
568
+ insertTextFormat: lsp.InsertTextFormat.Snippet,
569
+ // eslint-disable-next-line no-template-curly-in-string
570
+ insertText: '\\$()$0',
571
+ textEdit: {
572
+ // eslint-disable-next-line no-template-curly-in-string
573
+ newText: '\\$()$0',
574
+ insert: {
575
+ start: {
576
+ line: 2,
577
+ character: 20,
578
+ },
579
+ end: {
580
+ line: 2,
581
+ character: 20,
582
+ },
583
+ },
584
+ replace: {
585
+ start: {
586
+ line: 2,
587
+ character: 20,
588
+ },
589
+ end: {
590
+ line: 2,
591
+ character: 21,
592
+ },
593
+ },
594
+ },
595
+ });
596
+ server.didCloseTextDocument({ textDocument: doc });
597
+ server.updateWorkspaceSettings({
598
+ completions: {
599
+ completeFunctionCalls: false,
600
+ },
601
+ });
307
602
  });
308
603
  it('includes textEdit for string completion', async () => {
309
604
  const doc = {
@@ -315,7 +610,7 @@ describe('completion', () => {
315
610
  return true;
316
611
  }
317
612
 
318
- test("fs/")
613
+ test("fs/r")
319
614
  `,
320
615
  };
321
616
  server.didOpenTextDocument({ textDocument: doc });
@@ -329,13 +624,21 @@ describe('completion', () => {
329
624
  });
330
625
  assert.isNotNull(proposals);
331
626
  const completion = proposals.items.find(completion => completion.label === 'fs/read');
332
- assert.strictEqual(completion.label, 'fs/read');
333
- assert.deepStrictEqual(completion.textEdit, {
334
- range: {
335
- start: { line: 5, character: 20 },
336
- end: { line: 5, character: 23 },
627
+ assert.deepInclude(completion, {
628
+ label: 'fs/read',
629
+ textEdit: {
630
+ newText: 'fs/read',
631
+ range: {
632
+ start: {
633
+ line: 5,
634
+ character: 20,
635
+ },
636
+ end: {
637
+ line: 5,
638
+ character: 24,
639
+ },
640
+ },
337
641
  },
338
- newText: 'fs/read',
339
642
  });
340
643
  });
341
644
  it('includes labelDetails with useLabelDetailsInCompletionEntries enabled', async () => {
@@ -361,16 +664,14 @@ describe('completion', () => {
361
664
  assert.lengthOf(proposals.items, 2);
362
665
  assert.deepInclude(proposals.items[0], {
363
666
  label: 'bar',
364
- kind: 2,
365
- insertTextFormat: 2,
667
+ kind: lsp.CompletionItemKind.Method,
366
668
  });
367
669
  assert.deepInclude(proposals.items[1], {
368
670
  label: 'bar',
369
671
  labelDetails: {
370
672
  detail: '(x)',
371
673
  },
372
- kind: 2,
373
- insertTextFormat: 2,
674
+ kind: lsp.CompletionItemKind.Method,
374
675
  insertText: toPlatformEOL('bar(x) {\n $0\n},'),
375
676
  });
376
677
  });
@@ -574,11 +875,9 @@ describe('diagnostics', () => {
574
875
  assert.equal(diagnosticsForDoc2.diagnostics.length, 1, JSON.stringify(diagnostics));
575
876
  });
576
877
  it('code 6133 (ununsed variable) is ignored', async () => {
577
- server.didChangeConfiguration({
578
- settings: {
579
- diagnostics: {
580
- ignoredCodes: [6133],
581
- },
878
+ server.updateWorkspaceSettings({
879
+ diagnostics: {
880
+ ignoredCodes: [6133],
582
881
  },
583
882
  });
584
883
  const doc = {
@@ -784,24 +1083,22 @@ describe('references', () => {
784
1083
  // export function foo(): void {
785
1084
  // console.log('test')
786
1085
  // }
787
- // `
1086
+ // `,
788
1087
  // };
789
1088
  // server.didOpenTextDocument({
790
- // textDocument: doc
1089
+ // textDocument: doc,
791
1090
  // });
792
- // server.didChangeConfiguration({
793
- // settings: {
794
- // typescript: {
795
- // format: {
796
- // insertSpaceAfterCommaDelimiter: true
797
- // }
1091
+ // server.updateWorkspaceSettingsttings({
1092
+ // typescript: {
1093
+ // format: {
1094
+ // insertSpaceAfterCommaDelimiter: true,
798
1095
  // },
799
- // javascript: {
800
- // format: {
801
- // insertSpaceAfterCommaDelimiter: false
802
- // }
803
- // }
804
- // }
1096
+ // },
1097
+ // javascript: {
1098
+ // format: {
1099
+ // insertSpaceAfterCommaDelimiter: false,
1100
+ // },
1101
+ // },
805
1102
  // });
806
1103
  // const file = filePath('bar.ts');
807
1104
  // const settings = server.getWorkspacePreferencesForDocument(file);
@@ -812,6 +1109,16 @@ describe('formatting', () => {
812
1109
  const uriString = uri('bar.ts');
813
1110
  const languageId = 'typescript';
814
1111
  const version = 1;
1112
+ before(async () => {
1113
+ server.updateWorkspaceSettings({
1114
+ typescript: {
1115
+ format: {
1116
+ semicolons: SemicolonPreference.Ignore,
1117
+ insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: true,
1118
+ },
1119
+ },
1120
+ });
1121
+ });
815
1122
  it('full document formatting', async () => {
816
1123
  const text = 'export function foo ( ) : void { }';
817
1124
  const textDocument = {
@@ -866,13 +1173,11 @@ describe('formatting', () => {
866
1173
  uri: uriString, languageId, version, text,
867
1174
  };
868
1175
  server.didOpenTextDocument({ textDocument });
869
- server.didChangeConfiguration({
870
- settings: {
871
- typescript: {
872
- format: {
873
- newLineCharacter: '\n',
874
- placeOpenBraceOnNewLineForFunctions: true,
875
- },
1176
+ server.updateWorkspaceSettings({
1177
+ typescript: {
1178
+ format: {
1179
+ newLineCharacter: '\n',
1180
+ placeOpenBraceOnNewLineForFunctions: true,
876
1181
  },
877
1182
  },
878
1183
  });
@@ -1775,23 +2080,19 @@ describe('jsx/tsx project', () => {
1775
2080
  });
1776
2081
  describe('inlayHints', () => {
1777
2082
  before(async () => {
1778
- server.didChangeConfiguration({
1779
- settings: {
1780
- typescript: {
1781
- inlayHints: {
1782
- includeInlayFunctionLikeReturnTypeHints: true,
1783
- },
2083
+ server.updateWorkspaceSettings({
2084
+ typescript: {
2085
+ inlayHints: {
2086
+ includeInlayFunctionLikeReturnTypeHints: true,
1784
2087
  },
1785
2088
  },
1786
2089
  });
1787
2090
  });
1788
2091
  after(() => {
1789
- server.didChangeConfiguration({
1790
- settings: {
1791
- typescript: {
1792
- inlayHints: {
1793
- includeInlayFunctionLikeReturnTypeHints: false,
1794
- },
2092
+ server.updateWorkspaceSettings({
2093
+ typescript: {
2094
+ inlayHints: {
2095
+ includeInlayFunctionLikeReturnTypeHints: false,
1795
2096
  },
1796
2097
  },
1797
2098
  });