@lvce-editor/quick-pick-worker 4.17.1 → 4.18.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 +98 -37
- package/package.json +1 -1
|
@@ -1313,6 +1313,8 @@ const Symbol$3 = 8;
|
|
|
1313
1313
|
const View$3 = 9;
|
|
1314
1314
|
const WorkspaceSymbol$2 = 10;
|
|
1315
1315
|
const LanguageMode$1 = 11;
|
|
1316
|
+
const EndOfLine$1 = 12;
|
|
1317
|
+
const Indentation$1 = 13;
|
|
1316
1318
|
const EveryThing$1 = 100;
|
|
1317
1319
|
|
|
1318
1320
|
const getCancelResult$1 = args => {
|
|
@@ -2433,7 +2435,7 @@ const toProtoVisibleItem$4 = name => {
|
|
|
2433
2435
|
};
|
|
2434
2436
|
return pick;
|
|
2435
2437
|
};
|
|
2436
|
-
const getPicks$
|
|
2438
|
+
const getPicks$f = async (searchValue, args, {
|
|
2437
2439
|
assetDir = '',
|
|
2438
2440
|
platform = 0
|
|
2439
2441
|
} = {}) => {
|
|
@@ -2569,7 +2571,7 @@ const toProtoVisibleItem$3 = item => {
|
|
|
2569
2571
|
// @ts-ignore
|
|
2570
2572
|
return pick;
|
|
2571
2573
|
};
|
|
2572
|
-
const getPicks$
|
|
2574
|
+
const getPicks$e = async (value, args, {
|
|
2573
2575
|
assetDir = '',
|
|
2574
2576
|
platform = 0
|
|
2575
2577
|
} = {}) => {
|
|
@@ -2633,7 +2635,7 @@ const toProtoVisibleItem$2 = item => {
|
|
|
2633
2635
|
value
|
|
2634
2636
|
};
|
|
2635
2637
|
};
|
|
2636
|
-
const getPicks$
|
|
2638
|
+
const getPicks$d = async (searchValue, args) => {
|
|
2637
2639
|
state$2.args = args;
|
|
2638
2640
|
const options = args.at(-1);
|
|
2639
2641
|
let items;
|
|
@@ -2646,6 +2648,20 @@ const getPicks$b = async (searchValue, args) => {
|
|
|
2646
2648
|
return mapped;
|
|
2647
2649
|
};
|
|
2648
2650
|
|
|
2651
|
+
const toPick$1 = (label, value) => ({
|
|
2652
|
+
description: '',
|
|
2653
|
+
direntType: 0,
|
|
2654
|
+
fileIcon: '',
|
|
2655
|
+
icon: '',
|
|
2656
|
+
label,
|
|
2657
|
+
matches: [],
|
|
2658
|
+
uri: '',
|
|
2659
|
+
value
|
|
2660
|
+
});
|
|
2661
|
+
const getPicks$c = async () => {
|
|
2662
|
+
return [toPick$1('LF', 'lf'), toPick$1('CRLF', 'crlf')];
|
|
2663
|
+
};
|
|
2664
|
+
|
|
2649
2665
|
const emptyMatches = [];
|
|
2650
2666
|
|
|
2651
2667
|
const getWorkspacePath = async () => {
|
|
@@ -2695,7 +2711,7 @@ const convertToPick = uri => {
|
|
|
2695
2711
|
// e.g. when there are many files, don't need
|
|
2696
2712
|
// to compute the fileIcon for all files
|
|
2697
2713
|
|
|
2698
|
-
const getPicks$
|
|
2714
|
+
const getPicks$b = async searchValue => {
|
|
2699
2715
|
// TODO cache workspace path
|
|
2700
2716
|
const workspace = await getWorkspacePath();
|
|
2701
2717
|
if (!workspace) {
|
|
@@ -2863,35 +2879,34 @@ const getPicksGoToLineBase = async () => {
|
|
|
2863
2879
|
}];
|
|
2864
2880
|
};
|
|
2865
2881
|
|
|
2866
|
-
const
|
|
2867
|
-
const lineString = value.slice(GoToLine$1.length);
|
|
2868
|
-
const
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
if (wantedLine < 1) {
|
|
2873
|
-
return -1;
|
|
2882
|
+
const parseGoToLinePosition = value => {
|
|
2883
|
+
const [lineString, columnString = '1'] = value.slice(GoToLine$1.length).split(':');
|
|
2884
|
+
const line = Number(lineString);
|
|
2885
|
+
const column = Number(columnString);
|
|
2886
|
+
if (!Number.isSafeInteger(line) || !Number.isSafeInteger(column) || line < 1 || column < 1) {
|
|
2887
|
+
return undefined;
|
|
2874
2888
|
}
|
|
2875
|
-
return
|
|
2889
|
+
return {
|
|
2890
|
+
columnIndex: column - 1,
|
|
2891
|
+
rowIndex: line - 1
|
|
2892
|
+
};
|
|
2876
2893
|
};
|
|
2877
2894
|
|
|
2878
|
-
const getPicks$
|
|
2895
|
+
const getPicks$a = async value => {
|
|
2879
2896
|
if (value === GoToLine$1) {
|
|
2880
2897
|
return getPicksGoToLineBase();
|
|
2881
2898
|
}
|
|
2882
2899
|
if (value.startsWith(GoToLine$1)) {
|
|
2883
|
-
const
|
|
2884
|
-
if (
|
|
2900
|
+
const position = parseGoToLinePosition(value);
|
|
2901
|
+
if (!position) {
|
|
2885
2902
|
return getPicksGoToLineBase();
|
|
2886
2903
|
}
|
|
2887
|
-
const rowIndex = wantedLine - 1;
|
|
2888
|
-
const columnIndex = 0;
|
|
2889
2904
|
return [{
|
|
2890
2905
|
description: '',
|
|
2891
2906
|
direntType: 0,
|
|
2892
2907
|
fileIcon: '',
|
|
2893
2908
|
icon: '',
|
|
2894
|
-
label: pressEnterToGoToLine(rowIndex, columnIndex),
|
|
2909
|
+
label: pressEnterToGoToLine(position.rowIndex, position.columnIndex),
|
|
2895
2910
|
matches: [],
|
|
2896
2911
|
uri: ''
|
|
2897
2912
|
}];
|
|
@@ -2905,7 +2920,7 @@ const Percent = '%';
|
|
|
2905
2920
|
const AngleBracket = '>';
|
|
2906
2921
|
const View$1 = 'view';
|
|
2907
2922
|
|
|
2908
|
-
const getPicks$
|
|
2923
|
+
const getPicks$9 = async () => {
|
|
2909
2924
|
return [{
|
|
2910
2925
|
description: goToFile(),
|
|
2911
2926
|
direntType: None$2,
|
|
@@ -2957,6 +2972,20 @@ const getPicks$8 = async () => {
|
|
|
2957
2972
|
}];
|
|
2958
2973
|
};
|
|
2959
2974
|
|
|
2975
|
+
const toPick = (label, value) => ({
|
|
2976
|
+
description: '',
|
|
2977
|
+
direntType: 0,
|
|
2978
|
+
fileIcon: '',
|
|
2979
|
+
icon: '',
|
|
2980
|
+
label,
|
|
2981
|
+
matches: [],
|
|
2982
|
+
uri: '',
|
|
2983
|
+
value
|
|
2984
|
+
});
|
|
2985
|
+
const getPicks$8 = async () => {
|
|
2986
|
+
return [toPick('Indent Using Spaces', true), toPick('Indent Using Tabs', false)];
|
|
2987
|
+
};
|
|
2988
|
+
|
|
2960
2989
|
const getIconName = language => {
|
|
2961
2990
|
const fileName = language.fileNames?.find(value => typeof value === 'string');
|
|
2962
2991
|
if (fileName) {
|
|
@@ -3040,7 +3069,12 @@ const getRecentlyOpened = async () => {
|
|
|
3040
3069
|
|
|
3041
3070
|
const getPath = uri => {
|
|
3042
3071
|
if (uri.startsWith('file://')) {
|
|
3043
|
-
|
|
3072
|
+
const path = uri.slice('file://'.length);
|
|
3073
|
+
try {
|
|
3074
|
+
return decodeURIComponent(path);
|
|
3075
|
+
} catch {
|
|
3076
|
+
return path;
|
|
3077
|
+
}
|
|
3044
3078
|
}
|
|
3045
3079
|
return uri;
|
|
3046
3080
|
};
|
|
@@ -3094,7 +3128,7 @@ const KeepOpen = '';
|
|
|
3094
3128
|
const OpenColorTheme = 'open-color-theme';
|
|
3095
3129
|
const OpenLanguageMode = 'open-language-mode';
|
|
3096
3130
|
|
|
3097
|
-
const selectPick$
|
|
3131
|
+
const selectPick$c = async pick => {
|
|
3098
3132
|
const id = pick.label;
|
|
3099
3133
|
await setColorTheme(id);
|
|
3100
3134
|
return {
|
|
@@ -3151,7 +3185,7 @@ const selectPickExtension = async item => {
|
|
|
3151
3185
|
command: Hide
|
|
3152
3186
|
};
|
|
3153
3187
|
};
|
|
3154
|
-
const selectPick$
|
|
3188
|
+
const selectPick$b = async item => {
|
|
3155
3189
|
// @ts-ignore
|
|
3156
3190
|
const {
|
|
3157
3191
|
id
|
|
@@ -3169,7 +3203,7 @@ const getOptions = args => {
|
|
|
3169
3203
|
}
|
|
3170
3204
|
return last;
|
|
3171
3205
|
};
|
|
3172
|
-
const selectPick$
|
|
3206
|
+
const selectPick$a = async (_pick, value) => {
|
|
3173
3207
|
const {
|
|
3174
3208
|
args
|
|
3175
3209
|
} = state$2;
|
|
@@ -3204,11 +3238,19 @@ const selectPick$8 = async (_pick, value) => {
|
|
|
3204
3238
|
};
|
|
3205
3239
|
};
|
|
3206
3240
|
|
|
3241
|
+
const selectPick$9 = async pick => {
|
|
3242
|
+
const editorId = await getActiveEditorId();
|
|
3243
|
+
await invoke$2('Viewlet.executeViewletCommand', editorId, 'setEndOfLine', pick.value);
|
|
3244
|
+
return {
|
|
3245
|
+
command: Hide
|
|
3246
|
+
};
|
|
3247
|
+
};
|
|
3248
|
+
|
|
3207
3249
|
const openUri = async uri => {
|
|
3208
3250
|
await openUri$1(uri);
|
|
3209
3251
|
};
|
|
3210
3252
|
|
|
3211
|
-
const selectPick$
|
|
3253
|
+
const selectPick$8 = async pick => {
|
|
3212
3254
|
const {
|
|
3213
3255
|
description
|
|
3214
3256
|
} = pick;
|
|
@@ -3246,13 +3288,12 @@ const selectPickGoToColumn = async (item, value) => {
|
|
|
3246
3288
|
};
|
|
3247
3289
|
};
|
|
3248
3290
|
|
|
3249
|
-
const selectPick$
|
|
3291
|
+
const selectPick$7 = async (item, value) => {
|
|
3250
3292
|
if (value.startsWith(GoToLine$1)) {
|
|
3251
|
-
const
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
await goToPositionAndFocus(rowIndex, columnIndex);
|
|
3293
|
+
const position = parseGoToLinePosition(value);
|
|
3294
|
+
if (position) {
|
|
3295
|
+
await goToPositionAndFocus(position.rowIndex, position.columnIndex);
|
|
3296
|
+
}
|
|
3256
3297
|
return {
|
|
3257
3298
|
command: Hide
|
|
3258
3299
|
};
|
|
@@ -3262,13 +3303,21 @@ const selectPick$6 = async (item, value) => {
|
|
|
3262
3303
|
};
|
|
3263
3304
|
};
|
|
3264
3305
|
|
|
3265
|
-
const selectPick$
|
|
3306
|
+
const selectPick$6 = async item => {
|
|
3266
3307
|
// Command.execute(/* openView */ 549, /* viewName */ item.label)
|
|
3267
3308
|
return {
|
|
3268
3309
|
command: Hide
|
|
3269
3310
|
};
|
|
3270
3311
|
};
|
|
3271
3312
|
|
|
3313
|
+
const selectPick$5 = async pick => {
|
|
3314
|
+
const editorId = await getActiveEditorId();
|
|
3315
|
+
await invoke$2('Viewlet.executeViewletCommand', editorId, 'setIndentation', pick.value);
|
|
3316
|
+
return {
|
|
3317
|
+
command: Hide
|
|
3318
|
+
};
|
|
3319
|
+
};
|
|
3320
|
+
|
|
3272
3321
|
const selectPick$4 = async pick => {
|
|
3273
3322
|
const editorId = await getActiveEditorId();
|
|
3274
3323
|
const value = pick.value;
|
|
@@ -3279,7 +3328,8 @@ const selectPick$4 = async pick => {
|
|
|
3279
3328
|
};
|
|
3280
3329
|
|
|
3281
3330
|
const openWorkspaceFolder = uri => {
|
|
3282
|
-
|
|
3331
|
+
const command = uri.includes('://') ? 'Workspace.setUri' : 'Workspace.setPath';
|
|
3332
|
+
return invoke$2(command, uri);
|
|
3283
3333
|
};
|
|
3284
3334
|
|
|
3285
3335
|
// TODO selectPick should be independent of show/hide
|
|
@@ -3312,8 +3362,8 @@ const selectPick = async item => {
|
|
|
3312
3362
|
};
|
|
3313
3363
|
};
|
|
3314
3364
|
|
|
3315
|
-
const selectPicks = [selectPick$
|
|
3316
|
-
const getPicks$2 = [getPicks$
|
|
3365
|
+
const selectPicks = [selectPick$c, selectPick$b, selectPick$a, selectPick$8, selectPickGoToColumn, selectPick$7, selectPick$6, selectPick$3, selectPick$2, selectPick$1, selectPick, selectPick$4, selectPick$9, selectPick$5];
|
|
3366
|
+
const getPicks$2 = [getPicks$f, getPicks$e, getPicks$d, getPicks$b, getPicksGoToColumn, getPicks$a, getPicks$9, getPicks$6, getPicks$5, getPicks$4, getPicks$3, getPicks$7, getPicks$c, getPicks$8];
|
|
3317
3367
|
|
|
3318
3368
|
const select = selectPicks;
|
|
3319
3369
|
const getPick$1 = getPicks$2;
|
|
@@ -3559,9 +3609,16 @@ const Help = 'quickPick://help';
|
|
|
3559
3609
|
const WorkspaceSymbol = 'quickPick://workspace-symbol';
|
|
3560
3610
|
const Custom = 'quickPick://custom';
|
|
3561
3611
|
const GoToLine = 'quickPick://go-to-line';
|
|
3612
|
+
const EndOfLine = 'quickPick://end-of-line';
|
|
3613
|
+
const Indentation = 'quickPick://indentation';
|
|
3562
3614
|
|
|
3563
|
-
const getDefaultValue = (id, uri = '') => {
|
|
3615
|
+
const getDefaultValue = (id, uri = '', args = []) => {
|
|
3564
3616
|
if (uri === GoToLine) {
|
|
3617
|
+
const line = Number(args[1]);
|
|
3618
|
+
const column = Number(args[2]);
|
|
3619
|
+
if (Number.isSafeInteger(line) && Number.isSafeInteger(column) && line >= 1 && column >= 1) {
|
|
3620
|
+
return `${GoToLine$1}${line}:${column}`;
|
|
3621
|
+
}
|
|
3565
3622
|
return GoToLine$1;
|
|
3566
3623
|
}
|
|
3567
3624
|
if (uri === WorkspaceSymbol) {
|
|
@@ -3589,6 +3646,10 @@ const getQuickPickProviderId = prefix => {
|
|
|
3589
3646
|
return EveryThing$1;
|
|
3590
3647
|
case Custom:
|
|
3591
3648
|
return Custom$1;
|
|
3649
|
+
case EndOfLine:
|
|
3650
|
+
return EndOfLine$1;
|
|
3651
|
+
case Indentation:
|
|
3652
|
+
return Indentation$1;
|
|
3592
3653
|
case LanguageMode:
|
|
3593
3654
|
return LanguageMode$1;
|
|
3594
3655
|
case Recent:
|
|
@@ -3652,7 +3713,7 @@ const getLoadedState = async state => {
|
|
|
3652
3713
|
uri
|
|
3653
3714
|
} = state;
|
|
3654
3715
|
const id = getQuickPickProviderId(uri);
|
|
3655
|
-
const value = getDefaultValue(id, uri);
|
|
3716
|
+
const value = getDefaultValue(id, uri, args);
|
|
3656
3717
|
const prefix = getQuickPickPrefix(value);
|
|
3657
3718
|
const subId = getQuickPickSubProviderId(id, prefix);
|
|
3658
3719
|
const newPicks = await getPicks(subId, value, args, {
|