diff --git a/internal/lsp/code_action.go b/internal/lsp/code_action.go index dadb9e8266..9afe69d4d0 100644 --- a/internal/lsp/code_action.go +++ b/internal/lsp/code_action.go @@ -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{ Title: "Organize Imports", Kind: protocol.SourceOrganizeImports,