Skip to content
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

fix issue when hoverData is nil #320

Merged
merged 1 commit into from
Nov 25, 2020
Merged

Conversation

njuCZ
Copy link
Contributor

@njuCZ njuCZ commented Nov 25, 2020

fix #317

tried to return empty lsp.Hover, however, the vscode client will complain: unsupported Markup content received. Kind is:
Capture

The official recommendation is just return null from here: microsoft/language-server-protocol#261

generally two ways:

  • make lsp protocol model fields be pointer type.
  • in handle function, just return pointer type result

It seems we generate the lsp protocol model, so I just choose the second way.
everything seems fine:
image

@radeksimko radeksimko added the bug Something isn't working label Nov 25, 2020
Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

Good find and 👍 on the decision to use pointers here.

Thank you for the fix.

nil data is certainly a valid response and should be expected, in fact we should prefer that over the errors which are being returned for a number of edge cases, such as hovering over braces, but I haven't yet decided whether to just ignore them already in hcl-lang and never return such error in the first place or whether to filter out these errors and ignore them here.

@radeksimko radeksimko merged commit 4490f45 into hashicorp:main Nov 25, 2020
@ghost
Copy link

ghost commented Dec 25, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the context necessary to investigate further.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

terraform-ls is crashing on hover over variable inside locals block
2 participants