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

Show const/var value in hovers/completions in all cases #2146

Closed
segevfiner opened this issue Nov 25, 2018 · 3 comments
Closed

Show const/var value in hovers/completions in all cases #2146

segevfiner opened this issue Nov 25, 2018 · 3 comments
Labels

Comments

@segevfiner
Copy link
Contributor

It's quite useful to be able to see the value of a const/var in hovers/completions. Using the default configuration you only get that for consts and only on hover.

This depends on information that is returned from the tools themselves. So implementing this will likely require extending the tools with the required information.

Screenshot

image

Status (ATM)

Using the default godef/go doc and gocode:

Hover Completion
Const ✔️
Var

Sample Code

package main

import "fmt"

const foo = "foo"
const Bar = "bar"

var baz = "baz"
var Qux = "Qux"

func main() {
	fmt.Println(foo, Bar, baz, Qux)
}
@rubenzinho07
Copy link

rubenzinho07 commented Nov 25, 2018 via email

@ramya-rao-a
Copy link
Contributor

So implementing this will likely require extending the tools with the required information.

That is very much true.

I believe the reason it gets shown for constants is because the value is right there in the same line as the declaration which is what is returned by godef/godoc.

I guess the reason the same was not done for variables is because the value of the variables can change and the static tools have no way of guaranteeing its value. Thats my guess. I would suggest to log an issue for godef/godoc to confirm this.

For completions, I would suggest to log this feature request at https://github.com/mdempsky/gocode/issues and @stamblerre should be able to get back with her thoughts.

Closing this issue in this repo as there isnt much we can do here to support these cases.

@stamblerre
Copy link
Contributor

for gocode: this should be very easily doable for constants, but not for variables. Feel free to file an issue at the link @ramya-rao-a provided, or if you're interested in contributing, send out a PR.

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

4 participants