Skip to content
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

Use WorkspaceEdits to apply changes instead of commands #2574

Closed
mjbvz opened this issue Mar 9, 2023 · 5 comments · Fixed by #2589
Closed

Use WorkspaceEdits to apply changes instead of commands #2574

mjbvz opened this issue Mar 9, 2023 · 5 comments · Fixed by #2589
Milestone

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Mar 9, 2023

👋 Hi, I work on VS Code's code action support

We're currently working to enable code actions inside of the source control commit message box: microsoft/vscode#176699. However I noticed that even after turning on this functionality in VS Code, the quick fixes generated by this extension do not work properly

The root cause seems to be that this extension uses commands to apply fixes. If you instead switch to use a WorkspaceEdit on your code actions (CodeAction.edit), you quick fixes should start working the source control input. Workspace edits also don't require an extra roundtrip to the server so they should be faster to apply too!

Let me know if you have any questions about this change. Keep an eye on microsoft/vscode#176699 to see when source control input quick fixes are enabled in VS Code

@Jason3S
Copy link
Collaborator

Jason3S commented Mar 10, 2023

@mjbvz,

Thank you. I didn't realize that could be the issue. I'll take a look at fixing it.

It currently uses the "rename" command to allow each language server to fix the spelling issue in a language safe way. Clearly the source code commit doesn't need that level of functionality.

I'll take a look at changing it to be based upon the scheme and file type.

Maybe I missed it, but is there a way to detect when an edit as been applied (with respect to a diagnostic)? I would like to improve suggestions by keeping track of which edit the user used.

@Jason3S Jason3S added this to the v2 - next milestone Mar 10, 2023
@mjbvz
Copy link
Contributor Author

mjbvz commented Mar 13, 2023

Thanks for the details! You'll have to use workspace edits for the source control input but can continue using rename elsewhere

When code actions are requested in the source control input box, you should see document.languageId === 'scminput'

As for tracking when edits are applied, you can still use a command for this. You just can't use rename to apply the edit since the source control input doesn't support it

Let me know if you run into any issues making this change. It won't actually work end-to-end until microsoft/vscode#176699 is merged but I'm hoping to get that in early this week

@Jason3S
Copy link
Collaborator

Jason3S commented Mar 14, 2023

@mjbvz,

The spell checker already has a setting: fixSpellingWithRenameProvider. In most case it is on by default, but there are some exceptions.

I'm guessing this should work:

.vscode/settings.json

    "[scminput]": {
        "cSpell.fixSpellingWithRenameProvider": false
    },

@Jason3S
Copy link
Collaborator

Jason3S commented Mar 14, 2023

@mjbvz,

If more needs to be done, please re-open or create a new issue.

@github-actions
Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants