@@ -12,7 +12,7 @@ import {MessageConnection} from 'vscode-jsonrpc';
12
12
import * as lsp from 'vscode-languageserver-protocol' ;
13
13
import { URI } from 'vscode-uri' ;
14
14
15
- import { NgccProgressEnd , ProjectLanguageService , ProjectLanguageServiceParams , SuggestStrictMode , SuggestStrictModeParams } from '../../common/notifications' ;
15
+ import { ProjectLanguageService , ProjectLanguageServiceParams , SuggestStrictMode , SuggestStrictModeParams } from '../../common/notifications' ;
16
16
import { GetComponentsWithTemplateFile , GetTcbRequest , GetTemplateLocationForComponent , IsInAngularProject } from '../../common/requests' ;
17
17
import { APP_COMPONENT , APP_COMPONENT_URI , FOO_COMPONENT , FOO_COMPONENT_URI , FOO_TEMPLATE , FOO_TEMPLATE_URI , IS_BAZEL , PROJECT_PATH , TSCONFIG } from '../test_constants' ;
18
18
@@ -41,28 +41,8 @@ describe('Angular Ivy language server', () => {
41
41
client . dispose ( ) ;
42
42
} ) ;
43
43
44
- it ( 'should send ngcc progress after a project has finished loading' , async ( ) => {
45
- openTextDocument ( client , APP_COMPONENT ) ;
46
- const configFilePath = await onNgccProgress ( client ) ;
47
- expect ( configFilePath . endsWith ( 'integration/project/tsconfig.json' ) ) . toBeTrue ( ) ;
48
- } ) ;
49
-
50
- it ( 'should disable language service until ngcc has completed' , async ( ) => {
51
- openTextDocument ( client , APP_COMPONENT ) ;
52
- const languageServiceEnabled = await onLanguageServiceStateNotification ( client ) ;
53
- expect ( languageServiceEnabled ) . toBeFalse ( ) ;
54
- } ) ;
55
-
56
- it ( 'should re-enable language service once ngcc has completed' , async ( ) => {
57
- openTextDocument ( client , APP_COMPONENT ) ;
58
- const languageServiceEnabled = await waitForNgcc ( client ) ;
59
- expect ( languageServiceEnabled ) . toBeTrue ( ) ;
60
- } ) ;
61
-
62
44
it ( 'should handle hover on inline template' , async ( ) => {
63
45
openTextDocument ( client , APP_COMPONENT ) ;
64
- const languageServiceEnabled = await waitForNgcc ( client ) ;
65
- expect ( languageServiceEnabled ) . toBeTrue ( ) ;
66
46
const response = await client . sendRequest ( lsp . HoverRequest . type , {
67
47
textDocument : {
68
48
uri : APP_COMPONENT_URI ,
@@ -77,8 +57,6 @@ describe('Angular Ivy language server', () => {
77
57
78
58
it ( 'should show diagnostics for inline template on open' , async ( ) => {
79
59
openTextDocument ( client , APP_COMPONENT ) ;
80
- const languageServiceEnabled = await waitForNgcc ( client ) ;
81
- expect ( languageServiceEnabled ) . toBeTrue ( ) ;
82
60
const diagnostics = await getDiagnosticsForFile ( client , APP_COMPONENT ) ;
83
61
expect ( diagnostics . length ) . toBe ( 0 ) ;
84
62
} ) ;
@@ -92,8 +70,6 @@ describe('Angular Ivy language server', () => {
92
70
text : `{{ doesnotexist }}` ,
93
71
} ,
94
72
} ) ;
95
- const languageServiceEnabled = await waitForNgcc ( client ) ;
96
- expect ( languageServiceEnabled ) . toBeTrue ( ) ;
97
73
const diagnostics = await getDiagnosticsForFile ( client , FOO_TEMPLATE ) ;
98
74
expect ( diagnostics . length ) . toBe ( 1 ) ;
99
75
expect ( diagnostics [ 0 ] . message )
@@ -107,8 +83,6 @@ describe('Angular Ivy language server', () => {
107
83
108
84
it ( 'should support request cancellation' , async ( ) => {
109
85
openTextDocument ( client , APP_COMPONENT ) ;
110
- const languageServiceEnabled = await waitForNgcc ( client ) ;
111
- expect ( languageServiceEnabled ) . toBeTrue ( ) ;
112
86
// Send a request and immediately cancel it
113
87
const promise = client . sendRequest ( lsp . HoverRequest . type , {
114
88
textDocument : {
@@ -132,8 +106,6 @@ describe('Angular Ivy language server', () => {
132
106
text : `<div *ngIf="false"></div>` ,
133
107
} ,
134
108
} ) ;
135
- const languageServiceEnabled = await waitForNgcc ( client ) ;
136
- expect ( languageServiceEnabled ) . toBeTrue ( ) ;
137
109
const response = await client . sendRequest ( lsp . DefinitionRequest . type , {
138
110
textDocument : {
139
111
uri : FOO_TEMPLATE_URI ,
@@ -168,8 +140,6 @@ describe('Angular Ivy language server', () => {
168
140
text : `<lib-post></lib-post>` ,
169
141
} ,
170
142
} ) ;
171
- const languageServiceEnabled = await waitForNgcc ( client ) ;
172
- expect ( languageServiceEnabled ) . toBeTrue ( ) ;
173
143
const response = await client . sendRequest ( lsp . DefinitionRequest . type , {
174
144
textDocument : {
175
145
uri : FOO_TEMPLATE_URI ,
@@ -199,8 +169,6 @@ export class AppComponent {
199
169
@Input() appInput = '';
200
170
@Output() appOutput = new EventEmitter<string>();
201
171
}` ) ;
202
- const languageServiceEnabled = await waitForNgcc ( client ) ;
203
- expect ( languageServiceEnabled ) . toBeTrue ( ) ;
204
172
const response = await client . sendRequest ( lsp . FoldingRangeRequest . type , {
205
173
textDocument : {
206
174
uri : APP_COMPONENT_URI ,
@@ -223,8 +191,6 @@ export class AppComponent {
223
191
text : `{{ title.toString() }}` ,
224
192
} ,
225
193
} ) ;
226
- const languageServiceEnabled = await waitForNgcc ( client ) ;
227
- expect ( languageServiceEnabled ) . toBeTrue ( ) ;
228
194
const response = ( await client . sendRequest ( lsp . SignatureHelpRequest . type , {
229
195
textDocument : {
230
196
uri : FOO_TEMPLATE_URI ,
@@ -245,8 +211,6 @@ export class AppComponent {
245
211
text : `{{ title.substr(0, ) }}` ,
246
212
} ,
247
213
} ) ;
248
- const languageServiceEnabled = await waitForNgcc ( client ) ;
249
- expect ( languageServiceEnabled ) . toBeTrue ( ) ;
250
214
const response = ( await client . sendRequest ( lsp . SignatureHelpRequest . type , {
251
215
textDocument : {
252
216
uri : FOO_TEMPLATE_URI ,
@@ -278,8 +242,6 @@ export class AppComponent {
278
242
279
243
it ( 'should retain typecheck files' , async ( ) => {
280
244
openTextDocument ( client , APP_COMPONENT ) ;
281
- const languageServiceEnabled = await waitForNgcc ( client ) ;
282
- expect ( languageServiceEnabled ) . toBeTrue ( ) ;
283
245
// Create a file in node_modules, this will trigger a project reload via
284
246
// the directory watcher
285
247
fs . writeFileSync ( dummy , '' ) ;
@@ -296,8 +258,6 @@ export class AppComponent {
296
258
describe ( 'completions' , ( ) => {
297
259
it ( 'for events' , async ( ) => {
298
260
openTextDocument ( client , FOO_TEMPLATE , `<my-app ()></my-app>` ) ;
299
- const languageServiceEnabled = await waitForNgcc ( client ) ;
300
- expect ( languageServiceEnabled ) . toBeTrue ( ) ;
301
261
const response = await client . sendRequest ( lsp . CompletionRequest . type , {
302
262
textDocument : {
303
263
uri : FOO_TEMPLATE_URI ,
@@ -316,8 +276,6 @@ export class AppComponent {
316
276
describe ( 'from template files' , ( ) => {
317
277
beforeEach ( async ( ) => {
318
278
openTextDocument ( client , FOO_TEMPLATE ) ;
319
- const languageServiceEnabled = await waitForNgcc ( client ) ;
320
- expect ( languageServiceEnabled ) . toBeTrue ( ) ;
321
279
} ) ;
322
280
323
281
it ( 'should handle prepare rename request for property read' , async ( ) => {
@@ -368,8 +326,6 @@ export class AppComponent {
368
326
describe ( 'from typescript files' , ( ) => {
369
327
beforeEach ( async ( ) => {
370
328
openTextDocument ( client , APP_COMPONENT ) ;
371
- const languageServiceEnabled = await waitForNgcc ( client ) ;
372
- expect ( languageServiceEnabled ) . toBeTrue ( ) ;
373
329
} ) ;
374
330
375
331
it ( 'should handle prepare rename request for inline template property read' , async ( ) => {
@@ -455,8 +411,6 @@ export class AppComponent {
455
411
fs . writeFileSync ( TSCONFIG , JSON . stringify ( config , null , 2 ) ) ;
456
412
457
413
openTextDocument ( client , APP_COMPONENT ) ;
458
- const languageServiceEnabled = await waitForNgcc ( client ) ;
459
- expect ( languageServiceEnabled ) . toBeTrue ( ) ;
460
414
} ) ;
461
415
462
416
it ( 'should suggest strict mode' , async ( ) => {
@@ -489,7 +443,6 @@ export class AppComponent {
489
443
490
444
it ( 'should handle getTcb request' , async ( ) => {
491
445
openTextDocument ( client , FOO_TEMPLATE ) ;
492
- await waitForNgcc ( client ) ;
493
446
const response = await client . sendRequest ( GetTcbRequest , {
494
447
textDocument : {
495
448
uri : FOO_TEMPLATE_URI ,
@@ -501,7 +454,6 @@ export class AppComponent {
501
454
502
455
it ( 'should handle goToComponent request' , async ( ) => {
503
456
openTextDocument ( client , FOO_TEMPLATE ) ;
504
- await waitForNgcc ( client ) ;
505
457
const response = await client . sendRequest ( GetComponentsWithTemplateFile , {
506
458
textDocument : {
507
459
uri : FOO_TEMPLATE_URI ,
@@ -512,7 +464,6 @@ export class AppComponent {
512
464
513
465
it ( 'should handle GetTemplateLocationForComponent request' , async ( ) => {
514
466
openTextDocument ( client , FOO_TEMPLATE ) ;
515
- await waitForNgcc ( client ) ;
516
467
const response = await client . sendRequest ( GetTemplateLocationForComponent , {
517
468
textDocument : {
518
469
uri : FOO_COMPONENT_URI ,
@@ -525,7 +476,6 @@ export class AppComponent {
525
476
526
477
it ( 'should handle GetTemplateLocationForComponent request when not in component' , async ( ) => {
527
478
openTextDocument ( client , FOO_TEMPLATE ) ;
528
- await waitForNgcc ( client ) ;
529
479
const response = await client . sendRequest ( GetTemplateLocationForComponent , {
530
480
textDocument : {
531
481
uri : FOO_COMPONENT_URI ,
@@ -537,7 +487,6 @@ export class AppComponent {
537
487
538
488
it ( 'should provide a "go to component" codelens' , async ( ) => {
539
489
openTextDocument ( client , FOO_TEMPLATE ) ;
540
- await waitForNgcc ( client ) ;
541
490
const codeLensResponse = await client . sendRequest ( lsp . CodeLensRequest . type , {
542
491
textDocument : {
543
492
uri : FOO_TEMPLATE_URI ,
@@ -555,7 +504,6 @@ export class AppComponent {
555
504
556
505
it ( 'detects an Angular project' , async ( ) => {
557
506
openTextDocument ( client , FOO_TEMPLATE ) ;
558
- await waitForNgcc ( client ) ;
559
507
const templateResponse = await client . sendRequest ( IsInAngularProject , {
560
508
textDocument : {
561
509
uri : FOO_TEMPLATE_URI ,
@@ -603,8 +551,6 @@ describe('auto-apply optional chaining', () => {
603
551
}
604
552
` ) ;
605
553
openTextDocument ( client , FOO_TEMPLATE , `{{ person.n }}` ) ;
606
- const languageServiceEnabled = await waitForNgcc ( client ) ;
607
- expect ( languageServiceEnabled ) . toBeTrue ( ) ;
608
554
const response = await client . sendRequest ( lsp . CompletionRequest . type , {
609
555
textDocument : {
610
556
uri : FOO_TEMPLATE_URI ,
@@ -618,8 +564,6 @@ describe('auto-apply optional chaining', () => {
618
564
619
565
it ( 'should work on NonNullable symbol' , async ( ) => {
620
566
openTextDocument ( client , FOO_TEMPLATE , `{{ title.substr }}` ) ;
621
- const languageServiceEnabled = await waitForNgcc ( client ) ;
622
- expect ( languageServiceEnabled ) . toBeTrue ( ) ;
623
567
const response = await client . sendRequest ( lsp . CompletionRequest . type , {
624
568
textDocument : {
625
569
uri : FOO_TEMPLATE_URI ,
@@ -655,8 +599,6 @@ describe('insert snippet text', () => {
655
599
656
600
it ( 'should be able to complete for an attribute with the value is empty' , async ( ) => {
657
601
openTextDocument ( client , FOO_TEMPLATE , `<my-app appOut></my-app>` ) ;
658
- const languageServiceEnabled = await waitForNgcc ( client ) ;
659
- expect ( languageServiceEnabled ) . toBeTrue ( ) ;
660
602
const response = await client . sendRequest ( lsp . CompletionRequest . type , {
661
603
textDocument : {
662
604
uri : FOO_TEMPLATE_URI ,
@@ -671,8 +613,6 @@ describe('insert snippet text', () => {
671
613
672
614
it ( 'should not be included in the completion for an attribute with a value' , async ( ) => {
673
615
openTextDocument ( client , FOO_TEMPLATE , `<my-app [appInput]="1"></my-app>` ) ;
674
- const languageServiceEnabled = await waitForNgcc ( client ) ;
675
- expect ( languageServiceEnabled ) . toBeTrue ( ) ;
676
616
const response = await client . sendRequest ( lsp . CompletionRequest . type , {
677
617
textDocument : {
678
618
uri : FOO_TEMPLATE_URI ,
@@ -709,8 +649,6 @@ describe('code fixes', () => {
709
649
710
650
it ( 'should fix error when property does not exist on type' , async ( ) => {
711
651
openTextDocument ( client , FOO_TEMPLATE , `{{titl}}` ) ;
712
- const languageServiceEnabled = await waitForNgcc ( client ) ;
713
- expect ( languageServiceEnabled ) . toBeTrue ( ) ;
714
652
const diags = await getDiagnosticsForFile ( client , FOO_TEMPLATE ) ;
715
653
const codeActions = await client . sendRequest ( lsp . CodeActionRequest . type , {
716
654
textDocument : {
@@ -735,8 +673,6 @@ describe('code fixes', () => {
735
673
it ( 'should fix error when the range the user selects is larger than the diagnostic' , async ( ) => {
736
674
const template = `<span>{{titl}}</span>` ;
737
675
openTextDocument ( client , FOO_TEMPLATE , template ) ;
738
- const languageServiceEnabled = await waitForNgcc ( client ) ;
739
- expect ( languageServiceEnabled ) . toBeTrue ( ) ;
740
676
const diags = await getDiagnosticsForFile ( client , FOO_TEMPLATE ) ;
741
677
const codeActions = await client . sendRequest ( lsp . CodeActionRequest . type , {
742
678
textDocument : {
@@ -771,8 +707,6 @@ describe('code fixes', () => {
771
707
banner = '';
772
708
}
773
709
` ) ;
774
- const languageServiceEnabled = await waitForNgcc ( client ) ;
775
- expect ( languageServiceEnabled ) . toBeTrue ( ) ;
776
710
} ) ;
777
711
778
712
it ( 'for "fixSpelling"' , async ( ) => {
@@ -838,14 +772,6 @@ describe('code fixes', () => {
838
772
} ) ;
839
773
} ) ;
840
774
841
- function onNgccProgress ( client : MessageConnection ) : Promise < string > {
842
- return new Promise ( resolve => {
843
- client . onNotification ( NgccProgressEnd , ( params ) => {
844
- resolve ( params . configFilePath ) ;
845
- } ) ;
846
- } ) ;
847
- }
848
-
849
775
function onSuggestStrictMode ( client : MessageConnection ) : Promise < string > {
850
776
return new Promise ( resolve => {
851
777
client . onNotification ( SuggestStrictMode , ( params : SuggestStrictModeParams ) => {
@@ -873,8 +799,3 @@ function getDiagnosticsForFile(
873
799
} ) ;
874
800
} ) ;
875
801
}
876
-
877
- async function waitForNgcc ( client : MessageConnection ) : Promise < boolean > {
878
- await onNgccProgress ( client ) ;
879
- return onLanguageServiceStateNotification ( client ) ;
880
- }
0 commit comments