Skip to content

status-bar: Add v2 service API with config-driven tile management#1496

Open
asiloisad wants to merge 8 commits intopulsar-edit:masterfrom
asiloisad:status-bar-service-v2
Open

status-bar: Add v2 service API with config-driven tile management#1496
asiloisad wants to merge 8 commits intopulsar-edit:masterfrom
asiloisad:status-bar-service-v2

Conversation

@asiloisad
Copy link
Copy Markdown
Contributor

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 priorityConfig to addTile, 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/addRightTile continue to work unchanged, because v1 and v2 tiles coexist in the same status bar.

The Tile class gains setPriority(), isVisible(), and getPriority() methods along with optional priorityConfig support that observes an Atom config key and reactively calls setPriority() on changes. insertTileV2 in StatusBarView handles signed priority routing to the correct panel with consistent descending sort order. The v1 addLeftTile now negates priorities internally so both APIs share the same sorted arrays.

The package.json declares service version 2.0.0 pointing to provideStatusBarV2() which exposes only addTile and getTiles. Config schema entries for each built-in tile priority let users reorder, swap sides, or hide any tile.

CSS :empty and :has() selectors hide built-in status bar elements that have no content, preventing blank space from appearing when no editor is active. The deprecated url.parse call in file-info-view was replaced with new URL().pathname.

@asiloisad
Copy link
Copy Markdown
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.

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.

1 participant