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

[go] inconsistent highlighting of imported package names #162

Open
takamori opened this issue Jun 8, 2018 · 1 comment
Open

[go] inconsistent highlighting of imported package names #162

takamori opened this issue Jun 8, 2018 · 1 comment

Comments

@takamori
Copy link
Contributor

takamori commented Jun 8, 2018

The following content will have inconsistent highlighting of "status". Ideally "status" would always be highlighted.

package foo

import (
	"testing"

	"something/status"

	resp "something/else"
)

func Test(t *testing.T) {
	r := &resp.Structure{
		Name: "exist",
	}

	tests := []struct {
		name      string
		errStatus status.Code
	}{{
		name:      "test",
		errStatus: status.OK,
	}, {
		name:      "exist",
		errStatus: status.InvalidArgument,
	}}
}

@marijnh
Copy link
Member

marijnh commented Jun 8, 2018

Though the Go grammar treats qualified identifiers differently from selectors, they look the same and I can't find how they should be disambiguated, so it seems reasonable to treat foo.bar in expression context as a variable name followed by a dot and a property name.

For types, there are only qualified names, so there the mode does treat the part before the dot as a package name—calling it a variable there would be nonsense.

If you have a suggestion on how to do this differently I'm interested, but as far as I understand Go treating every identifier followed by a dot as a package name would be wrong.

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