Skip to content

Format-on-save action doesn't re-save the buffer? #22

@savetheclocktower

Description

@savetheclocktower

I know this repo is somewhat dormant, but I wanted to check in as a first step:

Suppose you've got a language server that can reformat an entire document on save. This package listens for onDidSave, debounces the event, then asks a provider to format the buffer. The edits are applied, and then… the buffer is not saved to disk again. The applyTextEditsToBuffer function delegates to a library function that explicitly says “the changes will be applied to the buffer but not saved.”

Judging by the specs, I don't think this was intentional behavior. This spec seems to verify that, when a provider has no edits to suggest, there are no further calls to TextBuffer::save; I think the implication there is that a second save would happen if the provider did supply edits, but it's hard to say.

Meanwhile, this spec verifies that a provider is invoked when an editor is saved, and that the resulting text matches expectations, but it does not check if the buffer is dirty.

If this was merely an oversight, I can submit a PR. If it's intentional behavior, perhaps it could be governed by a config setting? And if this package is unmaintained, that's fine, but I figured I'd ask before forking.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions