Skip to content

Commit 8db95b7

Browse files
rogerykgopherbot
authored andcommitted
gopls/internal/golang: check the comment range before emiting semantic tokens
Change-Id: If300720c92bfb1ac63b395efc2419f1f1c8bed8f Reviewed-on: https://go-review.googlesource.com/c/tools/+/580595 Reviewed-by: Alan Donovan <[email protected]> Auto-Submit: Alan Donovan <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Robert Findley <[email protected]>
1 parent daf9460 commit 8db95b7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

gopls/internal/golang/semtok.go

+4
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ func (tv *tokenVisitor) visit() {
142142

143143
for _, cg := range f.Comments {
144144
for _, c := range cg.List {
145+
// Only look at the comment that overlap the range.
146+
if c.End() <= tv.start || c.Pos() >= tv.end {
147+
continue
148+
}
145149
tv.comment(c, importByName)
146150
}
147151
}

0 commit comments

Comments
 (0)