-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/gopls: gopls.add_dependency workspace edits not working? #44247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Sending workspace edits for a closed file causes VSCode to open it and leave the edits unsaved, which is undesirable, particularly for go.sum. To avoid that, gopls still directly edits closed files. You should see workspace edits if you open go.mod first. |
I did try out Pauls example (using the defaults;
Then I get a couple of other
Is there something I'm missing out? (full log at https://gist.github.com/leitzler/d189c42bdb0dae8562682b47325938e2). |
Just to add to the above, I expected that applying the suggested fix would have the ~same effect as running If I do run |
@leitzler: I don't see how your problem is related to workspace edits, but it is a real (and rather embarrassing) mistake on my part, so I'll file a new bug. Thanks for the report. |
Thank you and apologies for the issue hijacking. Didn't see that it was unrelated. |
That issue was #44307, and it is now resolved. Can we close this? |
Yes, this can be closed. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
This is a follow up to #44035. Thanks very much @heschik for addressing that issue in golang/tools@706a59c.
I've just tried this out, but I'm still not seeing workspace edits for
go.mod
. Given your change had test coverage, I suspect this is a configuration issue of some sort but I can't see what that might be.I started with the same setup as before:
i.e. the requirement on
golang.org/x/tools/imports
is missing fromgo.{mod,sum}
.Loading
main.go
in Vim (usinggovim
) gives error diagnostics as expected:If we ask for suggested fixes at
main.go:6
we get a code action response with thegopls.add_dependency
command.If we execute the
gopls.add_dependency
command,go.{mod,sum}
change beneath the editor andgopls
, i.e. we don't see any workspace edits, despite the changes in golang/tools@706a59c.Log files:
Is there something we (
govim
) are not doing right here?As a side note, I suspect the
tempModfile
option is no longer valid given that we haveallowModfileModifications
? Because I initially hadtempModfile: true
and this resulted in the error message:But I can raise this as a separate issue if needs be.
What did you expect to see?
gopls.add_dependency
resulting in workspace edits forgo.{mod,sum}
.What did you see instead?
The files changing beneath the editor, and that change getting detected by the
govim
file watchercc @stamblerre @heschik
FYI @leitzler
The text was updated successfully, but these errors were encountered: