@lvce-editor/extension-host-worker 8.14.0 → 8.15.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.
@@ -1974,11 +1974,11 @@ const {
1974
1974
  } = create$7(ExtensionManagementWorker);
1975
1975
 
1976
1976
  const {
1977
- invoke: invoke$4,
1978
1977
  set: set$b
1979
1978
  } = create$7(7013);
1980
1979
 
1981
1980
  const {
1981
+ invoke: invoke$4,
1982
1982
  set: set$a
1983
1983
  } = create$7(10_000);
1984
1984
 
@@ -2759,17 +2759,43 @@ const create$1 = () => {
2759
2759
  return ++id$1;
2760
2760
  };
2761
2761
 
2762
- const ExtensionHostQuickPickShow = 'ExtensionHostQuickPick.show';
2763
-
2762
+ const validateQuickPickItem = item => {
2763
+ if (!item || typeof item !== 'object') {
2764
+ throw new TypeError('quick pick item must be an object');
2765
+ }
2766
+ if (typeof item.label !== 'string') {
2767
+ throw new TypeError('quick pick item.label must be a string');
2768
+ }
2769
+ if (typeof item.description !== 'string') {
2770
+ throw new TypeError('quick pick item.description must be a string');
2771
+ }
2772
+ if (!('value' in item)) {
2773
+ throw new TypeError('quick pick item.value is required');
2774
+ }
2775
+ };
2764
2776
  const showQuickPick = async ({
2765
- getPicks,
2766
- toPick
2777
+ items,
2778
+ placeholder
2767
2779
  }) => {
2768
- const rawPicks = await getPicks();
2769
- const picks = rawPicks.map(toPick);
2770
- return invoke$1(ExtensionHostQuickPickShow, picks);
2780
+ if (!Array.isArray(items)) {
2781
+ throw new TypeError('showQuickPick items must be an array');
2782
+ }
2783
+ for (const item of items) {
2784
+ validateQuickPickItem(item);
2785
+ }
2786
+ return invoke$4('QuickPick.showQuickPick', {
2787
+ items,
2788
+ placeholder
2789
+ });
2771
2790
  };
2772
2791
  const quickInputs = Object.create(null);
2792
+ const renderQuickInput = async (id, searchValue) => {
2793
+ const render = quickInputs[id];
2794
+ if (!render) {
2795
+ return [];
2796
+ }
2797
+ return render(searchValue);
2798
+ };
2773
2799
  const showQuickInput = async ({
2774
2800
  ignoreFocusOut,
2775
2801
  initialValue,
@@ -2777,6 +2803,7 @@ const showQuickInput = async ({
2777
2803
  }) => {
2778
2804
  const id = create$1();
2779
2805
  quickInputs[id] = render;
2806
+ const initialItems = await render('');
2780
2807
  // TODO create direct connection to file search worker
2781
2808
  const {
2782
2809
  canceled,
@@ -2784,13 +2811,17 @@ const showQuickInput = async ({
2784
2811
  } = await invoke$4('QuickPick.showQuickInput', {
2785
2812
  id,
2786
2813
  ignoreFocusOut,
2814
+ initialItems,
2787
2815
  initialValue
2788
2816
  });
2789
- delete quickInputs[id];
2790
- return {
2791
- canceled,
2792
- inputValue
2793
- };
2817
+ try {
2818
+ return {
2819
+ canceled,
2820
+ inputValue
2821
+ };
2822
+ } finally {
2823
+ delete quickInputs[id];
2824
+ }
2794
2825
  };
2795
2826
 
2796
2827
  const {
@@ -3811,16 +3842,6 @@ const launchFileSearchWorker = async () => {
3811
3842
  set$b(rpc);
3812
3843
  };
3813
3844
 
3814
- const launchQuickPickWorker = async () => {
3815
- const rpc = await create$d({
3816
- commandMap: {},
3817
- async send(port) {
3818
- await sendMessagePortToQuickPickWorker(port, 0);
3819
- }
3820
- });
3821
- set$a(rpc);
3822
- };
3823
-
3824
3845
  const create = () => {
3825
3846
  return {
3826
3847
  finished: false
@@ -5373,9 +5394,6 @@ const getContentType = uri => {
5373
5394
  return mime;
5374
5395
  };
5375
5396
 
5376
- /* eslint-disable sonarjs/prefer-single-boolean-return, sonarjs/redundant-type-aliases, sonarjs/cognitive-complexity */
5377
-
5378
-
5379
5397
  // TODO move this to an extension?
5380
5398
 
5381
5399
  const readFile = uri => {
@@ -6377,6 +6395,7 @@ const commandMap = {
6377
6395
  'ExtensionHostDebug.stepInto': stepInto,
6378
6396
  'ExtensionHostDebug.stepOut': stepOut,
6379
6397
  'ExtensionHostDebug.stepOver': stepOver,
6398
+ 'ExtensionHostQuickPick.renderQuickInput': renderQuickInput,
6380
6399
  'ExtensionHostRename.executeprepareRenameProvider': executeprepareRenameProvider,
6381
6400
  'ExtensionHostRename.executeRenameProvider': executeRenameProvider,
6382
6401
  'ExtensionHostSourceControl.getIconDefinitions': getIconDefinitions,
@@ -6443,6 +6462,16 @@ const commandMap = {
6443
6462
  'WebViews.getWebViews': getWebViews
6444
6463
  };
6445
6464
 
6465
+ const launchQuickPickWorker = async () => {
6466
+ const rpc = await create$d({
6467
+ commandMap: commandMap,
6468
+ async send(port) {
6469
+ await sendMessagePortToQuickPickWorker(port, 0);
6470
+ }
6471
+ });
6472
+ set$a(rpc);
6473
+ };
6474
+
6446
6475
  const launchRendererWorker = async () => {
6447
6476
  const rpc = await create$8({
6448
6477
  commandMap: commandMap
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-host-worker",
3
- "version": "8.14.0",
3
+ "version": "8.15.0",
4
4
  "description": "Webworker for the extension host functionality in Lvce Editor.",
5
5
  "keywords": [
6
6
  "web-worker"