Debian Codegraph @

gopls/internal/cmd/usage/codelens.hlp

raw
1 List or execute code lenses for a file
2
3 Usage:
4 gopls [flags] codelens [codelens-flags] file[:line[:col]] [title]
5
6 The codelens command lists or executes code lenses for the specified
7 file, or line within a file. A code lens is a command associated with
8 a position in the code.
9
10 With an optional title argument, only code lenses matching that
11 title are considered.
12
13 By default, the codelens command lists the available lenses for the
14 specified file or line within a file, including the title and
15 title of the command. With the -exec flag, the first matching command
16 is executed, and its output is printed to stdout.
17
18 Example:
19
20 $ gopls codelens a_test.go # list code lenses in a file
21 $ gopls codelens a_test.go:10 # list code lenses on line 10
22 $ gopls codelens a_test.go "run test" # list gopls.run_tests commands
23 $ gopls codelens -exec a_test.go:10 "run test" # run a specific test
24
25 codelens-flags:
26 -d,-diff
27 display diffs instead of edited file content
28 -exec
29 execute the first matching code lens
30 -l,-list
31 display names of edited files
32 -preserve
33 with -write, make copies of original files
34 -w,-write
35 write edited content to source files