Skip to content

Commit ccec61c

Browse files
authored
Return null when Hover request is cancelled or no symbol details (#1316)
Previously we returned a new Hover instance without initializing the Contents or Range members. At least in VS Code, this will result in the LSP client attempting to access null properties. As we're not returning any Hover data, the correct response is to simply return null.
1 parent 0c2d369 commit ccec61c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public async Task<Hover> Handle(HoverParams request, CancellationToken cancellat
4848
if (cancellationToken.IsCancellationRequested)
4949
{
5050
_logger.LogDebug("Hover request canceled for file: {0}", request.TextDocument.Uri);
51-
return new Hover();
51+
return null;
5252
}
5353

5454
ScriptFile scriptFile = _workspaceService.GetFile(request.TextDocument.Uri);
@@ -61,7 +61,7 @@ await _symbolsService.FindSymbolDetailsAtLocationAsync(
6161

6262
if (symbolDetails == null)
6363
{
64-
return new Hover();
64+
return null;
6565
}
6666

6767
List<MarkedString> symbolInfo = new List<MarkedString>();

0 commit comments

Comments
 (0)