Skip to content

Return null when Hover request is cancelled or no symbol details #1316

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 22, 2020
Merged

Return null when Hover request is cancelled or no symbol details #1316

merged 1 commit into from
Jun 22, 2020

Conversation

ralish
Copy link
Contributor

@ralish ralish commented Jun 20, 2020

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. See the Hover Request (Response) section in the LSP spec.

To reproduce the issue in VS Code:

  1. Ensure the PowerShell extension is installed and open a PowerShell script.
  2. Switch the Output console to Log (Extension Host) or Log (Window) (it seems to differ sometimes?).
  3. Hover over some text with no expected hover content (e.g. a word in a string).
  4. An exception is thrown on reading the uninitialized Contents property of the Hover instance.

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.
@ralish ralish requested a review from rjmholt as a code owner June 20, 2020 01:52
@rjmholt rjmholt requested a review from TylerLeonhardt June 22, 2020 17:31
Copy link
Member

@TylerLeonhardt TylerLeonhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thank you for fixing this!

@TylerLeonhardt TylerLeonhardt merged commit ccec61c into PowerShell:master Jun 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants