@lvce-editor/title-bar-worker 4.28.0 → 4.28.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2721,7 +2721,7 @@ const getMenuEntries$b = async (platform, autoSave$1, hasActiveTextEditor = fals
2721
2721
  label: openFile()
2722
2722
  }, {
2723
2723
  command: 'Dialog.openFolder',
2724
- flags: RestoreFocus,
2724
+ flags: None,
2725
2725
  id: 'openFolder',
2726
2726
  label: openFolder()
2727
2727
  }, {
@@ -4376,10 +4376,38 @@ const getRemoteSshWorkspace = workspaceUri => {
4376
4376
  return undefined;
4377
4377
  }
4378
4378
  };
4379
- const getWorkspaceTitle = (workspacePath, titleTemplate, appName) => {
4379
+ const getDevContainerWorkspace = workspaceUri => {
4380
+ // Workspace title-change events currently carry the resolved path, where
4381
+ // devcontainer paths end in a marker instead of retaining their URI scheme.
4382
+ if (workspaceUri.endsWith('!')) {
4383
+ return {
4384
+ path: workspaceUri
4385
+ };
4386
+ }
4387
+ try {
4388
+ const url = new URL(workspaceUri);
4389
+ if (url.protocol !== 'devcontainers:') {
4390
+ return undefined;
4391
+ }
4392
+ return {
4393
+ path: url.pathname
4394
+ };
4395
+ } catch {
4396
+ return undefined;
4397
+ }
4398
+ };
4399
+ const getWorkspaceTitle = (workspacePath, titleTemplate, appName, decodeFolderName = false) => {
4380
4400
  const endIndex = getEndIndex(workspacePath);
4381
4401
  const slashIndex = Math.max(workspacePath.lastIndexOf('/', endIndex - 1), workspacePath.lastIndexOf('\\', endIndex - 1));
4382
- const folderName = workspacePath.slice(slashIndex + 1, endIndex);
4402
+ const encodedFolderName = workspacePath.slice(slashIndex + 1, endIndex);
4403
+ let folderName = encodedFolderName;
4404
+ if (decodeFolderName) {
4405
+ try {
4406
+ folderName = decodeURIComponent(encodedFolderName);
4407
+ } catch {
4408
+ // Keep malformed URI segments visible rather than failing title rendering.
4409
+ }
4410
+ }
4383
4411
 
4384
4412
  // If titleTemplate is empty, return folderName directly
4385
4413
  if (!titleTemplate) {
@@ -4397,14 +4425,26 @@ const getTitle = (workspaceUri, titleTemplate, appName) => {
4397
4425
  return appName;
4398
4426
  }
4399
4427
  const remoteSshWorkspace = getRemoteSshWorkspace(workspaceUri);
4400
- const workspacePath = remoteSshWorkspace?.path ?? getPath(workspaceUri);
4401
- const title = getWorkspaceTitle(workspacePath, titleTemplate, appName);
4428
+ const devContainerWorkspace = getDevContainerWorkspace(workspaceUri);
4429
+ const workspacePath = remoteSshWorkspace?.path ?? devContainerWorkspace?.path ?? getPath(workspaceUri);
4430
+ const displayWorkspacePath = getDevContainerDisplayPath(devContainerWorkspace, workspacePath);
4431
+ const title = getWorkspaceTitle(displayWorkspacePath, titleTemplate, appName, Boolean(devContainerWorkspace));
4432
+ if (devContainerWorkspace) {
4433
+ const devContainerSuffix = '[devcontainer]';
4434
+ return title ? `${title} ${devContainerSuffix}` : devContainerSuffix;
4435
+ }
4402
4436
  if (!remoteSshWorkspace) {
4403
4437
  return title || appName;
4404
4438
  }
4405
4439
  const remoteSuffix = `[SSH: ${remoteSshWorkspace.host}]`;
4406
4440
  return title ? `${title} ${remoteSuffix}` : remoteSuffix;
4407
4441
  };
4442
+ const getDevContainerDisplayPath = (devContainerWorkspace, workspacePath) => {
4443
+ if (!devContainerWorkspace || !workspacePath.endsWith('!')) {
4444
+ return workspacePath;
4445
+ }
4446
+ return workspacePath.slice(0, -1);
4447
+ };
4408
4448
 
4409
4449
  const launchTextMeasurementWorker = async () => {
4410
4450
  const rpc = await create$5({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/title-bar-worker",
3
- "version": "4.28.0",
3
+ "version": "4.28.2",
4
4
  "description": "Title Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",