Skip to content

Commit 2ed0e22

Browse files
fix(Sky): Strip codicon syntax from status bar text and isolate fallback bar
The bridge now removes VS Code codicon syntax (`$(name)`, `$(name~spin)`) from status bar text before rendering. Stock workbench substitutes these for codicon font glyphs; the bridge doesn't parse them, so raw `$(sync~spin)` + Unicode placeholder codepoints were rendering as garbled "weird emojis" in the fallback bar. Also changes status bar items to ALWAYS use the dedicated fallback bar - never inject into VS Code's native `.statusbar`. Mixing extension-routed items with native workbench DOM mixes two rendering systems and produced the "not the default status bar" appearance. Bridge items now live in a separate bar that workbench doesn't manage, so the two coexist without visual conflict. Applies StripCodicons to both create and update handlers.
1 parent 24df2ee commit 2ed0e22

1 file changed

Lines changed: 30 additions & 11 deletions

File tree

Source/Function/SkyBridge.ts

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,19 @@ function GetOrCreateChannel(Id: string, Name?: string): string[] {
151151
// Status bar DOM bridge
152152
// ============================================================================
153153

154+
/**
155+
* Strip VS Code codicon syntax (`$(name)`, `$(name~spin)`) from a status
156+
* bar text string. Stock workbench substitutes these for glyphs from the
157+
* codicon font; our bridge doesn't parse them, so without stripping the
158+
* literal `$(sync~spin)` + raw Unicode placeholder codepoints render as
159+
* "weird emojis" in the fallback bar. Empty result keeps the item slot
160+
* but no text - better than garbled output.
161+
*/
162+
function StripCodicons(Text: string): string {
163+
if (!Text) return Text;
164+
return Text.replace(/\$\([^)]+\)\s*/g, "").trim();
165+
}
166+
154167
function GetOrCreateStatusBarItem(Id: string): HTMLElement {
155168
const DomId = `cel-statusbar-${CSS.escape(Id)}`;
156169
let El = document.getElementById(DomId);
@@ -160,15 +173,15 @@ function GetOrCreateStatusBarItem(Id: string): HTMLElement {
160173
El.className = "cel-statusbar-item";
161174
El.style.cssText =
162175
"display:inline-flex;align-items:center;padding:0 6px;font-size:12px;cursor:default;white-space:nowrap;";
163-
// Append to VS Code's status bar if present, otherwise a fallback bar
164-
const VsStatusBar =
165-
document.querySelector(".statusbar") ??
166-
document.querySelector('[role="status"]');
167-
if (VsStatusBar) {
168-
VsStatusBar.appendChild(El);
169-
} else {
170-
EnsureFallbackStatusBar().appendChild(El);
171-
}
176+
// Always use the dedicated fallback bar - NEVER append to stock
177+
// VS Code's `.statusbar`. Stock workbench owns that DOM and the
178+
// `StatusbarService` renders its native items (language mode,
179+
// line/col, encoding, EOL) into it; injecting bridge-routed
180+
// extension items mixes two rendering systems and produces the
181+
// "not the default status bar" appearance. Bridge items live in
182+
// a separate fallback bar that workbench doesn't manage, so the
183+
// two coexist without conflict.
184+
EnsureFallbackStatusBar().appendChild(El);
172185
}
173186
return El;
174187
}
@@ -489,14 +502,20 @@ export async function InstallSkyBridge(): Promise<void> {
489502
});
490503

491504
// ---- Status Bar ----
505+
// Text passes through `StripCodicons` first so extension strings
506+
// like `$(sync~spin) Syncing...` render as `Syncing...` instead of
507+
// the raw dollar-paren + unmapped codicon-font glyph placeholders.
508+
// Items are appended to the separate fallback bar (never into stock
509+
// VS Code's `.statusbar`) so the native workbench status bar stays
510+
// untouched and renders its default items normally.
492511
await Register("sky://statusbar/create", ({ id, text }: any) => {
493512
const El = GetOrCreateStatusBarItem(id);
494-
El.textContent = text ?? "";
513+
El.textContent = StripCodicons(text ?? "");
495514
});
496515

497516
await Register("sky://statusbar/update", ({ id, text, visible }: any) => {
498517
const El = GetOrCreateStatusBarItem(id);
499-
if (text !== undefined) El.textContent = text;
518+
if (text !== undefined) El.textContent = StripCodicons(text);
500519
if (visible !== undefined)
501520
El.style.display = visible ? "inline-flex" : "none";
502521
});

0 commit comments

Comments
 (0)