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

x/tools/gopls: const tokenized as a string #42715

Closed
stamblerre opened this issue Nov 19, 2020 · 2 comments
Closed

x/tools/gopls: const tokenized as a string #42715

stamblerre opened this issue Nov 19, 2020 · 2 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@stamblerre
Copy link
Contributor

Screen Shot 2020-11-19 at 12 55 41 AM

In the above screenshot, the mod const is tokenized as a string, leading it to appear the same as a string in the given function.

To repro, add the following to any file in golang.org/x/tools/gopls/internal/regtest:

func TestUseOfInvalidMetadata(t *testing.T) {
	const mod = `
-- go.mod --
module mod.com

go 1.12
-- main.go --
package main

import "mod.com/a"

func _() {
	a.Hello()
}
-- a/a.go --
package a

func Hello() {}
`
	run(t, mod, func(t *testing.T, env *Env) {

	})
}

/cc @pjweinb

@stamblerre stamblerre added this to the gopls/unplanned milestone Nov 19, 2020
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Nov 19, 2020
@pjweinb pjweinb self-assigned this Nov 19, 2020
@pjweinb
Copy link

pjweinb commented Nov 19, 2020

And also the assignment of tokens to predeclared identifiers is inconsistent. (true, false, nil, iota)

@gopherbot
Copy link

Change https://golang.org/cl/272208 mentions this issue: internal/lsp: revise some semantic token details

@stamblerre stamblerre moved this from To Do to Done in gopls semantic tokens Nov 25, 2020
@golang golang locked and limited conversation to collaborators Nov 24, 2021
@rsc rsc unassigned pjweinb Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
No open projects
Development

No branches or pull requests

3 participants