@@ -12,7 +12,7 @@ import {MessageConnection} from 'vscode-jsonrpc';
1212import * as lsp from 'vscode-languageserver-protocol' ;
1313import { URI } from 'vscode-uri' ;
1414
15- import { NgccProgressEnd , ProjectLanguageService , ProjectLanguageServiceParams , SuggestStrictMode , SuggestStrictModeParams } from '../../common/notifications' ;
15+ import { ProjectLanguageService , ProjectLanguageServiceParams , SuggestStrictMode , SuggestStrictModeParams } from '../../common/notifications' ;
1616import { GetComponentsWithTemplateFile , GetTcbRequest , GetTemplateLocationForComponent , IsInAngularProject } from '../../common/requests' ;
1717import { APP_COMPONENT , APP_COMPONENT_URI , FOO_COMPONENT , FOO_COMPONENT_URI , FOO_TEMPLATE , FOO_TEMPLATE_URI , IS_BAZEL , PROJECT_PATH , TSCONFIG } from '../test_constants' ;
1818
@@ -41,27 +41,9 @@ describe('Angular Ivy language server', () => {
4141 client . dispose ( ) ;
4242 } ) ;
4343
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-
6244 it ( 'should handle hover on inline template' , async ( ) => {
6345 openTextDocument ( client , APP_COMPONENT ) ;
64- const languageServiceEnabled = await waitForNgcc ( client ) ;
46+ const languageServiceEnabled = await waitForLanguageService ( client ) ;
6547 expect ( languageServiceEnabled ) . toBeTrue ( ) ;
6648 const response = await client . sendRequest ( lsp . HoverRequest . type , {
6749 textDocument : {
@@ -77,7 +59,7 @@ describe('Angular Ivy language server', () => {
7759
7860 it ( 'should show diagnostics for inline template on open' , async ( ) => {
7961 openTextDocument ( client , APP_COMPONENT ) ;
80- const languageServiceEnabled = await waitForNgcc ( client ) ;
62+ const languageServiceEnabled = await waitForLanguageService ( client ) ;
8163 expect ( languageServiceEnabled ) . toBeTrue ( ) ;
8264 const diagnostics = await getDiagnosticsForFile ( client , APP_COMPONENT ) ;
8365 expect ( diagnostics . length ) . toBe ( 0 ) ;
@@ -92,7 +74,7 @@ describe('Angular Ivy language server', () => {
9274 text : `{{ doesnotexist }}` ,
9375 } ,
9476 } ) ;
95- const languageServiceEnabled = await waitForNgcc ( client ) ;
77+ const languageServiceEnabled = await waitForLanguageService ( client ) ;
9678 expect ( languageServiceEnabled ) . toBeTrue ( ) ;
9779 const diagnostics = await getDiagnosticsForFile ( client , FOO_TEMPLATE ) ;
9880 expect ( diagnostics . length ) . toBe ( 1 ) ;
@@ -107,7 +89,7 @@ describe('Angular Ivy language server', () => {
10789
10890 it ( 'should support request cancellation' , async ( ) => {
10991 openTextDocument ( client , APP_COMPONENT ) ;
110- const languageServiceEnabled = await waitForNgcc ( client ) ;
92+ const languageServiceEnabled = await waitForLanguageService ( client ) ;
11193 expect ( languageServiceEnabled ) . toBeTrue ( ) ;
11294 // Send a request and immediately cancel it
11395 const promise = client . sendRequest ( lsp . HoverRequest . type , {
@@ -132,7 +114,7 @@ describe('Angular Ivy language server', () => {
132114 text : `<div *ngIf="false"></div>` ,
133115 } ,
134116 } ) ;
135- const languageServiceEnabled = await waitForNgcc ( client ) ;
117+ const languageServiceEnabled = await waitForLanguageService ( client ) ;
136118 expect ( languageServiceEnabled ) . toBeTrue ( ) ;
137119 const response = await client . sendRequest ( lsp . DefinitionRequest . type , {
138120 textDocument : {
@@ -168,7 +150,7 @@ describe('Angular Ivy language server', () => {
168150 text : `<lib-post></lib-post>` ,
169151 } ,
170152 } ) ;
171- const languageServiceEnabled = await waitForNgcc ( client ) ;
153+ const languageServiceEnabled = await waitForLanguageService ( client ) ;
172154 expect ( languageServiceEnabled ) . toBeTrue ( ) ;
173155 const response = await client . sendRequest ( lsp . DefinitionRequest . type , {
174156 textDocument : {
@@ -199,7 +181,7 @@ export class AppComponent {
199181 @Input() appInput = '';
200182 @Output() appOutput = new EventEmitter<string>();
201183}` ) ;
202- const languageServiceEnabled = await waitForNgcc ( client ) ;
184+ const languageServiceEnabled = await waitForLanguageService ( client ) ;
203185 expect ( languageServiceEnabled ) . toBeTrue ( ) ;
204186 const response = await client . sendRequest ( lsp . FoldingRangeRequest . type , {
205187 textDocument : {
@@ -223,7 +205,7 @@ export class AppComponent {
223205 text : `{{ title.toString() }}` ,
224206 } ,
225207 } ) ;
226- const languageServiceEnabled = await waitForNgcc ( client ) ;
208+ const languageServiceEnabled = await waitForLanguageService ( client ) ;
227209 expect ( languageServiceEnabled ) . toBeTrue ( ) ;
228210 const response = ( await client . sendRequest ( lsp . SignatureHelpRequest . type , {
229211 textDocument : {
@@ -245,7 +227,7 @@ export class AppComponent {
245227 text : `{{ title.substr(0, ) }}` ,
246228 } ,
247229 } ) ;
248- const languageServiceEnabled = await waitForNgcc ( client ) ;
230+ const languageServiceEnabled = await waitForLanguageService ( client ) ;
249231 expect ( languageServiceEnabled ) . toBeTrue ( ) ;
250232 const response = ( await client . sendRequest ( lsp . SignatureHelpRequest . type , {
251233 textDocument : {
@@ -278,7 +260,7 @@ export class AppComponent {
278260
279261 it ( 'should retain typecheck files' , async ( ) => {
280262 openTextDocument ( client , APP_COMPONENT ) ;
281- const languageServiceEnabled = await waitForNgcc ( client ) ;
263+ const languageServiceEnabled = await waitForLanguageService ( client ) ;
282264 expect ( languageServiceEnabled ) . toBeTrue ( ) ;
283265 // Create a file in node_modules, this will trigger a project reload via
284266 // the directory watcher
@@ -296,7 +278,7 @@ export class AppComponent {
296278 describe ( 'completions' , ( ) => {
297279 it ( 'for events' , async ( ) => {
298280 openTextDocument ( client , FOO_TEMPLATE , `<my-app ()></my-app>` ) ;
299- const languageServiceEnabled = await waitForNgcc ( client ) ;
281+ const languageServiceEnabled = await waitForLanguageService ( client ) ;
300282 expect ( languageServiceEnabled ) . toBeTrue ( ) ;
301283 const response = await client . sendRequest ( lsp . CompletionRequest . type , {
302284 textDocument : {
@@ -316,7 +298,7 @@ export class AppComponent {
316298 describe ( 'from template files' , ( ) => {
317299 beforeEach ( async ( ) => {
318300 openTextDocument ( client , FOO_TEMPLATE ) ;
319- const languageServiceEnabled = await waitForNgcc ( client ) ;
301+ const languageServiceEnabled = await waitForLanguageService ( client ) ;
320302 expect ( languageServiceEnabled ) . toBeTrue ( ) ;
321303 } ) ;
322304
@@ -368,7 +350,7 @@ export class AppComponent {
368350 describe ( 'from typescript files' , ( ) => {
369351 beforeEach ( async ( ) => {
370352 openTextDocument ( client , APP_COMPONENT ) ;
371- const languageServiceEnabled = await waitForNgcc ( client ) ;
353+ const languageServiceEnabled = await waitForLanguageService ( client ) ;
372354 expect ( languageServiceEnabled ) . toBeTrue ( ) ;
373355 } ) ;
374356
@@ -455,7 +437,7 @@ export class AppComponent {
455437 fs . writeFileSync ( TSCONFIG , JSON . stringify ( config , null , 2 ) ) ;
456438
457439 openTextDocument ( client , APP_COMPONENT ) ;
458- const languageServiceEnabled = await waitForNgcc ( client ) ;
440+ const languageServiceEnabled = await waitForLanguageService ( client ) ;
459441 expect ( languageServiceEnabled ) . toBeTrue ( ) ;
460442 } ) ;
461443
@@ -489,7 +471,7 @@ export class AppComponent {
489471
490472 it ( 'should handle getTcb request' , async ( ) => {
491473 openTextDocument ( client , FOO_TEMPLATE ) ;
492- await waitForNgcc ( client ) ;
474+ await waitForLanguageService ( client ) ;
493475 const response = await client . sendRequest ( GetTcbRequest , {
494476 textDocument : {
495477 uri : FOO_TEMPLATE_URI ,
@@ -501,7 +483,7 @@ export class AppComponent {
501483
502484 it ( 'should handle goToComponent request' , async ( ) => {
503485 openTextDocument ( client , FOO_TEMPLATE ) ;
504- await waitForNgcc ( client ) ;
486+ await waitForLanguageService ( client ) ;
505487 const response = await client . sendRequest ( GetComponentsWithTemplateFile , {
506488 textDocument : {
507489 uri : FOO_TEMPLATE_URI ,
@@ -512,7 +494,7 @@ export class AppComponent {
512494
513495 it ( 'should handle GetTemplateLocationForComponent request' , async ( ) => {
514496 openTextDocument ( client , FOO_TEMPLATE ) ;
515- await waitForNgcc ( client ) ;
497+ await waitForLanguageService ( client ) ;
516498 const response = await client . sendRequest ( GetTemplateLocationForComponent , {
517499 textDocument : {
518500 uri : FOO_COMPONENT_URI ,
@@ -525,7 +507,7 @@ export class AppComponent {
525507
526508 it ( 'should handle GetTemplateLocationForComponent request when not in component' , async ( ) => {
527509 openTextDocument ( client , FOO_TEMPLATE ) ;
528- await waitForNgcc ( client ) ;
510+ await waitForLanguageService ( client ) ;
529511 const response = await client . sendRequest ( GetTemplateLocationForComponent , {
530512 textDocument : {
531513 uri : FOO_COMPONENT_URI ,
@@ -537,7 +519,7 @@ export class AppComponent {
537519
538520 it ( 'should provide a "go to component" codelens' , async ( ) => {
539521 openTextDocument ( client , FOO_TEMPLATE ) ;
540- await waitForNgcc ( client ) ;
522+ await waitForLanguageService ( client ) ;
541523 const codeLensResponse = await client . sendRequest ( lsp . CodeLensRequest . type , {
542524 textDocument : {
543525 uri : FOO_TEMPLATE_URI ,
@@ -555,7 +537,7 @@ export class AppComponent {
555537
556538 it ( 'detects an Angular project' , async ( ) => {
557539 openTextDocument ( client , FOO_TEMPLATE ) ;
558- await waitForNgcc ( client ) ;
540+ await waitForLanguageService ( client ) ;
559541 const templateResponse = await client . sendRequest ( IsInAngularProject , {
560542 textDocument : {
561543 uri : FOO_TEMPLATE_URI ,
@@ -603,7 +585,7 @@ describe('auto-apply optional chaining', () => {
603585 }
604586 ` ) ;
605587 openTextDocument ( client , FOO_TEMPLATE , `{{ person.n }}` ) ;
606- const languageServiceEnabled = await waitForNgcc ( client ) ;
588+ const languageServiceEnabled = await waitForLanguageService ( client ) ;
607589 expect ( languageServiceEnabled ) . toBeTrue ( ) ;
608590 const response = await client . sendRequest ( lsp . CompletionRequest . type , {
609591 textDocument : {
@@ -618,7 +600,7 @@ describe('auto-apply optional chaining', () => {
618600
619601 it ( 'should work on NonNullable symbol' , async ( ) => {
620602 openTextDocument ( client , FOO_TEMPLATE , `{{ title.substr }}` ) ;
621- const languageServiceEnabled = await waitForNgcc ( client ) ;
603+ const languageServiceEnabled = await waitForLanguageService ( client ) ;
622604 expect ( languageServiceEnabled ) . toBeTrue ( ) ;
623605 const response = await client . sendRequest ( lsp . CompletionRequest . type , {
624606 textDocument : {
@@ -655,7 +637,7 @@ describe('insert snippet text', () => {
655637
656638 it ( 'should be able to complete for an attribute with the value is empty' , async ( ) => {
657639 openTextDocument ( client , FOO_TEMPLATE , `<my-app appOut></my-app>` ) ;
658- const languageServiceEnabled = await waitForNgcc ( client ) ;
640+ const languageServiceEnabled = await waitForLanguageService ( client ) ;
659641 expect ( languageServiceEnabled ) . toBeTrue ( ) ;
660642 const response = await client . sendRequest ( lsp . CompletionRequest . type , {
661643 textDocument : {
@@ -671,7 +653,7 @@ describe('insert snippet text', () => {
671653
672654 it ( 'should not be included in the completion for an attribute with a value' , async ( ) => {
673655 openTextDocument ( client , FOO_TEMPLATE , `<my-app [appInput]="1"></my-app>` ) ;
674- const languageServiceEnabled = await waitForNgcc ( client ) ;
656+ const languageServiceEnabled = await waitForLanguageService ( client ) ;
675657 expect ( languageServiceEnabled ) . toBeTrue ( ) ;
676658 const response = await client . sendRequest ( lsp . CompletionRequest . type , {
677659 textDocument : {
@@ -709,7 +691,7 @@ describe('code fixes', () => {
709691
710692 it ( 'should fix error when property does not exist on type' , async ( ) => {
711693 openTextDocument ( client , FOO_TEMPLATE , `{{titl}}` ) ;
712- const languageServiceEnabled = await waitForNgcc ( client ) ;
694+ const languageServiceEnabled = await waitForLanguageService ( client ) ;
713695 expect ( languageServiceEnabled ) . toBeTrue ( ) ;
714696 const diags = await getDiagnosticsForFile ( client , FOO_TEMPLATE ) ;
715697 const codeActions = await client . sendRequest ( lsp . CodeActionRequest . type , {
@@ -735,7 +717,7 @@ describe('code fixes', () => {
735717 it ( 'should fix error when the range the user selects is larger than the diagnostic' , async ( ) => {
736718 const template = `<span>{{titl}}</span>` ;
737719 openTextDocument ( client , FOO_TEMPLATE , template ) ;
738- const languageServiceEnabled = await waitForNgcc ( client ) ;
720+ const languageServiceEnabled = await waitForLanguageService ( client ) ;
739721 expect ( languageServiceEnabled ) . toBeTrue ( ) ;
740722 const diags = await getDiagnosticsForFile ( client , FOO_TEMPLATE ) ;
741723 const codeActions = await client . sendRequest ( lsp . CodeActionRequest . type , {
@@ -771,7 +753,7 @@ describe('code fixes', () => {
771753 banner = '';
772754 }
773755 ` ) ;
774- const languageServiceEnabled = await waitForNgcc ( client ) ;
756+ const languageServiceEnabled = await waitForLanguageService ( client ) ;
775757 expect ( languageServiceEnabled ) . toBeTrue ( ) ;
776758 } ) ;
777759
@@ -838,14 +820,6 @@ describe('code fixes', () => {
838820 } ) ;
839821} ) ;
840822
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-
849823function onSuggestStrictMode ( client : MessageConnection ) : Promise < string > {
850824 return new Promise ( resolve => {
851825 client . onNotification ( SuggestStrictMode , ( params : SuggestStrictModeParams ) => {
@@ -874,7 +848,6 @@ function getDiagnosticsForFile(
874848 } ) ;
875849}
876850
877- async function waitForNgcc ( client : MessageConnection ) : Promise < boolean > {
878- await onNgccProgress ( client ) ;
851+ async function waitForLanguageService ( client : MessageConnection ) : Promise < boolean > {
879852 return onLanguageServiceStateNotification ( client ) ;
880853}
0 commit comments