Skip to content

Allow to show status bar entries with an id and name #74972

Closed

Description

This would allow us to hide/show individual entries from an extension to the status bar as opposed to hiding them all.

PS: this concept may be useful also for notifications to allow fine grained filtering.

Activity

  1. added
    feature-request
    on Jun 6, 2019
  2. bpasero commented on Jun 6, 2019

    @bpasero
    ContributorAuthor

    Current idea:

    /**
     * Options to configure the status bar item.
     */
    export interface StatusBarItemOptions {
    
    	/**
    	 * A unique identifier of the status bar item.
    	 */
    	id: string;
    
    	/**
    	 * A human readable name of the status bar item.
    	 */
    	name: string;
    
    	/**
    	 * The alignment of the status bar item.
    	 */
    	alignment?: StatusBarAlignment;
    
    	/**
    	 * The priority of the status bar item. Higher value means the item should
    	 * be shown more to the left.
    	 */
    	priority?: number;
    }
    
    /**
     * Creates a status bar [item](#StatusBarItem).
     *
     * @param options The options of the item.
     * @return A new status bar item.
     */
    export function createStatusBarItem(options?: StatusBarItemOptions): StatusBarItem;
  3. Tyriar commented on Jun 6, 2019

    @Tyriar
    Contributor

    Benjamin Pasero (@bpasero) what's the fallback name/id when options isn't specified?

  4. bpasero commented on Jun 6, 2019

    @bpasero
    ContributorAuthor

    Daniel Imms (@Tyriar) it will be the extension identifier and the extension name. See 3d91fa8

  5. jrieken commented on Jun 7, 2019

    @jrieken
    Contributor

    We could also consider grouping id/name into a separate object and explain its purpose and (maybe) reuse that object elsewhere (notification & don't show again)?

  6. bpasero commented on Jun 7, 2019

    @bpasero
    ContributorAuthor

    Johannes Rieken (@jrieken) yeah, I am not sure I can come up with a good name though unless we make this very specific to what it is used (filtering). To be honest, we already talk about identifiers in certain places, e.g. viewId in createTreeView, so it seems statusEntryId and notificationId are not too far off. Problem is that it needs a label too..

  7. bpasero commented on Jun 14, 2019

    @bpasero
    ContributorAuthor

    Pushed as proposed API but we should only have the discussion about finalizing the API when we looked at notifications too where we have an interest to hide based on id.

  8. removed this from the On Deck milestone on Jul 4, 2019
  9. 4 remaining items

  10. jrieken commented on May 18, 2021

    @jrieken
    Contributor
    export function createStatusBarItem(id: string, alignment?: StatusBarAlignment, priority?: number): StatusBarItem;
    
    export interface StatubarItem {
      readonly id: string;
    
      description?: string;
    }
  11. added
    unreleased
    on May 19, 2021
  12. bpasero commented on May 19, 2021

    @bpasero
    ContributorAuthor

    Slight update to the proposal: I went with name and not description because I feel description is being used in many places to indicate further verbose text for an item (e.g. in custom trees). I think the risk is that extensions would fill in lots of text for a description property.

    With name, it becomes more obvious that we want a short value. We also use name internally in the workbench.

    export interface StatusBarItem {
    
    	/**
    	 * The identifier of this item.
    	 *
    	 * *Note*: if no identifier was provided by the {@link window.createStatusBarItem `window.createStatusBarItem`}
    	 * method, the identifier will match the {@link Extension.id extension identifier}.
    	 */
    	readonly id: string;
    
    	/**
    	 * The (short) name of the entry, like 'Language Indicator', 'Git Status' etc.
    	 */
    	name: string | undefined;
    }
    
    /**
     * Creates a status bar {@link StatusBarItem item}.
     *
     * @param id The unique identifier of the item.
     * @param alignment The alignment of the item.
     * @param priority The priority of the item. Higher values mean the item should be shown more to the left.
     * @return A new status bar item.
     */
    export function createStatusBarItem(id: string, alignment?: StatusBarAlignment, priority?: number): StatusBarItem;
  13. DanTup commented on May 19, 2021

    @DanTup
    Contributor

    How will this be rendered in the menu? Will it be prefixed with the extensions name or should the name be descriptive enough to make it clear which extension it's for? (For example if I'm showing the Dart SDK Version in the status bar, should I use "SDK Version" and assume it'll render like "Dart: SDK Version" or should I set it to "Dart SDK Version"?)

  14. bpasero commented on May 19, 2021

    @bpasero
    ContributorAuthor

    Danny Tuppeny (@DanTup) that is a good point, currently it will not be prefixed. I feel this is something we can always add later when we think it is needed.

    To be honest, we do not prefix in other locations so I think we should not just do it without good reasons. E.g. here an extension provides the "GitHub" view and it is not treated any different from other views:

    image

  15. DanTup commented on May 19, 2021

    @DanTup
    Contributor

    Benjamin Pasero (@bpasero) sounds good to me. It may be worth noting that in the doc to encourage people to make the names descriptive enough.

    It does raise a question about what if there are dupes from different extensions, although it seems like even if they had the same labels here it'd be fairly easy to know which is which by just toggling.

  16. bpasero commented on May 19, 2021

    @bpasero
    ContributorAuthor

    Yeah good point, updated the JSDoc to:

    /**
     * The name of the entry, like 'Python Language Indicator', 'Git Status' etc.
     * Try to keep the length of the name short, yet descriptive enough that
     * users can understand what the status bar item is about.
     */
    name: string | undefined;
  17. added
    insiders-released
    and removed
    unreleased
    on May 19, 2021
  18. locked and limited conversation to collaborators on Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

apiapi-finalizationfeature-requestinsiders-releasedon-testplanworkbench-status

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions