Skip to content

Commit a1907d5

Browse files
committed
update:codelens for proj test classfile
1 parent 7f8a235 commit a1907d5

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

gopls/internal/lsp/source/code_lens_gox.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,14 @@ func goxTestCodeLens(pgf *ParsedGopFile, classType string) ([]protocol.CodeLens,
215215
if err != nil {
216216
return nil, err
217217
}
218+
if pgf.File.IsProj && classType == "main" { //goxls:proj gox test
219+
return []protocol.CodeLens{
220+
{Range: rng, Command: &protocol.Command{
221+
Title: "run test",
222+
Command: "gop.test",
223+
}},
224+
}, nil
225+
}
218226
args, err := command.MarshalArgs(
219227
map[string]string{
220228
"functionName": "Test_" + classType,
@@ -232,7 +240,6 @@ func goxTestCodeLens(pgf *ParsedGopFile, classType string) ([]protocol.CodeLens,
232240
Title: "run file tests",
233241
Command: "gop.test.cursor",
234242
Arguments: args,
235-
}},
236-
}
243+
}}}
237244
return codelens, nil
238245
}

0 commit comments

Comments
 (0)