mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
internal/lsp: don't offer empty "Organize Imports" action
If there are no imports that need organizing, don't send the "Organize Imports" code action. Change-Id: Id01521edd1524fb3f7372fd787d6c90418740cf3 Reviewed-on: https://go-review.googlesource.com/c/tools/+/202825 Reviewed-by: Rebecca Stambler <rstambler@golang.org> Run-TryBot: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
parent
98e333b8b3
commit
c8fcd6ab79
@ -102,7 +102,7 @@ func (s *Server) codeAction(ctx context.Context, params *protocol.CodeActionPara
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if wanted[protocol.SourceOrganizeImports] {
|
if wanted[protocol.SourceOrganizeImports] && len(edits) > 0 {
|
||||||
codeActions = append(codeActions, protocol.CodeAction{
|
codeActions = append(codeActions, protocol.CodeAction{
|
||||||
Title: "Organize Imports",
|
Title: "Organize Imports",
|
||||||
Kind: protocol.SourceOrganizeImports,
|
Kind: protocol.SourceOrganizeImports,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user