Skip to content

Commit 4788084

Browse files
feat(Wind): Refactor profile config and add OS detection for workbench
Refactor the profile configuration in ResolveConfiguration to use a reusable DefaultProfile variable instead of duplicate inline objects. Add the os configuration object with release (parsed from navigator.userAgent), hostname, and arch (arm64/x86_64 detection) required by the VS Code workbench. Also improve IPCRendererShim to handle known no-op vscode: channels (createSharedProcessChannelConnection, toggleDevTools, reloadWindow, etc.) without logging warnings, and return undefined for truly unmapped channels instead of calling non-existent Tauri commands. Add a stub for utilityProcessWorker in TauriMainProcessService to prevent UtilityProcessWorkerWorkbenchService from hanging. These changes complete the workbench initialization requirements and reduce noise from expected IPC calls.
1 parent 5ad4d3c commit 4788084

5 files changed

Lines changed: 126 additions & 83 deletions

File tree

Source/Function/Install.ts

Lines changed: 43 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,38 @@ export async function ResolveConfiguration(): Promise<ISandboxConfiguration> {
167167
// clean path for any other code that reads it.
168168
const FileRoot = "/Static/Application/";
169169

170+
const DefaultProfile = {
171+
id: "__default__profile__",
172+
isDefault: true,
173+
name: "Default",
174+
location: undefined,
175+
globalStorageHome: {
176+
scheme: "vscode-userdata",
177+
path: "/User/globalStorage",
178+
},
179+
settingsResource: {
180+
scheme: "vscode-userdata",
181+
path: "/User/settings.json",
182+
},
183+
keybindingsResource: {
184+
scheme: "vscode-userdata",
185+
path: "/User/keybindings.json",
186+
},
187+
tasksResource: {
188+
scheme: "vscode-userdata",
189+
path: "/User/tasks.json",
190+
},
191+
snippetsHome: {
192+
scheme: "vscode-userdata",
193+
path: "/User/snippets",
194+
},
195+
extensionsResource: undefined,
196+
cacheHome: {
197+
scheme: "vscode-userdata",
198+
path: "/User/cacheHome",
199+
},
200+
};
201+
170202
return {
171203
windowId: 1,
172204
appRoot: FileRoot,
@@ -193,43 +225,22 @@ export async function ResolveConfiguration(): Promise<ISandboxConfiguration> {
193225
logLevel: 2,
194226
loggers: [],
195227
perfMarks: [],
228+
os: {
229+
release: typeof navigator !== "undefined"
230+
? (navigator.userAgent.match(/Mac OS X (\d+[._]\d+)/)?.[1]?.replace("_", ".") ?? "25.0")
231+
: "25.0",
232+
hostname: "localhost",
233+
arch: typeof navigator !== "undefined"
234+
? (navigator.userAgent.includes("arm64") || navigator.userAgent.includes("ARM64") ? "arm64" : "x86_64")
235+
: "arm64",
236+
},
196237
colorScheme: { dark: true, highContrast: false },
197238
autoDetectHighContrast: false,
198239
autoDetectColorScheme: false,
199240
profiles: {
200241
home: { scheme: "vscode-userdata", path: "/User" },
201-
all: [],
202-
profile: {
203-
id: "__default__profile__",
204-
isDefault: true,
205-
name: "Default",
206-
location: undefined,
207-
globalStorageHome: {
208-
scheme: "vscode-userdata",
209-
path: "/User/globalStorage",
210-
},
211-
settingsResource: {
212-
scheme: "vscode-userdata",
213-
path: "/User/settings.json",
214-
},
215-
keybindingsResource: {
216-
scheme: "vscode-userdata",
217-
path: "/User/keybindings.json",
218-
},
219-
tasksResource: {
220-
scheme: "vscode-userdata",
221-
path: "/User/tasks.json",
222-
},
223-
snippetsHome: {
224-
scheme: "vscode-userdata",
225-
path: "/User/snippets",
226-
},
227-
extensionsResource: undefined,
228-
cacheHome: {
229-
scheme: "vscode-userdata",
230-
path: "/User/cacheHome",
231-
},
232-
},
242+
all: [DefaultProfile],
243+
profile: DefaultProfile,
233244
},
234245
product: {
235246
nameShort: "VSCode Wind",

Source/Polyfills/IPCRendererShim.ts

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,21 @@ class IPCRendererImpl implements IpcRenderer {
623623
return;
624624
}
625625

626+
// Known no-op channels — log and drop (no Tauri command exists)
627+
if (
628+
channel === "vscode:createSharedProcessChannelConnection" ||
629+
channel === "vscode:toggleDevTools" ||
630+
channel === "vscode:reloadWindow" ||
631+
channel === "vscode:reportUnresponsive" ||
632+
channel === "vscode:openDevTools" ||
633+
channel.startsWith("vscode:")
634+
) {
635+
console.log(
636+
`[IPCRendererShim] send: ${channel} — no-op (not wired to Tauri)`,
637+
);
638+
return;
639+
}
640+
626641
// Map Electron channel to Tauri command
627642
const mapping = mapElectronChannelToTauri(channel);
628643

@@ -631,11 +646,11 @@ class IPCRendererImpl implements IpcRenderer {
631646
const tauriArgs = transformChannelArgs(channel, args);
632647
sendTauri(mapping.command, tauriArgs);
633648
} else {
634-
// Generic IPC send through Tauri
635-
sendTauri("ipc:send", {
636-
channel,
637-
args,
638-
});
649+
// Unmapped non-vscode channel — log warning instead of calling
650+
// non-existent ipc:send Tauri command
651+
console.warn(
652+
`[IPCRendererShim] send: unmapped channel "${channel}" — dropping (no Tauri route)`,
653+
);
639654
}
640655
}
641656

@@ -663,11 +678,12 @@ class IPCRendererImpl implements IpcRenderer {
663678
return await invokeTauri<T>(mapping.command, tauriArgs);
664679
}
665680

666-
// Generic IPC invoke through Tauri
667-
return await invokeTauri<T>("ipc:invoke", {
668-
channel,
669-
args,
670-
});
681+
// Unmapped channel — return undefined instead of calling
682+
// non-existent ipc:invoke Tauri command
683+
console.warn(
684+
`[IPCRendererShim] invoke: unmapped channel "${channel}" — returning undefined`,
685+
);
686+
return undefined as T;
671687
}
672688

673689
/**

Source/Service/TauriMainProcessService.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ const StubChannels: Record<string, Record<string, unknown>> = {
8484
},
8585
},
8686
sharedProcess: {},
87+
// UtilityProcessWorker — VS Code uses this for heavy operations
88+
// (search, file watching) via a utility process. Stub it so the
89+
// UtilityProcessWorkerWorkbenchService doesn't hang.
90+
utilityProcessWorker: {
91+
createWorker: undefined,
92+
},
8793
// Storage — returns empty items so NativeWorkbenchStorageService.initialize()
8894
// completes. getItems returns Item[] (array of [key, value] tuples).
8995
storage: {
@@ -92,7 +98,6 @@ const StubChannels: Record<string, Record<string, unknown>> = {
9298
optimize: undefined,
9399
isUsed: undefined,
94100
},
95-
d: {},
96101
};
97102

98103
// ============================================================================

Target/Function/Install.js

Lines changed: 38 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Target/Polyfills/IPCRendererShim.js

Lines changed: 13 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)