diff --git a/internal/lsp/code_action.go b/internal/lsp/code_action.go index 9e2a2ecb53..64106369e7 100644 --- a/internal/lsp/code_action.go +++ b/internal/lsp/code_action.go @@ -123,7 +123,8 @@ func findImportErrors(diagnostics []protocol.Diagnostic) bool { return true } // "X imported but not used" is an unused import. - if strings.HasSuffix(diagnostic.Message, " imported but not used") { + // "X imported but not used as Y" is an unused import. + if strings.Contains(diagnostic.Message, " imported but not used") { return true } }