mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-21 00:59:03 +01:00
Only show capabilities item when in single file mode
For #133731 No need to show this normally since project intellisense is the default
This commit is contained in:
@@ -13,28 +13,34 @@ const localize = nls.loadMessageBundle();
|
||||
|
||||
export class CapabilitiesStatus extends Disposable {
|
||||
|
||||
private readonly _statusItem: vscode.LanguageStatusItem;
|
||||
private _statusItem?: vscode.LanguageStatusItem;
|
||||
|
||||
constructor(
|
||||
private readonly _client: ITypeScriptServiceClient,
|
||||
) {
|
||||
super();
|
||||
|
||||
this._statusItem = this._register(vscode.languages.createLanguageStatusItem('typescript.capabilities', jsTsLanguageModes));
|
||||
|
||||
this._statusItem.name = localize('capabilitiesStatus.name', "IntelliSense Status");
|
||||
|
||||
this._register(this._client.onTsServerStarted(() => this.update()));
|
||||
this._register(this._client.onDidChangeCapabilities(() => this.update()));
|
||||
|
||||
this.update();
|
||||
}
|
||||
|
||||
public override dispose() {
|
||||
super.dispose();
|
||||
this._statusItem?.dispose();
|
||||
}
|
||||
|
||||
private update() {
|
||||
if (this._client.capabilities.has(ClientCapability.Semantic)) {
|
||||
this._statusItem.text = localize('capabilitiesStatus.detail.semantic', "Project wide IntelliSense enabled");
|
||||
this._statusItem?.dispose();
|
||||
} else {
|
||||
this._statusItem.text = localize('capabilitiesStatus.detail.syntaxOnly', "Single file IntelliSense");
|
||||
if (!this._statusItem) {
|
||||
this._statusItem = this._register(vscode.languages.createLanguageStatusItem('typescript.capabilities', jsTsLanguageModes));
|
||||
}
|
||||
|
||||
this._statusItem.name = localize('capabilitiesStatus.name', "IntelliSense Status");
|
||||
this._statusItem.text = localize('capabilitiesStatus.detail.syntaxOnly', "Using single file IntelliSense");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user