status-bar: Add v2 service API with config-driven tile management#1496
Open
asiloisad wants to merge 8 commits intopulsar-edit:masterfrom
Open
status-bar: Add v2 service API with config-driven tile management#1496asiloisad wants to merge 8 commits intopulsar-edit:masterfrom
asiloisad wants to merge 8 commits intopulsar-edit:masterfrom
Conversation
…mar-selector tile lookup
Contributor
Author
|
I'd appreciate your feedback on whether the adopted design would be an improvement. I've authored numerous packages, and a few additional methods would significantly simplify managing status-bar-items. Tests should now be fine. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tl;dr: Use single config to manage visibility & position of status-bar-item in status-bar.
The new v2 status-bar service API allows packages to manage their tiles entirely through a single config key. By passing
priorityConfigtoaddTile, tiles automatically reposition or hide themselves when the user changes the config value. The priority sign determines which side of the status bar the tile appears on (negative = left, positive = right), and setting priority to 0 hides the tile without destroying it.All built-in tiles (file info, cursor position, selection count, git info, launch mode) now use this mechanism, giving users full control over tile placement and visibility from the settings panel.
The v1 API remains fully intact. Existing community packages using
addLeftTile/addRightTilecontinue to work unchanged, because v1 and v2 tiles coexist in the same status bar.The Tile class gains
setPriority(),isVisible(), andgetPriority()methods along with optionalpriorityConfigsupport that observes an Atom config key and reactively callssetPriority()on changes.insertTileV2in StatusBarView handles signed priority routing to the correct panel with consistent descending sort order. The v1addLeftTilenow negates priorities internally so both APIs share the same sorted arrays.The package.json declares service version
2.0.0pointing toprovideStatusBarV2()which exposes onlyaddTileandgetTiles. Config schema entries for each built-in tile priority let users reorder, swap sides, or hide any tile.CSS
:emptyand:has()selectors hide built-in status bar elements that have no content, preventing blank space from appearing when no editor is active. The deprecatedurl.parsecall in file-info-view was replaced withnew URL().pathname.