Skip to content

Commit

Permalink
update:codelens for proj test classfile
Browse files Browse the repository at this point in the history
  • Loading branch information
luoliwoshang committed May 10, 2024
1 parent 7f8a235 commit a1907d5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions gopls/internal/lsp/source/code_lens_gox.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
}

0 comments on commit a1907d5

Please sign in to comment.