@@ -15,7 +15,7 @@ import {URI} from 'vscode-uri';
15
15
import { ProjectLanguageService , ProjectLanguageServiceParams , SuggestStrictMode , SuggestStrictModeParams } from '../../common/notifications' ;
16
16
import { NgccProgress , NgccProgressToken , NgccProgressType } from '../../common/progress' ;
17
17
import { GetComponentsWithTemplateFile , GetTcbRequest , IsInAngularProject } from '../../common/requests' ;
18
- import { APP_COMPONENT , FOO_COMPONENT , FOO_TEMPLATE , PROJECT_PATH , TSCONFIG } from '../test_constants' ;
18
+ import { APP_COMPONENT , APP_COMPONENT_URI , FOO_COMPONENT_URI , FOO_TEMPLATE , FOO_TEMPLATE_URI , PROJECT_PATH , TSCONFIG } from '../test_constants' ;
19
19
20
20
import { createConnection , createTracer , initializeServer , openTextDocument } from './test_utils' ;
21
21
@@ -66,7 +66,7 @@ describe('Angular Ivy language server', () => {
66
66
expect ( languageServiceEnabled ) . toBeTrue ( ) ;
67
67
const response = await client . sendRequest ( lsp . HoverRequest . type , {
68
68
textDocument : {
69
- uri : `file:// ${ APP_COMPONENT } ` ,
69
+ uri : APP_COMPONENT_URI ,
70
70
} ,
71
71
position : { line : 4 , character : 25 } ,
72
72
} ) ;
@@ -87,7 +87,7 @@ describe('Angular Ivy language server', () => {
87
87
it ( 'should show diagnostics for external template on open' , async ( ) => {
88
88
client . sendNotification ( lsp . DidOpenTextDocumentNotification . type , {
89
89
textDocument : {
90
- uri : `file:// ${ FOO_TEMPLATE } ` ,
90
+ uri : FOO_TEMPLATE_URI ,
91
91
languageId : 'html' ,
92
92
version : 1 ,
93
93
text : `{{ doesnotexist }}` ,
@@ -108,7 +108,7 @@ describe('Angular Ivy language server', () => {
108
108
// Send a request and immediately cancel it
109
109
const promise = client . sendRequest ( lsp . HoverRequest . type , {
110
110
textDocument : {
111
- uri : `file:// ${ APP_COMPONENT } ` ,
111
+ uri : FOO_COMPONENT_URI ,
112
112
} ,
113
113
position : { line : 4 , character : 25 } ,
114
114
} ) ;
@@ -122,7 +122,7 @@ describe('Angular Ivy language server', () => {
122
122
it ( 'does not break after opening `.d.ts` file from external template' , async ( ) => {
123
123
client . sendNotification ( lsp . DidOpenTextDocumentNotification . type , {
124
124
textDocument : {
125
- uri : `file:// ${ FOO_TEMPLATE } ` ,
125
+ uri : FOO_TEMPLATE_URI ,
126
126
languageId : 'html' ,
127
127
version : 1 ,
128
128
text : `<div *ngIf="false"></div>` ,
@@ -132,7 +132,7 @@ describe('Angular Ivy language server', () => {
132
132
expect ( languageServiceEnabled ) . toBeTrue ( ) ;
133
133
const response = await client . sendRequest ( lsp . DefinitionRequest . type , {
134
134
textDocument : {
135
- uri : `file:// ${ FOO_TEMPLATE } ` ,
135
+ uri : FOO_TEMPLATE_URI ,
136
136
} ,
137
137
position : { line : 0 , character : 7 } ,
138
138
} ) as lsp . LocationLink [ ] ;
@@ -145,7 +145,7 @@ describe('Angular Ivy language server', () => {
145
145
// try a hover operation again on *ngIf
146
146
const hoverResponse = await client . sendRequest ( lsp . HoverRequest . type , {
147
147
textDocument : {
148
- uri : `file:// ${ FOO_TEMPLATE } ` ,
148
+ uri : FOO_TEMPLATE_URI ,
149
149
} ,
150
150
position : { line : 0 , character : 7 } ,
151
151
} ) ;
@@ -159,7 +159,7 @@ describe('Angular Ivy language server', () => {
159
159
it ( 'should show signature help for an empty call' , async ( ) => {
160
160
client . sendNotification ( lsp . DidOpenTextDocumentNotification . type , {
161
161
textDocument : {
162
- uri : `file:// ${ FOO_TEMPLATE } ` ,
162
+ uri : FOO_TEMPLATE_URI ,
163
163
languageId : 'html' ,
164
164
version : 1 ,
165
165
text : `{{ title.toString() }}` ,
@@ -169,7 +169,7 @@ describe('Angular Ivy language server', () => {
169
169
expect ( languageServiceEnabled ) . toBeTrue ( ) ;
170
170
const response = ( await client . sendRequest ( lsp . SignatureHelpRequest . type , {
171
171
textDocument : {
172
- uri : `file:// ${ FOO_TEMPLATE } ` ,
172
+ uri : FOO_TEMPLATE_URI ,
173
173
} ,
174
174
position : { line : 0 , character : 18 } ,
175
175
} ) ) ! ;
@@ -181,7 +181,7 @@ describe('Angular Ivy language server', () => {
181
181
it ( 'should show signature help with multiple arguments' , async ( ) => {
182
182
client . sendNotification ( lsp . DidOpenTextDocumentNotification . type , {
183
183
textDocument : {
184
- uri : `file:// ${ FOO_TEMPLATE } ` ,
184
+ uri : FOO_TEMPLATE_URI ,
185
185
languageId : 'html' ,
186
186
version : 1 ,
187
187
text : `{{ title.substr(0, ) }}` ,
@@ -191,7 +191,7 @@ describe('Angular Ivy language server', () => {
191
191
expect ( languageServiceEnabled ) . toBeTrue ( ) ;
192
192
const response = ( await client . sendRequest ( lsp . SignatureHelpRequest . type , {
193
193
textDocument : {
194
- uri : `file:// ${ FOO_TEMPLATE } ` ,
194
+ uri : FOO_TEMPLATE_URI ,
195
195
} ,
196
196
position : { line : 0 , character : 19 } ,
197
197
} ) ) ! ;
@@ -241,7 +241,7 @@ describe('Angular Ivy language server', () => {
241
241
expect ( languageServiceEnabled ) . toBeTrue ( ) ;
242
242
const response = await client . sendRequest ( lsp . CompletionRequest . type , {
243
243
textDocument : {
244
- uri : `file:// ${ FOO_TEMPLATE } ` ,
244
+ uri : FOO_TEMPLATE_URI ,
245
245
} ,
246
246
position : { line : 0 , character : 9 } ,
247
247
} ) as lsp . CompletionItem [ ] ;
@@ -264,7 +264,7 @@ describe('Angular Ivy language server', () => {
264
264
it ( 'should handle prepare rename request for property read' , async ( ) => {
265
265
const response = await client . sendRequest ( lsp . PrepareRenameRequest . type , {
266
266
textDocument : {
267
- uri : `file:// ${ FOO_TEMPLATE } ` ,
267
+ uri : FOO_TEMPLATE_URI ,
268
268
} ,
269
269
position : { line : 0 , character : 3 } ,
270
270
} ) as { range : lsp . Range , placeholder : string } ;
@@ -293,16 +293,16 @@ describe('Angular Ivy language server', () => {
293
293
it ( 'should handle rename request for property read' , async ( ) => {
294
294
const response = await client . sendRequest ( lsp . RenameRequest . type , {
295
295
textDocument : {
296
- uri : `file:// ${ FOO_TEMPLATE } ` ,
296
+ uri : FOO_TEMPLATE_URI ,
297
297
} ,
298
298
position : { line : 0 , character : 3 } ,
299
299
newName : 'subtitle'
300
300
} ) ;
301
301
expect ( response ) . not . toBeNull ( ) ;
302
- expect ( response ?. changes ?. [ FOO_TEMPLATE ] . length ) . toBe ( 1 ) ;
303
- expect ( response ?. changes ?. [ FOO_TEMPLATE ] ) . toContain ( expectedRenameInTemplate ) ;
304
- expect ( response ?. changes ?. [ FOO_COMPONENT ] . length ) . toBe ( 1 ) ;
305
- expect ( response ?. changes ?. [ FOO_COMPONENT ] ) . toContain ( expectedRenameInComponent ) ;
302
+ expect ( response ?. changes ?. [ FOO_TEMPLATE_URI ] . length ) . toBe ( 1 ) ;
303
+ expect ( response ?. changes ?. [ FOO_TEMPLATE_URI ] ) . toContain ( expectedRenameInTemplate ) ;
304
+ expect ( response ?. changes ?. [ FOO_COMPONENT_URI ] . length ) . toBe ( 1 ) ;
305
+ expect ( response ?. changes ?. [ FOO_COMPONENT_URI ] ) . toContain ( expectedRenameInComponent ) ;
306
306
} ) ;
307
307
} ) ;
308
308
@@ -316,7 +316,7 @@ describe('Angular Ivy language server', () => {
316
316
it ( 'should handle prepare rename request for inline template property read' , async ( ) => {
317
317
const response = await client . sendRequest ( lsp . PrepareRenameRequest . type , {
318
318
textDocument : {
319
- uri : `file:// ${ APP_COMPONENT } ` ,
319
+ uri : APP_COMPONENT_URI ,
320
320
} ,
321
321
position : { line : 4 , character : 25 } ,
322
322
} ) as { range : lsp . Range , placeholder : string } ;
@@ -346,29 +346,29 @@ describe('Angular Ivy language server', () => {
346
346
it ( 'should handle rename request for property read in a template' , async ( ) => {
347
347
const response = await client . sendRequest ( lsp . RenameRequest . type , {
348
348
textDocument : {
349
- uri : `file:// ${ APP_COMPONENT } ` ,
349
+ uri : APP_COMPONENT_URI ,
350
350
} ,
351
351
position : { line : 4 , character : 25 } ,
352
352
newName : 'surname'
353
353
} ) ;
354
354
expect ( response ) . not . toBeNull ( ) ;
355
- expect ( response ?. changes ?. [ APP_COMPONENT ] . length ) . toBe ( 2 ) ;
356
- expect ( response ?. changes ?. [ APP_COMPONENT ] ) . toContain ( expectedRenameInComponent ) ;
357
- expect ( response ?. changes ?. [ APP_COMPONENT ] ) . toContain ( expectedRenameInTemplate ) ;
355
+ expect ( response ?. changes ?. [ APP_COMPONENT_URI ] . length ) . toBe ( 2 ) ;
356
+ expect ( response ?. changes ?. [ APP_COMPONENT_URI ] ) . toContain ( expectedRenameInComponent ) ;
357
+ expect ( response ?. changes ?. [ APP_COMPONENT_URI ] ) . toContain ( expectedRenameInTemplate ) ;
358
358
} ) ;
359
359
360
360
it ( 'should handle rename request for property in the component' , async ( ) => {
361
361
const response = await client . sendRequest ( lsp . RenameRequest . type , {
362
362
textDocument : {
363
- uri : `file:// ${ APP_COMPONENT } ` ,
363
+ uri : APP_COMPONENT_URI ,
364
364
} ,
365
365
position : { line : 7 , character : 4 } ,
366
366
newName : 'surname'
367
367
} ) ;
368
368
expect ( response ) . not . toBeNull ( ) ;
369
- expect ( response ?. changes ?. [ APP_COMPONENT ] . length ) . toBe ( 2 ) ;
370
- expect ( response ?. changes ?. [ APP_COMPONENT ] ) . toContain ( expectedRenameInComponent ) ;
371
- expect ( response ?. changes ?. [ APP_COMPONENT ] ) . toContain ( expectedRenameInTemplate ) ;
369
+ expect ( response ?. changes ?. [ APP_COMPONENT_URI ] . length ) . toBe ( 2 ) ;
370
+ expect ( response ?. changes ?. [ APP_COMPONENT_URI ] ) . toContain ( expectedRenameInComponent ) ;
371
+ expect ( response ?. changes ?. [ APP_COMPONENT_URI ] ) . toContain ( expectedRenameInTemplate ) ;
372
372
} ) ;
373
373
} ) ;
374
374
} ) ;
@@ -403,15 +403,15 @@ describe('Angular Ivy language server', () => {
403
403
404
404
const prepareRenameResponse = await client . sendRequest ( lsp . PrepareRenameRequest . type , {
405
405
textDocument : {
406
- uri : `file:// ${ APP_COMPONENT } ` ,
406
+ uri : FOO_COMPONENT_URI ,
407
407
} ,
408
408
position : { line : 4 , character : 25 } ,
409
409
} ) as { range : lsp . Range , placeholder : string } ;
410
410
expect ( prepareRenameResponse ) . toBeNull ( ) ;
411
411
412
412
const renameResponse = await client . sendRequest ( lsp . RenameRequest . type , {
413
413
textDocument : {
414
- uri : `file:// ${ APP_COMPONENT } ` ,
414
+ uri : FOO_COMPONENT_URI ,
415
415
} ,
416
416
position : { line : 4 , character : 25 } ,
417
417
newName : 'surname'
@@ -426,7 +426,7 @@ describe('Angular Ivy language server', () => {
426
426
await waitForNgcc ( client ) ;
427
427
const response = await client . sendRequest ( GetTcbRequest , {
428
428
textDocument : {
429
- uri : `file:// ${ FOO_TEMPLATE } ` ,
429
+ uri : FOO_TEMPLATE_URI ,
430
430
} ,
431
431
position : { line : 0 , character : 3 } ,
432
432
} ) ;
@@ -438,7 +438,7 @@ describe('Angular Ivy language server', () => {
438
438
await waitForNgcc ( client ) ;
439
439
const response = await client . sendRequest ( GetComponentsWithTemplateFile , {
440
440
textDocument : {
441
- uri : `file:// ${ FOO_TEMPLATE } ` ,
441
+ uri : FOO_TEMPLATE_URI ,
442
442
}
443
443
} ) ;
444
444
expect ( response ) . toBeDefined ( ) ;
@@ -449,12 +449,12 @@ describe('Angular Ivy language server', () => {
449
449
await waitForNgcc ( client ) ;
450
450
const codeLensResponse = await client . sendRequest ( lsp . CodeLensRequest . type , {
451
451
textDocument : {
452
- uri : `file:// ${ FOO_TEMPLATE } ` ,
452
+ uri : FOO_TEMPLATE_URI ,
453
453
}
454
454
} ) ;
455
455
expect ( codeLensResponse ) . toBeDefined ( ) ;
456
456
const [ codeLens ] = codeLensResponse ! ;
457
- expect ( codeLens . data . uri ) . toEqual ( `file:// ${ FOO_TEMPLATE } ` ) ;
457
+ expect ( codeLens . data . uri ) . toEqual ( FOO_TEMPLATE_URI ) ;
458
458
459
459
const codeLensResolveResponse =
460
460
await client . sendRequest ( lsp . CodeLensResolveRequest . type , codeLensResponse ! [ 0 ] ) ;
@@ -467,13 +467,13 @@ describe('Angular Ivy language server', () => {
467
467
await waitForNgcc ( client ) ;
468
468
const templateResponse = await client . sendRequest ( IsInAngularProject , {
469
469
textDocument : {
470
- uri : `file:// ${ FOO_TEMPLATE } ` ,
470
+ uri : FOO_TEMPLATE_URI ,
471
471
}
472
472
} ) ;
473
473
expect ( templateResponse ) . toBe ( true ) ;
474
474
const componentResponse = await client . sendRequest ( IsInAngularProject , {
475
475
textDocument : {
476
- uri : `file:// ${ FOO_COMPONENT } ` ,
476
+ uri : FOO_COMPONENT_URI ,
477
477
}
478
478
} ) ;
479
479
expect ( componentResponse ) . toBe ( true ) ;
0 commit comments