Skip to content

Commit c2169ed

Browse files
committed
Use NameRegion for definition, workplace jump and hover
1 parent 8410180 commit c2169ed

File tree

6 files changed

+9
-8
lines changed

6 files changed

+9
-8
lines changed

src/PowerShellEditorServices/Services/Symbols/ParameterSetSignatures.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ public ParameterSetSignatures(IEnumerable<CommandParameterSetInfo> commandInfoSe
4646
paramSetSignatures.Add(new ParameterSetSignature(setInfo));
4747
}
4848
Signatures = paramSetSignatures.ToArray();
49-
CommandName = foundSymbol.ScriptRegion.Text;
50-
ScriptRegion = foundSymbol.ScriptRegion;
49+
CommandName = foundSymbol.NameRegion.Text;
50+
ScriptRegion = foundSymbol.NameRegion;
5151
}
5252
}
5353

src/PowerShellEditorServices/Services/TextDocument/Handlers/DefinitionHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public override async Task<LocationOrLocationLinks> Handle(DefinitionParams requ
5454
new Location
5555
{
5656
Uri = DocumentUri.From(foundDefinition.FilePath),
57-
Range = foundDefinition.ScriptRegion.ToRange()
57+
Range = foundDefinition.NameRegion.ToRange()
5858
}));
5959
}
6060
}

src/PowerShellEditorServices/Services/TextDocument/Handlers/DocumentSymbolHandler.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ public override async Task<SymbolInformationOrDocumentSymbolContainer> Handle(Do
7474
continue;
7575
}
7676

77-
// TODO: This should be a DocumentSymbol now as SymbolInformation is deprecated.
78-
// But this requires figuring out how to populate `children`.
77+
// TODO: This should be a DocumentSymbol now as SymbolInformation is deprecated. But
78+
// this requires figuring out how to populate `children`. Once we do that, the range
79+
// can be NameRegion.
7980
//
8081
// symbols.Add(new SymbolInformationOrDocumentSymbol(new DocumentSymbol
8182
// {

src/PowerShellEditorServices/Services/TextDocument/Handlers/HoverHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ await _symbolsService.FindSymbolDetailsAtLocationAsync(
7070
return new Hover
7171
{
7272
Contents = new MarkedStringsOrMarkupContent(symbolInfo),
73-
Range = symbolDetails.SymbolReference.ScriptRegion.ToRange()
73+
Range = symbolDetails.SymbolReference.NameRegion.ToRange()
7474
};
7575
}
7676
}

src/PowerShellEditorServices/Services/TextDocument/Handlers/ReferencesHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public override async Task<LocationContainer> Handle(ReferenceParams request, Ca
5454
locations.Add(new Location
5555
{
5656
Uri = DocumentUri.From(foundReference.FilePath),
57-
Range = foundReference.ScriptRegion.ToRange()
57+
Range = foundReference.NameRegion.ToRange()
5858
});
5959
}
6060

src/PowerShellEditorServices/Services/Workspace/Handlers/WorkspaceSymbolsHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public override async Task<Container<SymbolInformation>> Handle(WorkspaceSymbolP
7676
Location location = new()
7777
{
7878
Uri = DocumentUri.From(foundOccurrence.FilePath),
79-
Range = foundOccurrence.ScriptRegion.ToRange()
79+
Range = foundOccurrence.NameRegion.ToRange()
8080
};
8181

8282
// TODO: This should be a WorkplaceSymbol now as SymbolInformation is deprecated.

0 commit comments

Comments
 (0)