File tree Expand file tree Collapse file tree 3 files changed +35
-1
lines changed
test/PowerShellEditorServices.Test.Host Expand file tree Collapse file tree 3 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -455,6 +455,36 @@ await this.SendRequest(
455
455
Assert . Equal ( 7 , locations [ 0 ] . Range . End . Character ) ;
456
456
}
457
457
458
+ [ Fact ]
459
+ public async Task FindsDefinitionOfVariableInOtherFile ( )
460
+ {
461
+ await this . SendOpenFileEvent ( "TestFiles\\ FindReferences.ps1" ) ;
462
+
463
+ Location [ ] locations =
464
+ await this . SendRequest (
465
+ DefinitionRequest . Type ,
466
+ new TextDocumentPositionParams
467
+ {
468
+ TextDocument = new TextDocumentIdentifier
469
+ {
470
+ Uri = "TestFiles\\ FindReferences.ps1"
471
+ } ,
472
+ Position = new Position
473
+ {
474
+ Line = 15 ,
475
+ Character = 20 ,
476
+ }
477
+ } ) ;
478
+
479
+ Assert . NotNull ( locations ) ;
480
+ Assert . Equal ( 1 , locations . Length ) ;
481
+ Assert . EndsWith ( "VariableDefinition.ps1" , locations [ 0 ] . Uri ) ;
482
+ Assert . Equal ( 0 , locations [ 0 ] . Range . Start . Line ) ;
483
+ Assert . Equal ( 0 , locations [ 0 ] . Range . Start . Character ) ;
484
+ Assert . Equal ( 0 , locations [ 0 ] . Range . End . Line ) ;
485
+ Assert . Equal ( 20 , locations [ 0 ] . Range . End . Character ) ;
486
+ }
487
+
458
488
[ Fact ]
459
489
public async Task FindsOccurencesOnFunctionDefinition ( )
460
490
{
Original file line number Diff line number Diff line change @@ -10,4 +10,7 @@ My-Function $things
10
10
11
11
Write-Output " Hi" ;
12
12
13
- Write-Output " "
13
+ Write-Output " "
14
+
15
+ . .\VariableDefinition.ps1
16
+ Write-Output $variableInOtherFile
Original file line number Diff line number Diff line change
1
+ $variableInOtherFile = " some value"
You can’t perform that action at this time.
0 commit comments