@jupyterlab/fileeditor-extension 4.5.0-alpha.0 → 4.5.0-alpha.2

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/lib/commands.d.ts CHANGED
@@ -13,6 +13,7 @@ import { ISettingRegistry } from '@jupyterlab/settingregistry';
13
13
  import { ITranslator, TranslationBundle } from '@jupyterlab/translation';
14
14
  import { CommandRegistry } from '@lumino/commands';
15
15
  import { ReadonlyJSONObject } from '@lumino/coreutils';
16
+ import { IDisposable } from '@lumino/disposable';
16
17
  /**
17
18
  * The command IDs used by the fileeditor plugin.
18
19
  */
@@ -97,8 +98,9 @@ export declare namespace Commands {
97
98
  function addCreateNewMarkdownToLauncher(launcher: ILauncher, trans: TranslationBundle): void;
98
99
  /**
99
100
  * Add ___ File items to the Launcher for common file types associated with available kernels
101
+ * Returns a DisposableSet containing all added items
100
102
  */
101
- function addKernelLanguageLauncherItems(launcher: ILauncher, trans: TranslationBundle, availableKernelFileTypes: Iterable<IFileTypeData>): void;
103
+ function addKernelLanguageLauncherItems(launcher: ILauncher, trans: TranslationBundle, availableKernelFileTypes: Iterable<IFileTypeData>): IDisposable;
102
104
  /**
103
105
  * Wrapper function for adding the default items to the File Editor palette
104
106
  */
@@ -121,16 +123,18 @@ export declare namespace Commands {
121
123
  function addChangeFontSizeCommandsToPalette(palette: ICommandPalette, trans: TranslationBundle): void;
122
124
  /**
123
125
  * Add New ___ File commands to the File Editor palette for common file types associated with available kernels
126
+ * Returns a DisposableSet containing all added items
124
127
  */
125
- function addKernelLanguagePaletteItems(palette: ICommandPalette, trans: TranslationBundle, availableKernelFileTypes: Iterable<IFileTypeData>): void;
128
+ function addKernelLanguagePaletteItems(palette: ICommandPalette, trans: TranslationBundle, availableKernelFileTypes: Iterable<IFileTypeData>): IDisposable;
126
129
  /**
127
130
  * Wrapper function for adding the default menu items for File Editor
128
131
  */
129
132
  function addMenuItems(menu: IMainMenu, tracker: WidgetTracker<IDocumentWidget<FileEditor>>, consoleTracker: IConsoleTracker | null, isEnabled: () => boolean): void;
130
133
  /**
131
134
  * Add Create New ___ File commands to the File menu for common file types associated with available kernels
135
+ * Returns a DisposableSet containing all added items
132
136
  */
133
- function addKernelLanguageMenuItems(menu: IMainMenu, availableKernelFileTypes: Iterable<IFileTypeData>): void;
137
+ function addKernelLanguageMenuItems(menu: IMainMenu, availableKernelFileTypes: Iterable<IFileTypeData>): IDisposable;
134
138
  /**
135
139
  * Add a File Editor code runner to the Run menu
136
140
  */
package/lib/commands.js CHANGED
@@ -8,6 +8,7 @@ import { MarkdownCodeBlocks, PathExt } from '@jupyterlab/coreutils';
8
8
  import { nullTranslator } from '@jupyterlab/translation';
9
9
  import { consoleIcon, copyIcon, cutIcon, LabIcon, markdownIcon, pasteIcon, redoIcon, textEditorIcon, undoIcon } from '@jupyterlab/ui-components';
10
10
  import { find } from '@lumino/algorithm';
11
+ import { DisposableSet } from '@lumino/disposable';
11
12
  const autoClosingBracketsNotebook = 'notebook:toggle-autoclosing-brackets';
12
13
  const autoClosingBracketsConsole = 'console:toggle-autoclosing-brackets';
13
14
  /**
@@ -166,6 +167,22 @@ export var Commands;
166
167
  ? trans.__('Decrease Text Editor Font Size')
167
168
  : trans.__('Decrease Font Size');
168
169
  }
170
+ },
171
+ describedBy: {
172
+ args: {
173
+ type: 'object',
174
+ properties: {
175
+ delta: {
176
+ type: 'number',
177
+ description: trans.__('The font size change delta (positive to increase, negative to decrease)')
178
+ },
179
+ isMenu: {
180
+ type: 'boolean',
181
+ description: trans.__('Whether the command is called from a menu context')
182
+ }
183
+ },
184
+ required: ['delta']
185
+ }
169
186
  }
170
187
  });
171
188
  /**
@@ -184,7 +201,13 @@ export var Commands;
184
201
  },
185
202
  isEnabled,
186
203
  isToggled: () => { var _a; return (_a = config.lineNumbers) !== null && _a !== void 0 ? _a : extensions.baseConfiguration.lineNumbers; },
187
- label: trans.__('Show Line Numbers')
204
+ label: trans.__('Show Line Numbers'),
205
+ describedBy: {
206
+ args: {
207
+ type: 'object',
208
+ properties: {}
209
+ }
210
+ }
188
211
  });
189
212
  commands.addCommand(CommandIDs.currentLineNumbers, {
190
213
  label: trans.__('Show Line Numbers'),
@@ -202,6 +225,12 @@ export var Commands;
202
225
  var _a;
203
226
  const widget = tracker.currentWidget;
204
227
  return ((_a = widget === null || widget === void 0 ? void 0 : widget.content.editor.getOption('lineNumbers')) !== null && _a !== void 0 ? _a : false);
228
+ },
229
+ describedBy: {
230
+ args: {
231
+ type: 'object',
232
+ properties: {}
233
+ }
205
234
  }
206
235
  });
207
236
  /**
@@ -225,7 +254,18 @@ export var Commands;
225
254
  return (lineWrap ===
226
255
  ((_b = config.lineWrap) !== null && _b !== void 0 ? _b : extensions.baseConfiguration.lineWrap));
227
256
  },
228
- label: trans.__('Word Wrap')
257
+ label: trans.__('Word Wrap'),
258
+ describedBy: {
259
+ args: {
260
+ type: 'object',
261
+ properties: {
262
+ mode: {
263
+ type: 'boolean',
264
+ description: trans.__('Whether to enable word wrap')
265
+ }
266
+ }
267
+ }
268
+ }
229
269
  });
230
270
  commands.addCommand(CommandIDs.currentLineWrap, {
231
271
  label: trans.__('Wrap Words'),
@@ -243,6 +283,12 @@ export var Commands;
243
283
  var _a;
244
284
  const widget = tracker.currentWidget;
245
285
  return ((_a = widget === null || widget === void 0 ? void 0 : widget.content.editor.getOption('lineWrap')) !== null && _a !== void 0 ? _a : false);
286
+ },
287
+ describedBy: {
288
+ args: {
289
+ type: 'object',
290
+ properties: {}
291
+ }
246
292
  }
247
293
  });
248
294
  /**
@@ -278,6 +324,17 @@ export var Commands;
278
324
  return args['size']
279
325
  ? args['size'] === currentIndentUnit
280
326
  : 'Tab' == currentIndentUnit;
327
+ },
328
+ describedBy: {
329
+ args: {
330
+ type: 'object',
331
+ properties: {
332
+ size: {
333
+ type: 'string',
334
+ description: trans.__('The number of spaces for indentation (or Tab for tab indentation)')
335
+ }
336
+ }
337
+ }
281
338
  }
282
339
  });
283
340
  /**
@@ -296,7 +353,13 @@ export var Commands;
296
353
  },
297
354
  label: trans.__('Match Brackets'),
298
355
  isEnabled,
299
- isToggled: () => { var _a; return (_a = config.matchBrackets) !== null && _a !== void 0 ? _a : extensions.baseConfiguration.matchBrackets; }
356
+ isToggled: () => { var _a; return (_a = config.matchBrackets) !== null && _a !== void 0 ? _a : extensions.baseConfiguration.matchBrackets; },
357
+ describedBy: {
358
+ args: {
359
+ type: 'object',
360
+ properties: {}
361
+ }
362
+ }
300
363
  });
301
364
  commands.addCommand(CommandIDs.currentMatchBrackets, {
302
365
  label: trans.__('Match Brackets'),
@@ -314,6 +377,12 @@ export var Commands;
314
377
  var _a;
315
378
  const widget = tracker.currentWidget;
316
379
  return ((_a = widget === null || widget === void 0 ? void 0 : widget.content.editor.getOption('matchBrackets')) !== null && _a !== void 0 ? _a : false);
380
+ },
381
+ describedBy: {
382
+ args: {
383
+ type: 'object',
384
+ properties: {}
385
+ }
317
386
  }
318
387
  });
319
388
  /**
@@ -334,6 +403,17 @@ export var Commands;
334
403
  isToggled: () => {
335
404
  var _a;
336
405
  return (_a = config.autoClosingBrackets) !== null && _a !== void 0 ? _a : extensions.baseConfiguration.autoClosingBrackets;
406
+ },
407
+ describedBy: {
408
+ args: {
409
+ type: 'object',
410
+ properties: {
411
+ force: {
412
+ type: 'boolean',
413
+ description: trans.__('Force enable/disable auto closing brackets')
414
+ }
415
+ }
416
+ }
337
417
  }
338
418
  });
339
419
  commands.addCommand(CommandIDs.autoClosingBracketsUniversal, {
@@ -361,7 +441,13 @@ export var Commands;
361
441
  label: trans.__('Auto Close Brackets'),
362
442
  isToggled: () => commands.isToggled(CommandIDs.autoClosingBrackets) ||
363
443
  commands.isToggled(autoClosingBracketsNotebook) ||
364
- commands.isToggled(autoClosingBracketsConsole)
444
+ commands.isToggled(autoClosingBracketsConsole),
445
+ describedBy: {
446
+ args: {
447
+ type: 'object',
448
+ properties: {}
449
+ }
450
+ }
365
451
  });
366
452
  /**
367
453
  * Create a menu for the editor.
@@ -381,7 +467,22 @@ export var Commands;
381
467
  console.error(`Failed to set theme - ${reason.message}`);
382
468
  }
383
469
  },
384
- isToggled: args => { var _a; return args['theme'] === ((_a = config.theme) !== null && _a !== void 0 ? _a : extensions.baseConfiguration.theme); }
470
+ isToggled: args => { var _a; return args['theme'] === ((_a = config.theme) !== null && _a !== void 0 ? _a : extensions.baseConfiguration.theme); },
471
+ describedBy: {
472
+ args: {
473
+ type: 'object',
474
+ properties: {
475
+ theme: {
476
+ type: 'string',
477
+ description: trans.__('The theme name to change to')
478
+ },
479
+ displayName: {
480
+ type: 'string',
481
+ description: trans.__('The display name of the theme')
482
+ }
483
+ }
484
+ }
485
+ }
385
486
  });
386
487
  commands.addCommand(CommandIDs.find, {
387
488
  label: trans.__('Find…'),
@@ -393,7 +494,13 @@ export var Commands;
393
494
  const editor = widget.content.editor;
394
495
  editor.execCommand(findNext);
395
496
  },
396
- isEnabled
497
+ isEnabled,
498
+ describedBy: {
499
+ args: {
500
+ type: 'object',
501
+ properties: {}
502
+ }
503
+ }
397
504
  });
398
505
  commands.addCommand(CommandIDs.goToLine, {
399
506
  label: trans.__('Go to Line…'),
@@ -415,7 +522,22 @@ export var Commands;
415
522
  editor.execCommand(gotoLine);
416
523
  }
417
524
  },
418
- isEnabled
525
+ isEnabled,
526
+ describedBy: {
527
+ args: {
528
+ type: 'object',
529
+ properties: {
530
+ line: {
531
+ type: 'number',
532
+ description: trans.__('The line number to go to (1-indexed)')
533
+ },
534
+ column: {
535
+ type: 'number',
536
+ description: trans.__('The column number to go to (1-indexed)')
537
+ }
538
+ }
539
+ }
540
+ }
419
541
  });
420
542
  commands.addCommand(CommandIDs.changeLanguage, {
421
543
  label: args => {
@@ -449,6 +571,21 @@ export var Commands;
449
571
  const spec = languages.findByMIME(mime);
450
572
  const name = spec && spec.name;
451
573
  return args['name'] === name;
574
+ },
575
+ describedBy: {
576
+ args: {
577
+ type: 'object',
578
+ properties: {
579
+ name: {
580
+ type: 'string',
581
+ description: trans.__('The language name to change to')
582
+ },
583
+ displayName: {
584
+ type: 'string',
585
+ description: trans.__('The display name of the language')
586
+ }
587
+ }
588
+ }
452
589
  }
453
590
  });
454
591
  /**
@@ -465,7 +602,18 @@ export var Commands;
465
602
  (_b = (_a = widget.content.editor).replaceSelection) === null || _b === void 0 ? void 0 : _b.call(_a, text);
466
603
  },
467
604
  isEnabled,
468
- label: trans.__('Replace Selection in Editor')
605
+ label: trans.__('Replace Selection in Editor'),
606
+ describedBy: {
607
+ args: {
608
+ type: 'object',
609
+ properties: {
610
+ text: {
611
+ type: 'string',
612
+ description: trans.__('The text to replace the current selection with')
613
+ }
614
+ }
615
+ }
616
+ }
469
617
  });
470
618
  /**
471
619
  * Add the Create Console for Editor command
@@ -480,7 +628,13 @@ export var Commands;
480
628
  },
481
629
  isEnabled,
482
630
  icon: consoleIcon,
483
- label: trans.__('Create Console for Editor')
631
+ label: trans.__('Create Console for Editor'),
632
+ describedBy: {
633
+ args: {
634
+ type: 'object',
635
+ properties: {}
636
+ }
637
+ }
484
638
  });
485
639
  /**
486
640
  * Restart the Console Kernel linked to the current Editor
@@ -498,7 +652,13 @@ export var Commands;
498
652
  }
499
653
  },
500
654
  label: trans.__('Restart Kernel'),
501
- isEnabled: () => consoleTracker !== null && isEnabled()
655
+ isEnabled: () => consoleTracker !== null && isEnabled(),
656
+ describedBy: {
657
+ args: {
658
+ type: 'object',
659
+ properties: {}
660
+ }
661
+ }
502
662
  });
503
663
  /**
504
664
  * Add the Run Code command
@@ -557,7 +717,13 @@ export var Commands;
557
717
  }
558
718
  },
559
719
  isEnabled,
560
- label: trans.__('Run Selected Code')
720
+ label: trans.__('Run Selected Code'),
721
+ describedBy: {
722
+ args: {
723
+ type: 'object',
724
+ properties: {}
725
+ }
726
+ }
561
727
  });
562
728
  /**
563
729
  * Add the Run All Code command
@@ -593,7 +759,13 @@ export var Commands;
593
759
  }
594
760
  },
595
761
  isEnabled,
596
- label: trans.__('Run All Code')
762
+ label: trans.__('Run All Code'),
763
+ describedBy: {
764
+ args: {
765
+ type: 'object',
766
+ properties: {}
767
+ }
768
+ }
597
769
  });
598
770
  /**
599
771
  * Add markdown preview command
@@ -617,7 +789,13 @@ export var Commands;
617
789
  return ((widget && PathExt.extname(widget.context.path) === '.md') || false);
618
790
  },
619
791
  icon: markdownIcon,
620
- label: trans.__('Show Markdown Preview')
792
+ label: trans.__('Show Markdown Preview'),
793
+ describedBy: {
794
+ args: {
795
+ type: 'object',
796
+ properties: {}
797
+ }
798
+ }
621
799
  });
622
800
  /**
623
801
  * Add the New File command
@@ -645,6 +823,41 @@ export var Commands;
645
823
  var _a;
646
824
  const cwd = args.cwd || defaultBrowser.model.path;
647
825
  return createNew(commands, cwd, (_a = args.fileExt) !== null && _a !== void 0 ? _a : 'txt');
826
+ },
827
+ describedBy: {
828
+ args: {
829
+ type: 'object',
830
+ properties: {
831
+ cwd: {
832
+ type: 'string',
833
+ description: trans.__('The current working directory path')
834
+ },
835
+ fileExt: {
836
+ type: 'string',
837
+ description: trans.__('The file extension for the new file')
838
+ },
839
+ isPalette: {
840
+ type: 'boolean',
841
+ description: 'Whether the command is being called from the command palette'
842
+ },
843
+ paletteLabel: {
844
+ type: 'string',
845
+ description: trans.__('The label to show in the command palette')
846
+ },
847
+ launcherLabel: {
848
+ type: 'string',
849
+ description: trans.__('The label to show in the launcher')
850
+ },
851
+ caption: {
852
+ type: 'string',
853
+ description: trans.__('The caption for the command')
854
+ },
855
+ iconName: {
856
+ type: 'string',
857
+ description: trans.__('The name of the icon to use')
858
+ }
859
+ }
860
+ }
648
861
  }
649
862
  });
650
863
  /**
@@ -659,6 +872,21 @@ export var Commands;
659
872
  execute: args => {
660
873
  const cwd = args['cwd'] || defaultBrowser.model.path;
661
874
  return createNew(commands, cwd, 'md');
875
+ },
876
+ describedBy: {
877
+ args: {
878
+ type: 'object',
879
+ properties: {
880
+ cwd: {
881
+ type: 'string',
882
+ description: trans.__('The current working directory path')
883
+ },
884
+ isPalette: {
885
+ type: 'boolean',
886
+ description: 'Whether the command is being called from the command palette'
887
+ }
888
+ }
889
+ }
662
890
  }
663
891
  });
664
892
  /**
@@ -685,7 +913,13 @@ export var Commands;
685
913
  return widget.editor.model.sharedModel.canUndo();
686
914
  },
687
915
  icon: undoIcon.bindprops({ stylesheet: 'menuItem' }),
688
- label: trans.__('Undo')
916
+ label: trans.__('Undo'),
917
+ describedBy: {
918
+ args: {
919
+ type: 'object',
920
+ properties: {}
921
+ }
922
+ }
689
923
  });
690
924
  /**
691
925
  * Add redo command
@@ -711,7 +945,13 @@ export var Commands;
711
945
  return widget.editor.model.sharedModel.canRedo();
712
946
  },
713
947
  icon: redoIcon.bindprops({ stylesheet: 'menuItem' }),
714
- label: trans.__('Redo')
948
+ label: trans.__('Redo'),
949
+ describedBy: {
950
+ args: {
951
+ type: 'object',
952
+ properties: {}
953
+ }
954
+ }
715
955
  });
716
956
  /**
717
957
  * Add cut command
@@ -741,7 +981,13 @@ export var Commands;
741
981
  return isSelected(widget.editor);
742
982
  },
743
983
  icon: cutIcon.bindprops({ stylesheet: 'menuItem' }),
744
- label: trans.__('Cut')
984
+ label: trans.__('Cut'),
985
+ describedBy: {
986
+ args: {
987
+ type: 'object',
988
+ properties: {}
989
+ }
990
+ }
745
991
  });
746
992
  /**
747
993
  * Add copy command
@@ -770,7 +1016,13 @@ export var Commands;
770
1016
  return isSelected(widget.editor);
771
1017
  },
772
1018
  icon: copyIcon.bindprops({ stylesheet: 'menuItem' }),
773
- label: trans.__('Copy')
1019
+ label: trans.__('Copy'),
1020
+ describedBy: {
1021
+ args: {
1022
+ type: 'object',
1023
+ properties: {}
1024
+ }
1025
+ }
774
1026
  });
775
1027
  /**
776
1028
  * Add paste command
@@ -793,7 +1045,13 @@ export var Commands;
793
1045
  },
794
1046
  isEnabled: () => { var _a; return Boolean(isEnabled() && ((_a = tracker.currentWidget) === null || _a === void 0 ? void 0 : _a.content)); },
795
1047
  icon: pasteIcon.bindprops({ stylesheet: 'menuItem' }),
796
- label: trans.__('Paste')
1048
+ label: trans.__('Paste'),
1049
+ describedBy: {
1050
+ args: {
1051
+ type: 'object',
1052
+ properties: {}
1053
+ }
1054
+ }
797
1055
  });
798
1056
  /**
799
1057
  * Add select all command
@@ -809,7 +1067,13 @@ export var Commands;
809
1067
  editor.execCommand(selectAll);
810
1068
  },
811
1069
  isEnabled: () => { var _a; return Boolean(isEnabled() && ((_a = tracker.currentWidget) === null || _a === void 0 ? void 0 : _a.content)); },
812
- label: trans.__('Select All')
1070
+ label: trans.__('Select All'),
1071
+ describedBy: {
1072
+ args: {
1073
+ type: 'object',
1074
+ properties: {}
1075
+ }
1076
+ }
813
1077
  });
814
1078
  // All commands with isEnabled defined directly or in a semantic commands
815
1079
  const commandIds = [
@@ -851,6 +1115,12 @@ export var Commands;
851
1115
  if (id) {
852
1116
  return manager.invoke(id);
853
1117
  }
1118
+ },
1119
+ describedBy: {
1120
+ args: {
1121
+ type: 'object',
1122
+ properties: {}
1123
+ }
854
1124
  }
855
1125
  });
856
1126
  commands.addCommand(CommandIDs.selectCompleter, {
@@ -860,6 +1130,12 @@ export var Commands;
860
1130
  if (id) {
861
1131
  return manager.select(id);
862
1132
  }
1133
+ },
1134
+ describedBy: {
1135
+ args: {
1136
+ type: 'object',
1137
+ properties: {}
1138
+ }
863
1139
  }
864
1140
  });
865
1141
  commands.addKeyBinding({
@@ -938,16 +1214,19 @@ export var Commands;
938
1214
  Commands.addCreateNewMarkdownToLauncher = addCreateNewMarkdownToLauncher;
939
1215
  /**
940
1216
  * Add ___ File items to the Launcher for common file types associated with available kernels
1217
+ * Returns a DisposableSet containing all added items
941
1218
  */
942
1219
  function addKernelLanguageLauncherItems(launcher, trans, availableKernelFileTypes) {
943
- for (let ext of availableKernelFileTypes) {
944
- launcher.add({
1220
+ const disposables = new DisposableSet();
1221
+ for (const ext of availableKernelFileTypes) {
1222
+ disposables.add(launcher.add({
945
1223
  command: CommandIDs.createNew,
946
1224
  category: trans.__('Other'),
947
1225
  rank: 3,
948
1226
  args: ext
949
- });
1227
+ }));
950
1228
  }
1229
+ return disposables;
951
1230
  }
952
1231
  Commands.addKernelLanguageLauncherItems = addKernelLanguageLauncherItems;
953
1232
  /**
@@ -1016,16 +1295,19 @@ export var Commands;
1016
1295
  Commands.addChangeFontSizeCommandsToPalette = addChangeFontSizeCommandsToPalette;
1017
1296
  /**
1018
1297
  * Add New ___ File commands to the File Editor palette for common file types associated with available kernels
1298
+ * Returns a DisposableSet containing all added items
1019
1299
  */
1020
1300
  function addKernelLanguagePaletteItems(palette, trans, availableKernelFileTypes) {
1301
+ const disposables = new DisposableSet();
1021
1302
  const paletteCategory = trans.__('Text Editor');
1022
- for (let ext of availableKernelFileTypes) {
1023
- palette.addItem({
1303
+ for (const ext of availableKernelFileTypes) {
1304
+ disposables.add(palette.addItem({
1024
1305
  command: CommandIDs.createNew,
1025
1306
  args: { ...ext, isPalette: true },
1026
1307
  category: paletteCategory
1027
- });
1308
+ }));
1028
1309
  }
1310
+ return disposables;
1029
1311
  }
1030
1312
  Commands.addKernelLanguagePaletteItems = addKernelLanguagePaletteItems;
1031
1313
  /**
@@ -1067,15 +1349,18 @@ export var Commands;
1067
1349
  Commands.addMenuItems = addMenuItems;
1068
1350
  /**
1069
1351
  * Add Create New ___ File commands to the File menu for common file types associated with available kernels
1352
+ * Returns a DisposableSet containing all added items
1070
1353
  */
1071
1354
  function addKernelLanguageMenuItems(menu, availableKernelFileTypes) {
1072
- for (let ext of availableKernelFileTypes) {
1073
- menu.fileMenu.newMenu.addItem({
1355
+ const disposables = new DisposableSet();
1356
+ for (const ext of availableKernelFileTypes) {
1357
+ disposables.add(menu.fileMenu.newMenu.addItem({
1074
1358
  command: CommandIDs.createNew,
1075
1359
  args: ext,
1076
1360
  rank: 31
1077
- });
1361
+ }));
1078
1362
  }
1363
+ return disposables;
1079
1364
  }
1080
1365
  Commands.addKernelLanguageMenuItems = addKernelLanguageMenuItems;
1081
1366
  /**
@@ -1133,6 +1418,34 @@ export var Commands;
1133
1418
  label: trans.__('Open Code Viewer'),
1134
1419
  execute: (args) => {
1135
1420
  return openCodeViewer(args);
1421
+ },
1422
+ describedBy: {
1423
+ args: {
1424
+ type: 'object',
1425
+ properties: {
1426
+ content: {
1427
+ type: 'string',
1428
+ description: trans.__('The content to display in the code viewer')
1429
+ },
1430
+ label: {
1431
+ type: 'string',
1432
+ description: trans.__('The label for the code viewer')
1433
+ },
1434
+ mimeType: {
1435
+ type: 'string',
1436
+ description: trans.__('The MIME type of the content')
1437
+ },
1438
+ extension: {
1439
+ type: 'string',
1440
+ description: trans.__('The file extension to derive MIME type from')
1441
+ },
1442
+ widgetId: {
1443
+ type: 'string',
1444
+ description: trans.__('The ID to assign to the widget')
1445
+ }
1446
+ },
1447
+ required: ['content']
1448
+ }
1136
1449
  }
1137
1450
  });
1138
1451
  }