Skip to content

Commit 0f0346e

Browse files
committed
[gopls-release-branch.0.6] internal/lsp: remove module diagnostics from code actions
With -mod=readonly, all go.mod diagnostics are covered by go get quick fixes on import statements, so we don't need to run `go mod tidy` on save for Go files. The real issue with this bug is the call to WorkspacePackages, which type checks every package in the workspace. Fixes golang/go#45092 Change-Id: Ibb82a3e58ec345ebdb67c0cbef5e029dce2d5a30 Reviewed-on: https://go-review.googlesource.com/c/tools/+/303149 Trust: Rebecca Stambler <[email protected]> Run-TryBot: Rebecca Stambler <[email protected]> gopls-CI: kokoro <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Heschi Kreinick <[email protected]> (cherry picked from commit 2c4a886) Reviewed-on: https://go-review.googlesource.com/c/tools/+/303150
1 parent 05cb6f5 commit 0f0346e

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

internal/lsp/code_action.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -138,19 +138,6 @@ func (s *Server) codeAction(ctx context.Context, params *protocol.CodeActionPara
138138
return nil, err
139139
}
140140
fileDiags := append(pkgDiagnostics[uri], analysisDiags[uri]...)
141-
modURI := snapshot.GoModForFile(fh.URI())
142-
if modURI != "" {
143-
modFH, err := snapshot.GetVersionedFile(ctx, modURI)
144-
if err != nil {
145-
return nil, err
146-
}
147-
modDiags, err := mod.DiagnosticsForMod(ctx, snapshot, modFH)
148-
if err != nil && !source.IsNonFatalGoModError(err) {
149-
// Not a fatal error.
150-
event.Error(ctx, "module suggested fixes failed", err, tag.Directory.Of(snapshot.View().Folder()))
151-
}
152-
fileDiags = append(fileDiags, modDiags...)
153-
}
154141

155142
// Split diagnostics into fixes, which must match incoming diagnostics,
156143
// and non-fixes, which must match the requested range. Build actions

0 commit comments

Comments
 (0)