Skip to content

Commit

Permalink
internal/lsp: treat struct tags as string type
Browse files Browse the repository at this point in the history
For golang/go#54066

Change-Id: Ia4f0bf0b4d76743a7f4fafc375859db7184753fb
Reviewed-on: https://go-review.googlesource.com/c/tools/+/419498
Reviewed-by: Peter Weinberger <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
gopls-CI: kokoro <[email protected]>
Run-TryBot: Hyang-Ah Hana Kim <[email protected]>
  • Loading branch information
hyangah committed Jul 26, 2022
1 parent 6c8a6c4 commit 8ccb25c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
5 changes: 0 additions & 5 deletions internal/lsp/semantic.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,6 @@ func (e *encoded) inspector(n ast.Node) bool {
what := tokNumber
if x.Kind == token.STRING {
what = tokString
if _, ok := e.stack[len(e.stack)-2].(*ast.Field); ok {
// struct tags (this is probably pointless, as the
// TextMate grammar will treat all the other comments the same)
what = tokComment
}
}
e.token(x.Pos(), ln, what, nil)
case *ast.BinaryExpr:
Expand Down
2 changes: 1 addition & 1 deletion internal/lsp/testdata/semantic/a.go.golden
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
)

/*⇒4,keyword,[]*/type /*⇒1,type,[definition]*/A /*⇒6,keyword,[]*/struct {
/*⇒1,variable,[definition]*/X /*⇒3,type,[defaultLibrary]*/int /*⇒6,comment,[]*/`foof`
/*⇒1,variable,[definition]*/X /*⇒3,type,[defaultLibrary]*/int /*⇒6,string,[]*/`foof`
}
/*⇒4,keyword,[]*/type /*⇒1,type,[definition]*/B /*⇒9,keyword,[]*/interface {
/*⇒1,type,[]*/A
Expand Down

0 comments on commit 8ccb25c

Please sign in to comment.