Skip to content

Add new behaviors and appearance around deleted files#1588

Draft
savetheclocktower wants to merge 14 commits into
masterfrom
deleted-file-behavior
Draft

Add new behaviors and appearance around deleted files#1588
savetheclocktower wants to merge 14 commits into
masterfrom
deleted-file-behavior

Conversation

@savetheclocktower

Copy link
Copy Markdown
Contributor

Here’s everything this PR does:

  • Bumps @pulsar-edit/text-buffer to 15.0.0.

    • This adds TextBuffer::isDeleted (returns true if the buffer is not backed by a file on disk, but used to be).
    • It also changes the behavior of isModified (which previously always returned true for buffers without a file on disk) to be more nuanced around files with “deleted” status:
      • If the file was not in a modified state when it was deleted, isModified will return false until and unless the user makes further buffer changes.
      • If the file was in a modified state when it was deleted, isModified will return true as it did before.
  • The above bump implicitly changes Pulsar’s behavior when the user tries to close a buffer with “deleted” status. Because isModified returns false when the buffer was not in a modified state at time of file deletion, such files will be able to be closed by the user without an “are you sure?” prompt. This matches VS Code’s behavior.

    • If the buffer was dirty at time of deletion, then the user has made changes that could be lost. We still show the “are you sure?” prompt in these scenarios, but with a more accurate message in the dialog.
    • These behavior changes are optional; they are governed by the new editor.promptWhenAbandoningDeletedFile setting. Because others have concerns about this change in behavior, this setting will (at least for now) default to true — which means this new behavior is opt-in.
  • Adds new behavior to the tabs package so that it can detect these new states (including the “conflicted” state introduced in Guard against a user saving while the text buffer is conflicted… #1478) and optionally add class names to tabs accordingly so that UI themes can style them.

    • This new behavior is governed by the new tabs.enableItemStatusColoring setting, which defaults to true.
  • Updates the built-in UI themes to style tabs appropriately for each theme when a tab is in the “deleted” state. This mimics how VS Code represents deleted files in the tab — in red, with a strike-through effect.

    • No equivalent styles have been introduced for the “conflicted” state — though that class name will be added to tabs if tabs.enableItemStatusColoring is true, so a community theme could style conflicted pane items however it wants.
  • Does some other refactors in pane.js, including some more precise API documentation.

  • Tests were written in text-buffer and are also written for the tabs package. I should write at least one more for the editor.promptWhenAbandoningDeletedFile setting, so I’ll keep this PR in draft until that happens.

@savetheclocktower savetheclocktower added this to the 1.133.0 milestone May 31, 2026
@savetheclocktower savetheclocktower linked an issue May 31, 2026 that may be closed by this pull request
@savetheclocktower

Copy link
Copy Markdown
Contributor Author

The find-and-replace failure is just flakiness, but the autosave failure is real. I opened pulsar-edit/text-buffer#15 to fix it. Once that lands, I'll put out text-buffer@15.0.1 and update this PR; once CI is green I'll take this out of draft.

@savetheclocktower

Copy link
Copy Markdown
Contributor Author

Nope, taking out of draft will wait at least a bit longer. Discovered another issue (pulsar-edit/text-buffer#16) and opened another PR (pulsar-edit/text-buffer#17).

Don't worry. If this isn't ready for prime time when we're ready to ship 1.133.0, it'll slip to 1.134.0.

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.

Bump text-buffer to v15

1 participant