diff --git a/gopls/internal/lsp/source/code_lens_gox.go b/gopls/internal/lsp/source/code_lens_gox.go index ba42a12ae1b..e9df85a61b4 100644 --- a/gopls/internal/lsp/source/code_lens_gox.go +++ b/gopls/internal/lsp/source/code_lens_gox.go @@ -215,6 +215,14 @@ func goxTestCodeLens(pgf *ParsedGopFile, classType string) ([]protocol.CodeLens, if err != nil { return nil, err } + if pgf.File.IsProj && classType == "main" { //goxls:proj gox test + return []protocol.CodeLens{ + {Range: rng, Command: &protocol.Command{ + Title: "run test", + Command: "gop.test", + }}, + }, nil + } args, err := command.MarshalArgs( map[string]string{ "functionName": "Test_" + classType, @@ -232,7 +240,6 @@ func goxTestCodeLens(pgf *ParsedGopFile, classType string) ([]protocol.CodeLens, Title: "run file tests", Command: "gop.test.cursor", Arguments: args, - }}, - } + }}} return codelens, nil }