go/gopls/doc
Francesco Renzi 1a4e02fee4 internal/lsp/analysis/unusedvariable: add analyzer
This analyzer suggests fixes for unused variable errors.
In declarations it will remove the whole statement if the offending
variable is the only one declared in that statement, otherwise it will
just delete the offending variable.
In assignments it will remove the whole statement if the offending
variable is the only one assigned in that statement, otherwise it will
rename the offending variable to `_`. If the assignment RHS contains a
statement that can cause a side effect (a function call or reading from
a channel), the assignment will be removed but RHS will be preserved.

Fixes golang/go#48975

Change-Id: I3850f1b0340cd5ae63249931df3a5403d8617080
Reviewed-on: https://go-review.googlesource.com/c/tools/+/394934
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2022-07-15 14:27:36 +00:00
..
design gopls/doc: clean up and slightly reorganize documentation 2021-01-14 06:55:38 +00:00
advanced.md gopls/doc: update stale documentation on generics 2022-03-29 16:50:19 +00:00
analyzers.md internal/lsp/analysis/unusedvariable: add analyzer 2022-07-15 14:27:36 +00:00
command-line.md gopls/doc: remove bad gopls cli link 2021-10-20 20:41:51 +00:00
commands.md gopls/internal/vulncheck: copy logic of govulncheck -html 2022-05-12 21:17:31 +00:00
contributing.md gopls/doc: add instructions for the new "kokoro rerun" feature 2021-09-20 19:55:18 +00:00
daemon.md gopls/doc: clarify how to set remote.listen.timeout 2021-03-08 14:22:49 +00:00
emacs.md Update emacs.md - add .dir-locals.el example 2021-03-19 04:40:15 +00:00
features.md gopls: change the default value for templateExtensions to be empty 2022-01-13 20:56:24 +00:00
generate.go internal/lsp: add settings for inlay hints and enable 2022-06-22 17:08:41 +00:00
generate_test.go gopls/doc: use improved code generator for API doc 2021-12-16 11:15:33 +00:00
inlayHints.md internal/lsp: use camel case for inlay hint config fields 2022-06-24 17:24:36 +00:00
semantictokens.md internal/lsp: produce "method" in place of "member" as per the spec 2021-09-13 21:01:54 +00:00
settings.md internal/lsp: add settings for inlay hints and enable 2022-06-22 17:08:41 +00:00
subl.md gopls/doc: how to request a particular gopls w/ sublime text 2022-02-04 21:02:33 +00:00
troubleshooting.md gopls: merge README and user.md 2021-01-21 18:28:06 +00:00
vim.md gopls/doc: update neovim examples for nvim 0.7 2022-04-12 22:37:10 +00:00
workspace.md gopls/doc: address additional comments on workspace.md 2022-03-02 17:29:27 +00:00