feat: workspace-level sidebar shortcuts with shortcut badges and desktop tabs extraction

This commit is contained in:
Mohamed Boudra
2026-03-03 20:56:42 +07:00
parent 73eabd2eea
commit 74ac17f910
22 changed files with 1287 additions and 629 deletions
+40
View File
@@ -0,0 +1,40 @@
interface BuildAbsoluteExplorerPathInput {
workspaceRoot: string;
entryPath: string;
}
function isAbsolutePath(pathValue: string): boolean {
return (
pathValue.startsWith("/") ||
pathValue.startsWith("\\\\") ||
/^[A-Za-z]:[\\/]/.test(pathValue)
);
}
export function buildAbsoluteExplorerPath({
workspaceRoot,
entryPath,
}: BuildAbsoluteExplorerPathInput): string {
const normalizedWorkspaceRoot = workspaceRoot.trim().replace(/[\\/]+$/, "");
const normalizedEntryPath = entryPath.trim();
if (!normalizedWorkspaceRoot) {
return normalizedEntryPath;
}
if (!normalizedEntryPath || normalizedEntryPath === ".") {
return normalizedWorkspaceRoot;
}
if (isAbsolutePath(normalizedEntryPath)) {
return normalizedEntryPath;
}
const separator = normalizedWorkspaceRoot.includes("\\") ? "\\" : "/";
const segments = normalizedEntryPath.split(/[\\/]+/).filter(Boolean);
if (segments.length === 0) {
return normalizedWorkspaceRoot;
}
return `${normalizedWorkspaceRoot}${separator}${segments.join(separator)}`;
}