@lvce-editor/quick-pick-worker 4.4.1 → 4.5.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 +54 -35
- package/package.json +1 -1
|
@@ -921,9 +921,9 @@ const create$a = (id, method, params) => {
|
|
|
921
921
|
return message;
|
|
922
922
|
};
|
|
923
923
|
|
|
924
|
-
let id
|
|
924
|
+
let id = 0;
|
|
925
925
|
const create$9 = () => {
|
|
926
|
-
return ++id
|
|
926
|
+
return ++id;
|
|
927
927
|
};
|
|
928
928
|
|
|
929
929
|
const registerPromise = map => {
|
|
@@ -1251,9 +1251,11 @@ const closeWidget = async id => {
|
|
|
1251
1251
|
await closeWidget$1(id);
|
|
1252
1252
|
};
|
|
1253
1253
|
|
|
1254
|
-
|
|
1254
|
+
const state$3 = {
|
|
1255
|
+
value: 0
|
|
1256
|
+
};
|
|
1255
1257
|
const create$3 = () => {
|
|
1256
|
-
return ++
|
|
1258
|
+
return ++state$3.value;
|
|
1257
1259
|
};
|
|
1258
1260
|
|
|
1259
1261
|
const callbacks$1 = Object.create(null);
|
|
@@ -1921,7 +1923,7 @@ const next = (items, index) => {
|
|
|
1921
1923
|
return (index + 1) % items.length;
|
|
1922
1924
|
};
|
|
1923
1925
|
const previous = (items, index) => {
|
|
1924
|
-
return index === 0 ? items.length
|
|
1926
|
+
return (index === 0 ? items.length : index) - 1;
|
|
1925
1927
|
};
|
|
1926
1928
|
|
|
1927
1929
|
const focusFirst = state => {
|
|
@@ -2468,7 +2470,7 @@ const warn = (...args) => {
|
|
|
2468
2470
|
console.warn(...args);
|
|
2469
2471
|
};
|
|
2470
2472
|
|
|
2471
|
-
const state$
|
|
2473
|
+
const state$2 = {
|
|
2472
2474
|
menuEntries: []
|
|
2473
2475
|
};
|
|
2474
2476
|
const getAll = async () => {
|
|
@@ -2479,10 +2481,10 @@ const getAll = async () => {
|
|
|
2479
2481
|
} catch {
|
|
2480
2482
|
// ignore
|
|
2481
2483
|
}
|
|
2482
|
-
return state$
|
|
2484
|
+
return state$2.menuEntries;
|
|
2483
2485
|
};
|
|
2484
2486
|
const add$1 = menuEntries => {
|
|
2485
|
-
state$
|
|
2487
|
+
state$2.menuEntries = [...state$2.menuEntries, ...menuEntries];
|
|
2486
2488
|
};
|
|
2487
2489
|
|
|
2488
2490
|
const changeLanguageModePick = {
|
|
@@ -2553,30 +2555,34 @@ const getPicks$c = async (value, args, {
|
|
|
2553
2555
|
return converted;
|
|
2554
2556
|
};
|
|
2555
2557
|
|
|
2556
|
-
const state = {
|
|
2558
|
+
const state$1 = {
|
|
2557
2559
|
args: [],
|
|
2558
2560
|
items: Object.create(null)
|
|
2559
2561
|
};
|
|
2560
2562
|
|
|
2561
|
-
|
|
2563
|
+
const idState = {
|
|
2564
|
+
value: 0
|
|
2565
|
+
};
|
|
2562
2566
|
const add = items => {
|
|
2563
|
-
const nextId = ++
|
|
2564
|
-
state.items[nextId] = items;
|
|
2567
|
+
const nextId = ++idState.value;
|
|
2568
|
+
state$1.items[nextId] = items;
|
|
2565
2569
|
return nextId;
|
|
2566
2570
|
};
|
|
2567
2571
|
const get = id => {
|
|
2568
|
-
return state.items[id] || [];
|
|
2572
|
+
return state$1.items[id] || [];
|
|
2569
2573
|
};
|
|
2570
2574
|
const remove = id => {
|
|
2571
|
-
delete state.items[id];
|
|
2575
|
+
delete state$1.items[id];
|
|
2572
2576
|
};
|
|
2573
2577
|
|
|
2574
|
-
|
|
2578
|
+
const state = {
|
|
2579
|
+
rpc: undefined
|
|
2580
|
+
};
|
|
2575
2581
|
const set = newRpc => {
|
|
2576
|
-
rpc = newRpc;
|
|
2582
|
+
state.rpc = newRpc;
|
|
2577
2583
|
};
|
|
2578
2584
|
const invoke = (method, ...args) => {
|
|
2579
|
-
return rpc.invoke(method, ...args);
|
|
2585
|
+
return state.rpc.invoke(method, ...args);
|
|
2580
2586
|
};
|
|
2581
2587
|
|
|
2582
2588
|
const toProtoVisibleItem$2 = item => {
|
|
@@ -2597,9 +2603,14 @@ const toProtoVisibleItem$2 = item => {
|
|
|
2597
2603
|
};
|
|
2598
2604
|
};
|
|
2599
2605
|
const getPicks$b = async (searchValue, args) => {
|
|
2600
|
-
state.args = args;
|
|
2606
|
+
state$1.args = args;
|
|
2601
2607
|
const options = args.at(-1);
|
|
2602
|
-
|
|
2608
|
+
let items;
|
|
2609
|
+
if (options?.mode === 'quickInput') {
|
|
2610
|
+
items = searchValue === '' && options?.customItemsId ? get(options.customItemsId) : await invoke('ExtensionHostQuickPick.renderQuickInput', options.quickInputId, searchValue);
|
|
2611
|
+
} else {
|
|
2612
|
+
items = options?.customItemsId ? get(options.customItemsId) : args[1] || [];
|
|
2613
|
+
}
|
|
2603
2614
|
const mapped = items.map(toProtoVisibleItem$2);
|
|
2604
2615
|
return mapped;
|
|
2605
2616
|
};
|
|
@@ -2722,7 +2733,7 @@ const QuickOpen = 'Quick open';
|
|
|
2722
2733
|
const SearchForText = 'Search for text';
|
|
2723
2734
|
const ShowAndRunCommands = 'Show And Run Commands';
|
|
2724
2735
|
const TypeNameOfCommandToRun = 'Type the name of a command to run.';
|
|
2725
|
-
const PressEnterToGoToLine =
|
|
2736
|
+
const PressEnterToGoToLine = "Press 'Enter' to go to line {PH1} column {PH2}";
|
|
2726
2737
|
|
|
2727
2738
|
const pressEnterToGoToLine = (row, column) => {
|
|
2728
2739
|
return i18nString(PressEnterToGoToLine, {
|
|
@@ -2764,7 +2775,7 @@ const getPicksGoToColumn = async value => {
|
|
|
2764
2775
|
}
|
|
2765
2776
|
if (value.startsWith(GoToColumn)) {
|
|
2766
2777
|
const columnString = value.slice(GoToColumn.length);
|
|
2767
|
-
const wantedColumn = Number
|
|
2778
|
+
const wantedColumn = Number(columnString);
|
|
2768
2779
|
if (Number.isNaN(wantedColumn)) {
|
|
2769
2780
|
return getPicksGoToColumnBase();
|
|
2770
2781
|
}
|
|
@@ -2807,7 +2818,7 @@ const getPicksGoToLineBase = async () => {
|
|
|
2807
2818
|
|
|
2808
2819
|
const parseGotoline = value => {
|
|
2809
2820
|
const lineString = value.slice(GoToLine$1.length);
|
|
2810
|
-
const wantedLine = Number
|
|
2821
|
+
const wantedLine = Number(lineString);
|
|
2811
2822
|
if (Number.isNaN(wantedLine)) {
|
|
2812
2823
|
return -1;
|
|
2813
2824
|
}
|
|
@@ -2908,7 +2919,8 @@ const getIconName = language => {
|
|
|
2908
2919
|
if (!extension) {
|
|
2909
2920
|
return '';
|
|
2910
2921
|
}
|
|
2911
|
-
|
|
2922
|
+
const normalizedExtension = extension.startsWith('.') ? extension : `.${extension}`;
|
|
2923
|
+
return `file${normalizedExtension}`;
|
|
2912
2924
|
};
|
|
2913
2925
|
const toProtoVisibleItem$1 = language => {
|
|
2914
2926
|
const iconName = getIconName(language);
|
|
@@ -3061,7 +3073,7 @@ const selectPickExtension = async item => {
|
|
|
3061
3073
|
};
|
|
3062
3074
|
}
|
|
3063
3075
|
return {
|
|
3064
|
-
command:
|
|
3076
|
+
command: Hide
|
|
3065
3077
|
};
|
|
3066
3078
|
};
|
|
3067
3079
|
const selectPick$9 = async item => {
|
|
@@ -3085,13 +3097,18 @@ const getOptions = args => {
|
|
|
3085
3097
|
const selectPick$8 = async (_pick, value) => {
|
|
3086
3098
|
const {
|
|
3087
3099
|
args
|
|
3088
|
-
} = state;
|
|
3100
|
+
} = state$1;
|
|
3089
3101
|
const options = getOptions(args);
|
|
3090
3102
|
const resolveId = args[2];
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
}
|
|
3103
|
+
let result;
|
|
3104
|
+
if (options.mode === 'quickPick') {
|
|
3105
|
+
result = options.acceptInput && _pick.value === undefined ? value : _pick.value;
|
|
3106
|
+
} else {
|
|
3107
|
+
result = {
|
|
3108
|
+
canceled: false,
|
|
3109
|
+
inputValue: value
|
|
3110
|
+
};
|
|
3111
|
+
}
|
|
3095
3112
|
if (options.callbackOwner === 'quickPickWorker') {
|
|
3096
3113
|
if (typeof resolveId !== 'number') {
|
|
3097
3114
|
throw new TypeError('expected resolve id to be a number');
|
|
@@ -3134,7 +3151,7 @@ const goToPositionAndFocus = async (rowIndex, columnIndex) => {
|
|
|
3134
3151
|
const selectPickGoToColumn = async (item, value) => {
|
|
3135
3152
|
if (value.startsWith(GoToColumn)) {
|
|
3136
3153
|
const columnString = value.slice(2);
|
|
3137
|
-
const wantedColumn = Number
|
|
3154
|
+
const wantedColumn = Number(columnString);
|
|
3138
3155
|
const text = await getText();
|
|
3139
3156
|
const position = getPosition(text, wantedColumn);
|
|
3140
3157
|
await goToPositionAndFocus(position.row, position.column);
|
|
@@ -3150,7 +3167,7 @@ const selectPickGoToColumn = async (item, value) => {
|
|
|
3150
3167
|
const selectPick$6 = async (item, value) => {
|
|
3151
3168
|
if (value.startsWith(GoToLine$1)) {
|
|
3152
3169
|
const lineString = value.slice(GoToLine$1.length);
|
|
3153
|
-
const wantedLine = Number
|
|
3170
|
+
const wantedLine = Number(lineString);
|
|
3154
3171
|
const rowIndex = wantedLine - 1;
|
|
3155
3172
|
const columnIndex = 0;
|
|
3156
3173
|
await goToPositionAndFocus(rowIndex, columnIndex);
|
|
@@ -3498,7 +3515,8 @@ const waitUntilVisible = () => {
|
|
|
3498
3515
|
return promise;
|
|
3499
3516
|
};
|
|
3500
3517
|
const notifyVisible = () => {
|
|
3501
|
-
const pendingCallbacks = callbacks
|
|
3518
|
+
const pendingCallbacks = [...callbacks];
|
|
3519
|
+
callbacks.length = 0;
|
|
3502
3520
|
for (const callback of pendingCallbacks) {
|
|
3503
3521
|
callback();
|
|
3504
3522
|
}
|
|
@@ -4247,11 +4265,10 @@ const getHighlights = (sections, label) => {
|
|
|
4247
4265
|
nodes.push(text(label));
|
|
4248
4266
|
} else {
|
|
4249
4267
|
for (const section of sections) {
|
|
4268
|
+
labelDom.childCount++;
|
|
4250
4269
|
if (section.highlighted) {
|
|
4251
|
-
labelDom.childCount++;
|
|
4252
4270
|
nodes.push(quickPickHighlight, text(section.text));
|
|
4253
4271
|
} else {
|
|
4254
|
-
labelDom.childCount++;
|
|
4255
4272
|
nodes.push(text(section.text));
|
|
4256
4273
|
}
|
|
4257
4274
|
}
|
|
@@ -4361,7 +4378,7 @@ const getRootNodeCount = nodes => {
|
|
|
4361
4378
|
count++;
|
|
4362
4379
|
} else {
|
|
4363
4380
|
const lastIndex = remainingChildCounts.length - 1;
|
|
4364
|
-
remainingChildCounts[lastIndex]
|
|
4381
|
+
remainingChildCounts[lastIndex] -= 1;
|
|
4365
4382
|
}
|
|
4366
4383
|
remainingChildCounts.push(node.childCount);
|
|
4367
4384
|
}
|
|
@@ -4559,6 +4576,7 @@ const showQuickInput = async ({
|
|
|
4559
4576
|
const QuickPick = 'QuickPick';
|
|
4560
4577
|
|
|
4561
4578
|
const showQuickPick = async ({
|
|
4579
|
+
acceptInput = false,
|
|
4562
4580
|
items,
|
|
4563
4581
|
placeholder = '',
|
|
4564
4582
|
waitUntil = 'selected'
|
|
@@ -4570,6 +4588,7 @@ const showQuickPick = async ({
|
|
|
4570
4588
|
} = registerCallback();
|
|
4571
4589
|
try {
|
|
4572
4590
|
await invoke$1('Viewlet.openWidget', QuickPick, 'custom', [], id, {
|
|
4591
|
+
acceptInput,
|
|
4573
4592
|
callbackOwner: 'quickPickWorker',
|
|
4574
4593
|
customItemsId,
|
|
4575
4594
|
mode: 'quickPick',
|