-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow language extensions to provide status information #129037
Comments
API sketch enum LanguageStatusSeverity {
Information,
Warning,
Error
}
declare class LanguageStatus {
text: string;
detail: string | MarkdownString;
severity: LanguageStatusSeverity;
constructor(text: string);
}
interface LanguageStatusProvider {
provideLanguageStatus(): ProviderResult<LanguageStatus>;
}
declare namespace languages {
export function registerLanguageStatusProvider(selector: DocumentSelector, provider: LanguageStatusProvider): Disposable;
} |
fyi @mjbvz |
Good stuff. |
Looks promising. Here's the information we'd potentially like to show for JS/TS:
Additionally, it would be nice if we could customize the displayed information per-file instead of showing the same status for all files of given language. For JS/TS, this could be:
If multiple extensions can contribute to the language status, it may also make sense to move some ESLint information into the language status So my high level questions:
|
//CC @dbaeumer |
Extensions can always take advantage of the existing vscode API to add additional status bar entries, with command handler, icons, colors, menus etc. Keep it proposed for a while and I can adopt it in HTML, CSS and JSON to gain some UX experience |
I think we need more than just a message because we need to show some kind of anchor in the status bar. I initially tried to hijack the language item for that but it has the "Change Language" message and command. |
Yeah, it might simplify things and prevent repeated |
This is the updated (and implemented) proposal that uses the push model. I still looking for ways to eliminate the severity, e.g TypeScript being single-file only isn't an error nor warning but merely something "unexpected". Ideally, we find a way to express that, maybe a boolean like vscode/src/vs/vscode.proposed.d.ts Lines 3162 to 3179 in e30d70f
|
Just tested out the changes and like the push model For the UI, if there are multiple statuses would we want to render them in a list? Perhaps something like:
A few other ideas:
|
Yeah, 👍 for that - I believe the API will converge to be similar to the status bar API just with us controlling visibility, placement, and arity. The ASCII art reminds me of how we do notifications and how they are behind the bell. So, one well-known icon which discloses more information. This would give it a clean & uniform look but might be too much hiding. |
This is how it currently looks (UI and API)
enum LanguageStatusSeverity {
Information = 0,
Warning = 1,
Error = 2
}
interface LanguageStatusItem {
selector: DocumentSelector;
severity: LanguageStatusSeverity;
text: string;
detail: string; // tooltip!
command: Command | undefined;
dispose(): void;
}
namespace languages {
export function createLanguageStatusItem(selector: DocumentSelector): LanguageStatusItem;
} |
👋 Here are a couple of additional explorations as I learn more about what's needed here. I've tried a few different versions using the discussion above as input. Any and all feedback welcome! cc @misolori Option 1Adds icon before language name Option 2Splits status into its own button. Adds counter for potentially multiple messages—not sure if that's needed but thought I'd hint at it here. Option 3Similar to option 1. Adds status icon and counter after language name. |
…crosoft/vscode#129037 Commit: 691a5e4479d8f2ff7f977487d44217309b6e6933
To verify simply make sure that createLanguageStatusItem is in |
hi @jrieken, I'm trying to adopt this API in Java language support and it works well 👍. And I just find if we pin an item and we mark it busy, the spinning icon will appear in both language status item (the left one) and pinned item (the right one). IMO it's a little duplicated and it's better to show the busy icon only in the language status item (the left one) to help users focus on the item. Does it make sense? |
I agree. Can you please file a separate bug for that. Thanks |
Hey @CsCherrYY are you saying the left one isn't pinned? How did you get it to show up like that? Here it is unpinned for us (it only shows up under the And after manually pinning it: |
@andschwa The default in my case seems to be pinned. So in my screenshot, the default is only to show the left one, but no the right one. But if you choose to unpin this item, the right one appears. It works when we just change the severity, text, etc. , but if we mark it busy, duplicate busy icons appear. |
Here is a suggestion about the visibility, sorry for disturbing. 🙂 We find abnormal severity (error or warning) for unpinned status (which is the default behavior) is not easy to find, compared to the pinned item. Users will find the status easier for the pinned item than the unpinned item, since the background is different. Can we consider changing the background color of the pinned item as well? (or another way to help users find this status) |
Many language extensions add status bar entries for various information tidbits, like version, language server status, project etc. There is many inconsistencies for how this happens like alignment isn't always in sync with the language name or visibility isn't in sync with the active editor.
We should help extensions do a better job by adding a dedicated "language status" API, some kind of
LanguageStatusProvider
which we query whenever the editor changes. In its simplest form language status can be text, detail (supporting codicons and md), and severity.The text was updated successfully, but these errors were encountered: