Only show capabilities item when in single file mode

For #133731

No need to show this normally since project intellisense is the default
上级 f4758656
......@@ -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");
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册