Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

When using gogetdoc, hovering over a local variable shows the current function name, instead of variable type information. #703

Closed
enitihas opened this issue Jan 2, 2017 · 5 comments
Labels

Comments

@enitihas
Copy link

enitihas commented Jan 2, 2017

I recently changed the option "go.docsTool" to gogetdoc. However, now when I hover over a local variable in any function, it shows me the function name instead of type information of the variable. However, hover works correctly for function arguments.
screenshot from 2017-01-02 09-27-01

@ramya-rao-a ramya-rao-a added the bug label Jan 2, 2017
@ramya-rao-a
Copy link
Contributor

@zmb3 The decl property in the json output from gogetdoc contains the function declaration instead of the variable declaration in such cases

@zmb3
Copy link
Contributor

zmb3 commented Jan 4, 2017

The current behavior is to ascend the AST until we get to a decl that has [may have] documentation. In this case, tests being a local variable doesn't, and so we keep moving up the AST until we see Test_checkError().

At the time, I thought this behavior made sense. Recall that gogetdoc was originally written for the sole purpose of extracting documentation, not necessarily to provide a tooltip.

I see how this can be confusing, especially now that the tool is being used to provide a tooltip for the item under the cursor. We should try to be as accurate as possible at describing what is under the cursor.

Please create an issue upstream and link it here, I'll be happy to take a look. Bonus points for a repro with actual/expected output :-)

@ramya-rao-a
Copy link
Contributor

Repro:
image

Expected Output:

image

@ramya-rao-a
Copy link
Contributor

This issue was moved to zmb3/gogetdoc#20

@ramya-rao-a
Copy link
Contributor

Thanks @zmb3

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants