@lvce-editor/quick-pick-worker 4.23.1 → 4.23.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.
- package/dist/quickPickWorkerMain.js +11 -2
- package/package.json +1 -1
|
@@ -3441,7 +3441,7 @@ const getPath = uri => {
|
|
|
3441
3441
|
}
|
|
3442
3442
|
return uri;
|
|
3443
3443
|
};
|
|
3444
|
-
const toProtoVisibleItem = uri => {
|
|
3444
|
+
const toProtoVisibleItem = (uri, homeDir) => {
|
|
3445
3445
|
const path = getPath(uri);
|
|
3446
3446
|
const isRemoteSsh = uri.startsWith(remoteSshScheme);
|
|
3447
3447
|
const authority = isRemoteSsh ? getRemoteSshAuthority(uri) : '';
|
|
@@ -3455,6 +3455,9 @@ const toProtoVisibleItem = uri => {
|
|
|
3455
3455
|
let description = '';
|
|
3456
3456
|
if (path.startsWith('/')) {
|
|
3457
3457
|
description = pathDirName(path);
|
|
3458
|
+
if (homeDir && !isRemoteSsh && description.startsWith(homeDir) && (description.length === homeDir.length || description[homeDir.length] === '/')) {
|
|
3459
|
+
description = `~${description.slice(homeDir.length)}`;
|
|
3460
|
+
}
|
|
3458
3461
|
}
|
|
3459
3462
|
if (path === '/' && isRemoteSsh) {
|
|
3460
3463
|
description = '/';
|
|
@@ -3474,7 +3477,13 @@ const toProtoVisibleItem = uri => {
|
|
|
3474
3477
|
};
|
|
3475
3478
|
const getPicks$6 = async () => {
|
|
3476
3479
|
const recentlyOpened = await getRecentlyOpened();
|
|
3477
|
-
|
|
3480
|
+
let homeDir;
|
|
3481
|
+
try {
|
|
3482
|
+
homeDir = await invoke$3('Workspace.getHomeDir');
|
|
3483
|
+
} catch {
|
|
3484
|
+
// Ignore unavailable workspace RPCs and keep the full path.
|
|
3485
|
+
}
|
|
3486
|
+
const picks = recentlyOpened.map(uri => toProtoVisibleItem(uri, homeDir));
|
|
3478
3487
|
return picks;
|
|
3479
3488
|
};
|
|
3480
3489
|
|