@lvce-editor/file-search-worker 5.7.0 → 5.8.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/fileSearchWorkerMain.js +143 -60
- package/package.json +1 -1
|
@@ -786,7 +786,7 @@ const register$1 = commandMap => {
|
|
|
786
786
|
const getCommand = key => {
|
|
787
787
|
return commands[key];
|
|
788
788
|
};
|
|
789
|
-
const execute = (command, ...args) => {
|
|
789
|
+
const execute$1 = (command, ...args) => {
|
|
790
790
|
const fn = getCommand(command);
|
|
791
791
|
if (!fn) {
|
|
792
792
|
throw new Error(`command not found ${command}`);
|
|
@@ -827,7 +827,7 @@ const logError = () => {
|
|
|
827
827
|
};
|
|
828
828
|
const handleMessage = event => {
|
|
829
829
|
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
830
|
-
const actualExecute = event?.target?.execute || execute;
|
|
830
|
+
const actualExecute = event?.target?.execute || execute$1;
|
|
831
831
|
return handleJsonRpcMessage(event.target, event.data, actualExecute, resolve, preparePrettyError, logError, actualRequiresSocket);
|
|
832
832
|
};
|
|
833
833
|
const handleIpc = ipc => {
|
|
@@ -1114,9 +1114,6 @@ const getIconsCached = (paths, fileIconCache) => {
|
|
|
1114
1114
|
return paths.map(path => fileIconCache[path]);
|
|
1115
1115
|
};
|
|
1116
1116
|
|
|
1117
|
-
const Directory = 3;
|
|
1118
|
-
const File$1 = 7;
|
|
1119
|
-
|
|
1120
1117
|
const getMissingIconRequests = (dirents, fileIconCache) => {
|
|
1121
1118
|
const missingRequests = [];
|
|
1122
1119
|
for (const dirent of dirents) {
|
|
@@ -1125,7 +1122,7 @@ const getMissingIconRequests = (dirents, fileIconCache) => {
|
|
|
1125
1122
|
}
|
|
1126
1123
|
if (!(dirent.path in fileIconCache)) {
|
|
1127
1124
|
missingRequests.push({
|
|
1128
|
-
type:
|
|
1125
|
+
type: dirent.type,
|
|
1129
1126
|
name: dirent.name,
|
|
1130
1127
|
path: dirent.path
|
|
1131
1128
|
});
|
|
@@ -1134,17 +1131,22 @@ const getMissingIconRequests = (dirents, fileIconCache) => {
|
|
|
1134
1131
|
return missingRequests;
|
|
1135
1132
|
};
|
|
1136
1133
|
|
|
1137
|
-
const
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1134
|
+
const None$2 = 0;
|
|
1135
|
+
const Directory = 3;
|
|
1136
|
+
const File$1 = 7;
|
|
1137
|
+
|
|
1138
|
+
const requestFileIcon = async request => {
|
|
1139
|
+
if (!request.name) {
|
|
1140
|
+
return '';
|
|
1141
|
+
}
|
|
1142
|
+
return request.type === File$1 ? invoke$1('IconTheme.getFileIcon', {
|
|
1143
|
+
name: request.name
|
|
1144
|
+
}) : invoke$1('IconTheme.getFolderIcon', {
|
|
1145
|
+
name: request.name
|
|
1147
1146
|
});
|
|
1147
|
+
};
|
|
1148
|
+
const requestFileIcons = async requests => {
|
|
1149
|
+
const promises = requests.map(requestFileIcon);
|
|
1148
1150
|
return Promise.all(promises);
|
|
1149
1151
|
};
|
|
1150
1152
|
|
|
@@ -1163,19 +1165,23 @@ const updateIconCache = (iconCache, missingRequests, newIcons) => {
|
|
|
1163
1165
|
return newFileIconCache;
|
|
1164
1166
|
};
|
|
1165
1167
|
|
|
1168
|
+
const getPath = dirent => {
|
|
1169
|
+
return dirent.path;
|
|
1170
|
+
};
|
|
1171
|
+
const toDirent = pick => {
|
|
1172
|
+
const dirent = {
|
|
1173
|
+
type: pick.direntType,
|
|
1174
|
+
name: pick.label,
|
|
1175
|
+
path: pick.uri
|
|
1176
|
+
};
|
|
1177
|
+
return dirent;
|
|
1178
|
+
};
|
|
1166
1179
|
const getQuickPickFileIcons = async (items, fileIconCache) => {
|
|
1167
|
-
const dirents = items.map(
|
|
1168
|
-
const dirent = {
|
|
1169
|
-
type: item.direntType,
|
|
1170
|
-
name: item.label,
|
|
1171
|
-
path: item.uri
|
|
1172
|
-
};
|
|
1173
|
-
return dirent;
|
|
1174
|
-
});
|
|
1180
|
+
const dirents = items.map(toDirent);
|
|
1175
1181
|
const missingRequests = getMissingIconRequests(dirents, fileIconCache);
|
|
1176
1182
|
const newIcons = await requestFileIcons(missingRequests);
|
|
1177
1183
|
const newFileIconCache = updateIconCache(fileIconCache, missingRequests, newIcons);
|
|
1178
|
-
const paths = dirents.map(
|
|
1184
|
+
const paths = dirents.map(getPath);
|
|
1179
1185
|
const icons = getIconsCached(paths, newFileIconCache);
|
|
1180
1186
|
return {
|
|
1181
1187
|
icons,
|
|
@@ -1703,9 +1709,6 @@ const getFilterValue = (id, value) => {
|
|
|
1703
1709
|
return filterValue;
|
|
1704
1710
|
};
|
|
1705
1711
|
|
|
1706
|
-
/**
|
|
1707
|
-
* @deprecated
|
|
1708
|
-
*/
|
|
1709
1712
|
const select = Object.create(null);
|
|
1710
1713
|
const getPick$1 = Object.create(null);
|
|
1711
1714
|
const registerSelect = modules => {
|
|
@@ -1714,7 +1717,7 @@ const registerSelect = modules => {
|
|
|
1714
1717
|
const registerGetPick = modules => {
|
|
1715
1718
|
Object.assign(getPick$1, modules);
|
|
1716
1719
|
};
|
|
1717
|
-
const getPicks$
|
|
1720
|
+
const getPicks$c = id => {
|
|
1718
1721
|
const fn = getPick$1[id];
|
|
1719
1722
|
return fn;
|
|
1720
1723
|
};
|
|
@@ -1723,8 +1726,8 @@ const getSelect = id => {
|
|
|
1723
1726
|
return fn;
|
|
1724
1727
|
};
|
|
1725
1728
|
|
|
1726
|
-
const getPicks$
|
|
1727
|
-
const fn = getPicks$
|
|
1729
|
+
const getPicks$b = (id, searchValue) => {
|
|
1730
|
+
const fn = getPicks$c(id);
|
|
1728
1731
|
return fn(searchValue);
|
|
1729
1732
|
};
|
|
1730
1733
|
|
|
@@ -1740,11 +1743,11 @@ const setValue = async (state, newValue) => {
|
|
|
1740
1743
|
if (value === newValue) {
|
|
1741
1744
|
return state;
|
|
1742
1745
|
}
|
|
1743
|
-
const newPicks = await getPicks$
|
|
1746
|
+
const newPicks = await getPicks$b(uri, newValue);
|
|
1744
1747
|
const filterValue = getFilterValue(uri, newValue);
|
|
1745
1748
|
const items = filterQuickPickItems(newPicks, filterValue);
|
|
1746
1749
|
const focusedIndex = items.length === 0 ? -1 : 0;
|
|
1747
|
-
const sliced =
|
|
1750
|
+
const sliced = items.slice(minLineY, maxLineY);
|
|
1748
1751
|
const {
|
|
1749
1752
|
newFileIconCache,
|
|
1750
1753
|
icons
|
|
@@ -1908,7 +1911,7 @@ const loadContent = async state => {
|
|
|
1908
1911
|
} = state;
|
|
1909
1912
|
const value = getDefaultValue(uri);
|
|
1910
1913
|
setArgs(uri, args);
|
|
1911
|
-
const newPicks = await getPicks$
|
|
1914
|
+
const newPicks = await getPicks$b(uri, value);
|
|
1912
1915
|
array(newPicks);
|
|
1913
1916
|
const filterValue = getFilterValue(uri, value);
|
|
1914
1917
|
const items = filterQuickPickItems(newPicks, filterValue);
|
|
@@ -2451,7 +2454,7 @@ const toProtoVisibleItem$2 = name => {
|
|
|
2451
2454
|
};
|
|
2452
2455
|
return pick;
|
|
2453
2456
|
};
|
|
2454
|
-
const getPicks$
|
|
2457
|
+
const getPicks$a = async searchValue => {
|
|
2455
2458
|
const colorThemeNames = await getColorThemeNames();
|
|
2456
2459
|
const picks = colorThemeNames.map(toProtoVisibleItem$2);
|
|
2457
2460
|
return picks;
|
|
@@ -2523,7 +2526,7 @@ const toProtoVisibleItem$1 = item => {
|
|
|
2523
2526
|
pick.id = item.id;
|
|
2524
2527
|
return pick;
|
|
2525
2528
|
};
|
|
2526
|
-
const getPicks$
|
|
2529
|
+
const getPicks$9 = async () => {
|
|
2527
2530
|
// TODO get picks in parallel
|
|
2528
2531
|
const builtinPicks = await getBuiltinPicks();
|
|
2529
2532
|
const extensionPicks = await getExtensionPicks();
|
|
@@ -2532,7 +2535,7 @@ const getPicks$8 = async () => {
|
|
|
2532
2535
|
return converted;
|
|
2533
2536
|
};
|
|
2534
2537
|
|
|
2535
|
-
const getPicks$
|
|
2538
|
+
const getPicks$8 = async searchValue => {
|
|
2536
2539
|
const items = state$3.args[1] || [];
|
|
2537
2540
|
return items;
|
|
2538
2541
|
};
|
|
@@ -2560,7 +2563,7 @@ const state$1 = {
|
|
|
2560
2563
|
prefix: 'string-that-should-never-match-another-string'
|
|
2561
2564
|
};
|
|
2562
2565
|
|
|
2563
|
-
const getPicks$
|
|
2566
|
+
const getPicks$7 = async value => {
|
|
2564
2567
|
const prefix = getQuickPickPrefix(value);
|
|
2565
2568
|
const providerId = getQuickPickProviderId(prefix);
|
|
2566
2569
|
|
|
@@ -2571,7 +2574,7 @@ const getPicks$6 = async value => {
|
|
|
2571
2574
|
}
|
|
2572
2575
|
// TODO this line is a bit duplicated with getFilterValue
|
|
2573
2576
|
const slicedValue = value.slice(prefix.length).trimStart();
|
|
2574
|
-
const picks = await getPicks$
|
|
2577
|
+
const picks = await getPicks$b(providerId, slicedValue);
|
|
2575
2578
|
return picks;
|
|
2576
2579
|
};
|
|
2577
2580
|
|
|
@@ -2644,7 +2647,7 @@ const convertToPick = uri => {
|
|
|
2644
2647
|
// e.g. when there are many files, don't need
|
|
2645
2648
|
// to compute the fileIcon for all files
|
|
2646
2649
|
|
|
2647
|
-
const getPicks$
|
|
2650
|
+
const getPicks$6 = async searchValue => {
|
|
2648
2651
|
// TODO cache workspace path
|
|
2649
2652
|
const workspace = await getWorkspacePath();
|
|
2650
2653
|
if (!workspace) {
|
|
@@ -2655,6 +2658,59 @@ const getPicks$5 = async searchValue => {
|
|
|
2655
2658
|
return picks;
|
|
2656
2659
|
};
|
|
2657
2660
|
|
|
2661
|
+
const getPicks$5 = async () => {
|
|
2662
|
+
const picks = [{
|
|
2663
|
+
label: '1',
|
|
2664
|
+
description: '',
|
|
2665
|
+
icon: '',
|
|
2666
|
+
fileIcon: '',
|
|
2667
|
+
matches: [],
|
|
2668
|
+
direntType: None$2,
|
|
2669
|
+
uri: ''
|
|
2670
|
+
}, {
|
|
2671
|
+
label: '2',
|
|
2672
|
+
description: '',
|
|
2673
|
+
icon: '',
|
|
2674
|
+
fileIcon: '',
|
|
2675
|
+
matches: [],
|
|
2676
|
+
direntType: None$2,
|
|
2677
|
+
uri: ''
|
|
2678
|
+
}, {
|
|
2679
|
+
label: '3',
|
|
2680
|
+
description: '',
|
|
2681
|
+
icon: '',
|
|
2682
|
+
fileIcon: '',
|
|
2683
|
+
matches: [],
|
|
2684
|
+
direntType: None$2,
|
|
2685
|
+
uri: ''
|
|
2686
|
+
}, {
|
|
2687
|
+
label: '4',
|
|
2688
|
+
description: '',
|
|
2689
|
+
icon: '',
|
|
2690
|
+
fileIcon: '',
|
|
2691
|
+
matches: [],
|
|
2692
|
+
direntType: None$2,
|
|
2693
|
+
uri: ''
|
|
2694
|
+
}, {
|
|
2695
|
+
label: '5',
|
|
2696
|
+
description: '',
|
|
2697
|
+
icon: '',
|
|
2698
|
+
fileIcon: '',
|
|
2699
|
+
matches: [],
|
|
2700
|
+
direntType: None$2,
|
|
2701
|
+
uri: ''
|
|
2702
|
+
}, {
|
|
2703
|
+
label: '6',
|
|
2704
|
+
description: '',
|
|
2705
|
+
icon: '',
|
|
2706
|
+
fileIcon: '',
|
|
2707
|
+
matches: [],
|
|
2708
|
+
direntType: None$2,
|
|
2709
|
+
uri: ''
|
|
2710
|
+
}];
|
|
2711
|
+
return picks;
|
|
2712
|
+
};
|
|
2713
|
+
|
|
2658
2714
|
const getRecentlyOpened = () => {
|
|
2659
2715
|
return invoke$1(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
|
|
2660
2716
|
};
|
|
@@ -2693,7 +2749,7 @@ const getPicks$1 = async () => {
|
|
|
2693
2749
|
return picks;
|
|
2694
2750
|
};
|
|
2695
2751
|
|
|
2696
|
-
const selectPick$
|
|
2752
|
+
const selectPick$9 = async pick => {
|
|
2697
2753
|
const id = pick.label;
|
|
2698
2754
|
await setColorTheme(/* colorThemeId */id);
|
|
2699
2755
|
return {
|
|
@@ -2732,7 +2788,7 @@ const selectPickExtension = async item => {
|
|
|
2732
2788
|
command: Hide
|
|
2733
2789
|
};
|
|
2734
2790
|
};
|
|
2735
|
-
const selectPick$
|
|
2791
|
+
const selectPick$8 = async item => {
|
|
2736
2792
|
// @ts-ignore
|
|
2737
2793
|
const id = item.id;
|
|
2738
2794
|
if (id.startsWith('ext.')) {
|
|
@@ -2741,7 +2797,7 @@ const selectPick$6 = async item => {
|
|
|
2741
2797
|
return selectPickBuiltin(item);
|
|
2742
2798
|
};
|
|
2743
2799
|
|
|
2744
|
-
const selectPick$
|
|
2800
|
+
const selectPick$7 = async pick => {
|
|
2745
2801
|
const {
|
|
2746
2802
|
args
|
|
2747
2803
|
} = state$3;
|
|
@@ -2752,7 +2808,7 @@ const selectPick$5 = async pick => {
|
|
|
2752
2808
|
};
|
|
2753
2809
|
};
|
|
2754
2810
|
|
|
2755
|
-
const selectPick$
|
|
2811
|
+
const selectPick$6 = item => {
|
|
2756
2812
|
const {
|
|
2757
2813
|
provider
|
|
2758
2814
|
} = state$1;
|
|
@@ -2764,7 +2820,7 @@ const openUri = async uri => {
|
|
|
2764
2820
|
await invoke$1(/* Main.openUri */'Main.openUri', /* uri */uri);
|
|
2765
2821
|
};
|
|
2766
2822
|
|
|
2767
|
-
const selectPick$
|
|
2823
|
+
const selectPick$5 = async pick => {
|
|
2768
2824
|
const description = pick.description;
|
|
2769
2825
|
const fileName = pick.label;
|
|
2770
2826
|
const workspace = await getWorkspacePath();
|
|
@@ -2775,12 +2831,29 @@ const selectPick$3 = async pick => {
|
|
|
2775
2831
|
};
|
|
2776
2832
|
};
|
|
2777
2833
|
|
|
2834
|
+
const execute = async (method, ...params) => {
|
|
2835
|
+
// TODO
|
|
2836
|
+
};
|
|
2837
|
+
|
|
2838
|
+
const selectPick$4 = async item => {
|
|
2839
|
+
const rowIndex = Number.parseInt(item.label);
|
|
2840
|
+
const position = {
|
|
2841
|
+
rowIndex,
|
|
2842
|
+
columnIndex: 5
|
|
2843
|
+
};
|
|
2844
|
+
await execute(/* EditorSetCursor.editorSetCursor */'TODO', /* position */position);
|
|
2845
|
+
// TODO put cursor onto that line
|
|
2846
|
+
return {
|
|
2847
|
+
command: Hide
|
|
2848
|
+
};
|
|
2849
|
+
};
|
|
2850
|
+
|
|
2778
2851
|
const openWorkspaceFolder = uri => {
|
|
2779
2852
|
return invoke$1(/* Workspace.setPath */'Workspace.setPath', /* path */uri);
|
|
2780
2853
|
};
|
|
2781
2854
|
|
|
2782
2855
|
// TODO selectPick should be independent of show/hide
|
|
2783
|
-
const selectPick$
|
|
2856
|
+
const selectPick$3 = async pick => {
|
|
2784
2857
|
const path = `${pick.description}/${pick.label}`;
|
|
2785
2858
|
await openWorkspaceFolder(path);
|
|
2786
2859
|
return {
|
|
@@ -2788,7 +2861,14 @@ const selectPick$2 = async pick => {
|
|
|
2788
2861
|
};
|
|
2789
2862
|
};
|
|
2790
2863
|
|
|
2864
|
+
const selectPick$2 = async item => {
|
|
2865
|
+
return {
|
|
2866
|
+
command: Hide
|
|
2867
|
+
};
|
|
2868
|
+
};
|
|
2869
|
+
|
|
2791
2870
|
const selectPick$1 = async item => {
|
|
2871
|
+
// Command.execute(/* openView */ 549, /* viewName */ item.label)
|
|
2792
2872
|
return {
|
|
2793
2873
|
command: Hide
|
|
2794
2874
|
};
|
|
@@ -2801,23 +2881,26 @@ const selectPick = async item => {
|
|
|
2801
2881
|
};
|
|
2802
2882
|
|
|
2803
2883
|
const selectPicks = {
|
|
2804
|
-
[ColorTheme]: selectPick$
|
|
2805
|
-
[CommandPalette]: selectPick$
|
|
2806
|
-
[Commands]: selectPick$
|
|
2807
|
-
[Custom]: selectPick$
|
|
2808
|
-
[EveryThing]: selectPick$
|
|
2809
|
-
[File$2]: selectPick$
|
|
2810
|
-
[
|
|
2811
|
-
[
|
|
2884
|
+
[ColorTheme]: selectPick$9,
|
|
2885
|
+
[CommandPalette]: selectPick$6,
|
|
2886
|
+
[Commands]: selectPick$8,
|
|
2887
|
+
[Custom]: selectPick$7,
|
|
2888
|
+
[EveryThing]: selectPick$6,
|
|
2889
|
+
[File$2]: selectPick$5,
|
|
2890
|
+
[GoToLine$1]: selectPick$4,
|
|
2891
|
+
[Recent]: selectPick$3,
|
|
2892
|
+
[Symbol$1]: selectPick$2,
|
|
2893
|
+
[View$1]: selectPick$1,
|
|
2812
2894
|
[WorkspaceSymbol$1]: selectPick
|
|
2813
2895
|
};
|
|
2814
2896
|
const getPicks = {
|
|
2815
|
-
[ColorTheme]: getPicks$
|
|
2816
|
-
[CommandPalette]: getPicks$
|
|
2817
|
-
[Commands]: getPicks$
|
|
2818
|
-
[Custom]: getPicks$
|
|
2819
|
-
[EveryThing]: getPicks$
|
|
2820
|
-
[
|
|
2897
|
+
[ColorTheme]: getPicks$a,
|
|
2898
|
+
[CommandPalette]: getPicks$7,
|
|
2899
|
+
[Commands]: getPicks$9,
|
|
2900
|
+
[Custom]: getPicks$8,
|
|
2901
|
+
[EveryThing]: getPicks$7,
|
|
2902
|
+
[GoToLine$1]: getPicks$5,
|
|
2903
|
+
[File$2]: getPicks$6,
|
|
2821
2904
|
[Recent]: getPicks$4,
|
|
2822
2905
|
[Symbol$1]: getPicks$3,
|
|
2823
2906
|
[View$1]: getPicks$2,
|