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

For variables, the decl field contains the parent function instead of the variable name and type #20

Closed
ramya-rao-a opened this issue Jan 4, 2017 · 7 comments

Comments

@ramya-rao-a
Copy link

From @enitihas on January 2, 2017 3:59

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

Copied from original issue: microsoft/vscode-go#703

@ramya-rao-a
Copy link
Author

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

@ramya-rao-a
Copy link
Author

From @zmb3 on January 4, 2017 4:6

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
Author

Repro:
image

Expected Output:

image

@ramya-rao-a ramya-rao-a changed the title When using gogetdoc, hovering over a local variable shows the current function name, instead of variable type information. For variables, the decl field contains the parent function instead of the variable name and type Jan 4, 2017
@zmb3 zmb3 closed this as completed in 8e9f55c Jan 5, 2017
@zmb3
Copy link
Owner

zmb3 commented Jan 5, 2017

@ramya-rao-a please update and let me know if this works for you :-D

@ramya-rao-a
Copy link
Author

Thanks @zmb3. Variables are now good, but something happened to the types.

For example:

type ABC struct {
	a int
	b int
	c int
}

The decl field for ABC above is ABC struct {... instead of type ABC struct { ...

zmb3 added a commit that referenced this issue Jan 5, 2017
@zmb3
Copy link
Owner

zmb3 commented Jan 5, 2017

Thanks for catching that @ramya-rao-a, I should have had done it in a separate branch and had you try it out first.

Should be fixed now.

@ramya-rao-a
Copy link
Author

ramya-rao-a commented Jan 5, 2017

Thanks @zmb3 Looks good now!

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

No branches or pull requests

2 participants