@lvce-editor/quick-pick-worker 4.17.0 → 4.17.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.
@@ -3008,8 +3008,30 @@ const getPicks$7 = async (_searchValue, _args, {
3008
3008
  return getUniqueLanguages(languages).map(toProtoVisibleItem$1);
3009
3009
  };
3010
3010
 
3011
+ const getUriKey = uri => {
3012
+ if (!uri.startsWith('/') && !uri.startsWith('file://')) {
3013
+ return uri;
3014
+ }
3015
+ try {
3016
+ const url = new URL(uri.startsWith('/') ? `file://${uri}` : uri);
3017
+ while (url.pathname.length > 1 && url.pathname.endsWith('/')) {
3018
+ url.pathname = url.pathname.slice(0, -1);
3019
+ }
3020
+ return url.href;
3021
+ } catch {
3022
+ return uri;
3023
+ }
3024
+ };
3011
3025
  const uniq = array => {
3012
- return [...new Set(array)];
3026
+ const seen = new Set();
3027
+ return array.filter(uri => {
3028
+ const key = getUriKey(uri);
3029
+ if (seen.has(key)) {
3030
+ return false;
3031
+ }
3032
+ seen.add(key);
3033
+ return true;
3034
+ });
3013
3035
  };
3014
3036
  const getRecentlyOpened = async () => {
3015
3037
  const recentlyOpened = await invoke$2(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
@@ -3018,7 +3040,12 @@ const getRecentlyOpened = async () => {
3018
3040
 
3019
3041
  const getPath = uri => {
3020
3042
  if (uri.startsWith('file://')) {
3021
- return uri.slice('file://'.length);
3043
+ const path = uri.slice('file://'.length);
3044
+ try {
3045
+ return decodeURIComponent(path);
3046
+ } catch {
3047
+ return path;
3048
+ }
3022
3049
  }
3023
3050
  return uri;
3024
3051
  };
@@ -3257,7 +3284,8 @@ const selectPick$4 = async pick => {
3257
3284
  };
3258
3285
 
3259
3286
  const openWorkspaceFolder = uri => {
3260
- return invoke$2(/* Workspace.setPath */'Workspace.setPath', /* path */uri);
3287
+ const command = uri.includes('://') ? 'Workspace.setUri' : 'Workspace.setPath';
3288
+ return invoke$2(command, uri);
3261
3289
  };
3262
3290
 
3263
3291
  // TODO selectPick should be independent of show/hide
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/quick-pick-worker",
3
- "version": "4.17.0",
3
+ "version": "4.17.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/lvce-editor/quick-pick-worker.git"