diff --git a/internal/lsp/source/completion/completion.go b/internal/lsp/source/completion/completion.go index 9ebdc1c137..4689b76d00 100644 --- a/internal/lsp/source/completion/completion.go +++ b/internal/lsp/source/completion/completion.go @@ -1264,6 +1264,11 @@ func (c *completer) lexical(ctx context.Context) error { var ( builtinIota = types.Universe.Lookup("iota") builtinNil = types.Universe.Lookup("nil") + // comparable is an interface that exists on the dev.typeparams Go branch. + // Filter it out from completion results to stabilize tests. + // TODO(rFindley) update (or remove) our handling for comparable once the + // type parameter API has stabilized. + builtinComparable = types.Universe.Lookup("comparable") ) // Track seen variables to avoid showing completions for shadowed variables. @@ -1282,6 +1287,9 @@ func (c *completer) lexical(ctx context.Context) error { if declScope != scope { continue // Name was declared in some enclosing scope, or not at all. } + if obj == builtinComparable { + continue + } // If obj's type is invalid, find the AST node that defines the lexical block // containing the declaration of obj. Don't resolve types for packages.