Skip to content

Commit 92f0b68

Browse files
committed
introduce and use asStatusBarItemIdentifier
1 parent e32bf9a commit 92f0b68

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/vs/workbench/api/common/extHostStatusBar.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ import { MainContext, MainThreadStatusBarShape, IMainContext, ICommandDto } from
99
import { localize } from 'vs/nls';
1010
import { CommandsConverter } from 'vs/workbench/api/common/extHostCommands';
1111
import { DisposableStore } from 'vs/base/common/lifecycle';
12-
import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
12+
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
1313
import { MarkdownString } from 'vs/workbench/api/common/extHostTypeConverters';
1414
import { isNumber } from 'vs/base/common/types';
15+
import { asStatusBarItemIdentifier } from 'vs/workbench/api/common/statusBarExtensionPoint';
1516

1617
export class ExtHostStatusBarEntry implements vscode.StatusBarItem {
1718

@@ -60,7 +61,7 @@ export class ExtHostStatusBarEntry implements vscode.StatusBarItem {
6061
this.#commands = commands;
6162

6263
if (id && extension) {
63-
this._entryId = `${ExtensionIdentifier.toKey(extension.identifier)}.${id}`;
64+
this._entryId = asStatusBarItemIdentifier(extension.identifier, id);
6465
proxy.$hasEntry(this._entryId).then(exits => {
6566
if (exits && this._visible === undefined) {
6667
// mark new item as visible if it already exists

src/vs/workbench/api/common/statusBarExtensionPoint.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,12 @@ export class StatusBarItemsExtensionPoint {
205205
continue;
206206
}
207207

208-
const extensionId = ExtensionIdentifier.toKey(entry.description.identifier);
209-
const fullItemId = `${extensionId}.${candidate.id}`;
208+
const fullItemId = asStatusBarItemIdentifier(entry.description.identifier, candidate.id);
210209

211210
contributions.add(statusBarItemsService.setOrUpdateEntry(
212211
fullItemId,
213212
fullItemId,
214-
extensionId,
213+
ExtensionIdentifier.toKey(entry.description.identifier),
215214
candidate.name ?? entry.description.displayName ?? entry.description.name,
216215
candidate.text,
217216
undefined, undefined, undefined, undefined,
@@ -224,3 +223,8 @@ export class StatusBarItemsExtensionPoint {
224223
});
225224
}
226225
}
226+
227+
228+
export function asStatusBarItemIdentifier(extension: ExtensionIdentifier, id: string): string {
229+
return `${ExtensionIdentifier.toKey(extension)}.${id}`;
230+
}

0 commit comments

Comments
 (0)