@lvce-editor/file-search-worker 6.18.0 → 7.0.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.
@@ -63,7 +63,7 @@ class AssertionError extends Error {
63
63
  const Object$1 = 1;
64
64
  const Number$1 = 2;
65
65
  const Array$1 = 3;
66
- const String = 4;
66
+ const String$1 = 4;
67
67
  const Boolean$1 = 5;
68
68
  const Function = 6;
69
69
  const Null = 7;
@@ -75,7 +75,7 @@ const getType = value => {
75
75
  case 'function':
76
76
  return Function;
77
77
  case 'string':
78
- return String;
78
+ return String$1;
79
79
  case 'object':
80
80
  if (value === null) {
81
81
  return Null;
@@ -110,7 +110,7 @@ const array = value => {
110
110
  };
111
111
  const string = value => {
112
112
  const type = getType(value);
113
- if (type !== String) {
113
+ if (type !== String$1) {
114
114
  throw new AssertionError('expected value to be of type string');
115
115
  }
116
116
  };
@@ -468,7 +468,7 @@ const getFirstEvent = (eventEmitter, eventMap) => {
468
468
  return promise;
469
469
  };
470
470
  const Message$1 = 3;
471
- const create$5$1 = async ({
471
+ const create$5 = async ({
472
472
  isMessagePortOpen,
473
473
  messagePort
474
474
  }) => {
@@ -519,18 +519,18 @@ const wrap$5 = messagePort => {
519
519
  };
520
520
  const IpcParentWithMessagePort$1 = {
521
521
  __proto__: null,
522
- create: create$5$1,
522
+ create: create$5,
523
523
  signal: signal$1,
524
524
  wrap: wrap$5
525
525
  };
526
526
 
527
527
  const Two$1 = '2.0';
528
- const callbacks = Object.create(null);
528
+ const callbacks$1 = Object.create(null);
529
529
  const get$2 = id => {
530
- return callbacks[id];
530
+ return callbacks$1[id];
531
531
  };
532
532
  const remove = id => {
533
- delete callbacks[id];
533
+ delete callbacks$1[id];
534
534
  };
535
535
  class JsonRpcError extends Error {
536
536
  constructor(message) {
@@ -861,14 +861,14 @@ const execute = (command, ...args) => {
861
861
  };
862
862
 
863
863
  const Two = '2.0';
864
- const create$p = (method, params) => {
864
+ const create$q = (method, params) => {
865
865
  return {
866
866
  jsonrpc: Two,
867
867
  method,
868
868
  params
869
869
  };
870
870
  };
871
- const create$o = (id, method, params) => {
871
+ const create$p = (id, method, params) => {
872
872
  const message = {
873
873
  id,
874
874
  jsonrpc: Two,
@@ -878,14 +878,14 @@ const create$o = (id, method, params) => {
878
878
  return message;
879
879
  };
880
880
  let id = 0;
881
- const create$n = () => {
881
+ const create$o = () => {
882
882
  return ++id;
883
883
  };
884
884
 
885
885
  /* eslint-disable n/no-unsupported-features/es-syntax */
886
886
 
887
887
  const registerPromise = map => {
888
- const id = create$n();
888
+ const id = create$o();
889
889
  const {
890
890
  promise,
891
891
  resolve
@@ -903,7 +903,7 @@ const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer)
903
903
  id,
904
904
  promise
905
905
  } = registerPromise(callbacks);
906
- const message = create$o(id, method, params);
906
+ const message = create$p(id, method, params);
907
907
  if (useSendAndTransfer && ipc.sendAndTransfer) {
908
908
  ipc.sendAndTransfer(message);
909
909
  } else {
@@ -939,7 +939,7 @@ const createRpc = ipc => {
939
939
  * @deprecated
940
940
  */
941
941
  send(method, ...params) {
942
- const message = create$p(method, params);
942
+ const message = create$q(method, params);
943
943
  ipc.send(message);
944
944
  }
945
945
  };
@@ -975,7 +975,7 @@ const listen$1 = async (module, options) => {
975
975
  const ipc = module.wrap(rawIpc);
976
976
  return ipc;
977
977
  };
978
- const create$7 = async ({
978
+ const create$8 = async ({
979
979
  commandMap,
980
980
  isMessagePortOpen = true,
981
981
  messagePort
@@ -994,9 +994,9 @@ const create$7 = async ({
994
994
  };
995
995
  const PlainMessagePortRpc = {
996
996
  __proto__: null,
997
- create: create$7
997
+ create: create$8
998
998
  };
999
- const create$5 = async ({
999
+ const create$6 = async ({
1000
1000
  commandMap,
1001
1001
  isMessagePortOpen,
1002
1002
  send
@@ -1006,7 +1006,7 @@ const create$5 = async ({
1006
1006
  port2
1007
1007
  } = new MessageChannel();
1008
1008
  await send(port1);
1009
- return create$7({
1009
+ return create$8({
1010
1010
  commandMap,
1011
1011
  isMessagePortOpen,
1012
1012
  messagePort: port2
@@ -1014,7 +1014,7 @@ const create$5 = async ({
1014
1014
  };
1015
1015
  const TransferMessagePortRpcParent = {
1016
1016
  __proto__: null,
1017
- create: create$5
1017
+ create: create$6
1018
1018
  };
1019
1019
  const create$2$1 = async ({
1020
1020
  commandMap
@@ -1288,6 +1288,7 @@ const handleWheel = (state, deltaMode, deltaY) => {
1288
1288
 
1289
1289
  const create = (uid, uri, listItemHeight, x, y, width, height, platform, args, workspaceUri, assetDir) => {
1290
1290
  const state = {
1291
+ allowEmptyResult: false,
1291
1292
  cursorOffset: 0,
1292
1293
  height: 300,
1293
1294
  icons: [],
@@ -1313,6 +1314,7 @@ const create = (uid, uri, listItemHeight, x, y, width, height, platform, args, w
1313
1314
  fileIconCache: Object.create(null),
1314
1315
  focused: false,
1315
1316
  inputSource: User,
1317
+ placeholder: '',
1316
1318
  platform,
1317
1319
  value: ''
1318
1320
  };
@@ -2998,6 +3000,27 @@ const getQuickPickProviderId = prefix => {
2998
3000
  }
2999
3001
  };
3000
3002
 
3003
+ const parseArgs = (subId, args) => {
3004
+ if (subId !== Custom$1) {
3005
+ return {
3006
+ ignoreFocusOut: false,
3007
+ initialValue: ''
3008
+ };
3009
+ }
3010
+ const last = args.at(-1);
3011
+ if (!last || typeof last !== 'object') {
3012
+ return {
3013
+ ignoreFocusOut: false,
3014
+ initialValue: ''
3015
+ };
3016
+ }
3017
+ return {
3018
+ // @ts-ignore
3019
+ ignoreFocusOut: Boolean(last.ignoreFocusOut),
3020
+ // @ts-ignore
3021
+ initialValue: String(last.initialValue)
3022
+ };
3023
+ };
3001
3024
  const loadContent = async state => {
3002
3025
  const {
3003
3026
  args,
@@ -3028,6 +3051,8 @@ const loadContent = async state => {
3028
3051
  } = await getQuickPickFileIcons(sliced, fileIconCache);
3029
3052
  const listHeight = getListHeight(items.length, itemHeight, height);
3030
3053
  const finalDeltaY = getFinalDeltaY(listHeight, itemHeight, items.length);
3054
+ const parsedArgs = parseArgs(subId, args);
3055
+ const finalValue = parsedArgs.initialValue || value;
3031
3056
  return {
3032
3057
  ...state,
3033
3058
  args,
@@ -3042,12 +3067,20 @@ const loadContent = async state => {
3042
3067
  maxLineY,
3043
3068
  minLineY,
3044
3069
  picks: newPicks,
3070
+ placeholder: '',
3045
3071
  providerId: id,
3046
3072
  state: Finished,
3047
- value
3073
+ value: finalValue
3048
3074
  };
3049
3075
  };
3050
3076
 
3077
+ const callbacks = Object.create(null);
3078
+ const executeCallback = id => {
3079
+ const fn = callbacks[id];
3080
+ delete callbacks[id];
3081
+ fn();
3082
+ };
3083
+
3051
3084
  const getVisible$1 = (items, minLineY, maxLineY, icons) => {
3052
3085
  const range = items.slice(minLineY, maxLineY);
3053
3086
  const protoVisibleItems = range.map((item, index) => {
@@ -3507,7 +3540,10 @@ const renderEventListeners = () => {
3507
3540
  };
3508
3541
 
3509
3542
  const selectCurrentIndex = state => {
3510
- return selectIndex(state, state.focusedIndex);
3543
+ const {
3544
+ focusedIndex
3545
+ } = state;
3546
+ return selectIndex(state, focusedIndex);
3511
3547
  };
3512
3548
 
3513
3549
  const findLabelIndex = (items, label) => {
@@ -3530,9 +3566,17 @@ const selectItem = async (state, label) => {
3530
3566
 
3531
3567
  const showQuickInput = async ({
3532
3568
  ignoreFocusOut,
3533
- initialValue
3569
+ initialValue,
3570
+ waitUntil
3534
3571
  }) => {
3535
3572
  // TODO ask renderer worker to create quickpick instance, with given options
3573
+ const picks = [];
3574
+ // const id=QuickPickCallbacks.registerCallback()
3575
+ await invoke$1('QuickPick.showCustom', picks, {
3576
+ ignoreFocusOut,
3577
+ initialValue,
3578
+ waitUntil
3579
+ });
3536
3580
  return {
3537
3581
  canceled: false,
3538
3582
  inputValue: ''
@@ -3545,6 +3589,7 @@ const commandMap = {
3545
3589
  'QuickPick.create2': create,
3546
3590
  'QuickPick.diff2': diff2,
3547
3591
  'QuickPick.dispose': dispose,
3592
+ 'QuickPick.executeCallback': executeCallback,
3548
3593
  'QuickPick.focusFirst': wrapCommand(focusFirst),
3549
3594
  'QuickPick.focusIndex': wrapCommand(focusIndex),
3550
3595
  'QuickPick.focusLast': wrapCommand(focusLast),
@@ -3593,7 +3638,7 @@ const searchFile$1 = async uri => {
3593
3638
  };
3594
3639
 
3595
3640
  const getFileSearchRipGrepArgs = () => {
3596
- const ripGrepArgs = ['--files', '--sort-files'];
3641
+ const ripGrepArgs = ['--files', '--sort-files', '--hidden'];
3597
3642
  return ripGrepArgs;
3598
3643
  };
3599
3644
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/file-search-worker",
3
- "version": "6.18.0",
3
+ "version": "7.0.0",
4
4
  "keywords": [
5
5
  "text-search"
6
6
  ],