@lvce-editor/quick-pick-worker 4.28.1 → 4.29.0
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 +40 -4
- package/package.json +1 -1
|
@@ -2834,7 +2834,7 @@ const getPicks$e = async (value, args, {
|
|
|
2834
2834
|
const extensionPicks = await getExtensionPicks(assetDir, platform, applicationId);
|
|
2835
2835
|
const allPicks = [...builtinPicks, ...extensionPicks];
|
|
2836
2836
|
const converted = allPicks.map(toProtoVisibleItem$3);
|
|
2837
|
-
return converted;
|
|
2837
|
+
return value === '>' ? converted.toSorted((a, b) => a.label.localeCompare(b.label)) : converted;
|
|
2838
2838
|
};
|
|
2839
2839
|
|
|
2840
2840
|
const state$3 = {
|
|
@@ -3015,6 +3015,41 @@ const trimTrailingSeparators = path => {
|
|
|
3015
3015
|
}
|
|
3016
3016
|
return result;
|
|
3017
3017
|
};
|
|
3018
|
+
const normalizePath = path => path.replaceAll('\\', '/');
|
|
3019
|
+
const getWorkspaceDisplayPath = workspace => {
|
|
3020
|
+
if (!hasUriScheme(workspace)) {
|
|
3021
|
+
return {
|
|
3022
|
+
path: normalizePath(workspace)
|
|
3023
|
+
};
|
|
3024
|
+
}
|
|
3025
|
+
const url = new URL(workspace);
|
|
3026
|
+
return {
|
|
3027
|
+
host: url.host,
|
|
3028
|
+
path: decodeURIComponent(url.pathname),
|
|
3029
|
+
scheme: url.protocol
|
|
3030
|
+
};
|
|
3031
|
+
};
|
|
3032
|
+
const getRelativeDirectory = (workspace, uri, dirName) => {
|
|
3033
|
+
const workspacePath = getWorkspaceDisplayPath(workspace);
|
|
3034
|
+
if (hasUriScheme(uri)) {
|
|
3035
|
+
const url = new URL(uri);
|
|
3036
|
+
if (workspacePath.scheme !== url.protocol || workspacePath.host !== url.host) {
|
|
3037
|
+
return dirName;
|
|
3038
|
+
}
|
|
3039
|
+
} else if (workspacePath.scheme) {
|
|
3040
|
+
return dirName;
|
|
3041
|
+
}
|
|
3042
|
+
const normalizedWorkspace = trimTrailingSeparators(workspacePath.path);
|
|
3043
|
+
const normalizedDirectory = normalizePath(dirName);
|
|
3044
|
+
const prefix = normalizedWorkspace.endsWith('/') ? normalizedWorkspace : `${normalizedWorkspace}/`;
|
|
3045
|
+
if (normalizedDirectory === normalizedWorkspace) {
|
|
3046
|
+
return '';
|
|
3047
|
+
}
|
|
3048
|
+
if (!normalizedDirectory.startsWith(prefix)) {
|
|
3049
|
+
return dirName;
|
|
3050
|
+
}
|
|
3051
|
+
return normalizedDirectory.slice(prefix.length);
|
|
3052
|
+
};
|
|
3018
3053
|
const resolveFileUri = (workspace, path) => {
|
|
3019
3054
|
if (hasUriScheme(path)) {
|
|
3020
3055
|
return path;
|
|
@@ -3031,12 +3066,13 @@ const resolveFileUri = (workspace, path) => {
|
|
|
3031
3066
|
}
|
|
3032
3067
|
return `${trimTrailingSeparators(workspace)}/${path}`;
|
|
3033
3068
|
};
|
|
3034
|
-
const convertToPick = uri => {
|
|
3069
|
+
const convertToPick = (workspace, uri) => {
|
|
3035
3070
|
const displayPath = hasUriScheme(uri) ? decodeURIComponent(new URL(uri).pathname) : uri.replaceAll('\\', '/');
|
|
3036
3071
|
const baseName = pathBaseName(displayPath);
|
|
3037
3072
|
const dirName = pathDirName(displayPath);
|
|
3073
|
+
const description = getRelativeDirectory(workspace, uri, dirName);
|
|
3038
3074
|
return {
|
|
3039
|
-
description
|
|
3075
|
+
description,
|
|
3040
3076
|
direntType: File,
|
|
3041
3077
|
fileIcon: '',
|
|
3042
3078
|
icon: '',
|
|
@@ -3078,7 +3114,7 @@ const getPicks$b = async searchValue => {
|
|
|
3078
3114
|
});
|
|
3079
3115
|
}
|
|
3080
3116
|
}
|
|
3081
|
-
const picks = files.map(path => convertToPick(resolveFileUri(workspace, path)));
|
|
3117
|
+
const picks = files.map(path => convertToPick(workspace, resolveFileUri(workspace, path)));
|
|
3082
3118
|
return picks;
|
|
3083
3119
|
};
|
|
3084
3120
|
|