-
Notifications
You must be signed in to change notification settings - Fork 35.6k
Description
Issue #38695 was resolved by adding a workbench.action.files.saveWithoutFormatting
command which saves the document associated with the active text editor while enabling the skipSaveParticipants
flag. Because this is a command, it's possible to invoke programmatically from an extension to save a document without formatting, as long as that document is currently associated with the active text editor. I currently use this in an extension I'm developing to save on every keystroke, which I plan to use for live programming purposes.
However, as far as I'm aware, there's no way to programmatically save any other document without formatting. This makes my "save constantly" extension much less relevant for my actual use case, in which a document is being edited without being associated with the active text editor, but I still want it to save on every change. Since I already have the TextDocument
object, I should really be saving it via the save
method, but that forces autoformat and thus is unusable if I have Files: Trim Trailing Whitespace enabled.
It'd be nice if the save
method allowed me to pass the skipSaveParticipants
option; see samestep/vscode-save-constantly#1 for an example of how I'd like to use that API if it existed.