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

Add only_files argument for lsp_save_all command #2376

Merged
merged 1 commit into from
Dec 21, 2023

Conversation

jwortmann
Copy link
Member

Closes #2371 (?)

Using this argument, you can add a key binding (or menu entry or command palette entry) to save all files, without being bothered by save dialogs for new buffers.

Also did a small adjustment to the caption of the example key binding, to make it clear that lsp_save_all only saves views for which a language server is running.

Copy link
Member

@rchl rchl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good but I'm not sure about resolving #2371 (as you are also, I guess).

  1. It requires separate, manual shortcut press
  2. It saves all unsaved files rather than just the ones that were affected by rename.

That said, it might do well 99% of the time.

@jwortmann
Copy link
Member Author

jwortmann commented Dec 21, 2023

Right, I made this PR because you mentioned this as an alternative solution to the linked issue, and I thought it would be an easy implementation and a nice little improvement for the "Save all" behavior in general.

I don't really think that adding a new setting to automatically save after workspace edits would be justified. But just to throw in an idea for the case of automatically saving; then it should probably first check all the open files which already had unsaved modifications before, and exclude those files from saving.


A bit unrelated, but while looking through the implementations, I saw that the lsp_save command should maybe accept the arguments of the built in save command (async, encoding, quiet) and just pass them through when calling built-in save. Then async should be specified in the key binding arguments, instead of being hardcoded in the code. Similar to how the built-in key binding works (Windows example):

{ "keys": ["ctrl+s"], "command": "save", "args": { "async": true } },

@rchl rchl merged commit f3d0c4a into sublimelsp:main Dec 21, 2023
4 checks passed
@jwortmann jwortmann deleted the save-all-files branch December 21, 2023 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide a way to save all modified files after applying workspace edits
2 participants