@jupyterlab/fileeditor-extension 4.5.0-alpha.1 → 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.js CHANGED
@@ -167,6 +167,22 @@ export var Commands;
167
167
  ? trans.__('Decrease Text Editor Font Size')
168
168
  : trans.__('Decrease Font Size');
169
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
+ }
170
186
  }
171
187
  });
172
188
  /**
@@ -185,7 +201,13 @@ export var Commands;
185
201
  },
186
202
  isEnabled,
187
203
  isToggled: () => { var _a; return (_a = config.lineNumbers) !== null && _a !== void 0 ? _a : extensions.baseConfiguration.lineNumbers; },
188
- label: trans.__('Show Line Numbers')
204
+ label: trans.__('Show Line Numbers'),
205
+ describedBy: {
206
+ args: {
207
+ type: 'object',
208
+ properties: {}
209
+ }
210
+ }
189
211
  });
190
212
  commands.addCommand(CommandIDs.currentLineNumbers, {
191
213
  label: trans.__('Show Line Numbers'),
@@ -203,6 +225,12 @@ export var Commands;
203
225
  var _a;
204
226
  const widget = tracker.currentWidget;
205
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
+ }
206
234
  }
207
235
  });
208
236
  /**
@@ -226,7 +254,18 @@ export var Commands;
226
254
  return (lineWrap ===
227
255
  ((_b = config.lineWrap) !== null && _b !== void 0 ? _b : extensions.baseConfiguration.lineWrap));
228
256
  },
229
- 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
+ }
230
269
  });
231
270
  commands.addCommand(CommandIDs.currentLineWrap, {
232
271
  label: trans.__('Wrap Words'),
@@ -244,6 +283,12 @@ export var Commands;
244
283
  var _a;
245
284
  const widget = tracker.currentWidget;
246
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
+ }
247
292
  }
248
293
  });
249
294
  /**
@@ -279,6 +324,17 @@ export var Commands;
279
324
  return args['size']
280
325
  ? args['size'] === currentIndentUnit
281
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
+ }
282
338
  }
283
339
  });
284
340
  /**
@@ -297,7 +353,13 @@ export var Commands;
297
353
  },
298
354
  label: trans.__('Match Brackets'),
299
355
  isEnabled,
300
- 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
+ }
301
363
  });
302
364
  commands.addCommand(CommandIDs.currentMatchBrackets, {
303
365
  label: trans.__('Match Brackets'),
@@ -315,6 +377,12 @@ export var Commands;
315
377
  var _a;
316
378
  const widget = tracker.currentWidget;
317
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
+ }
318
386
  }
319
387
  });
320
388
  /**
@@ -335,6 +403,17 @@ export var Commands;
335
403
  isToggled: () => {
336
404
  var _a;
337
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
+ }
338
417
  }
339
418
  });
340
419
  commands.addCommand(CommandIDs.autoClosingBracketsUniversal, {
@@ -362,7 +441,13 @@ export var Commands;
362
441
  label: trans.__('Auto Close Brackets'),
363
442
  isToggled: () => commands.isToggled(CommandIDs.autoClosingBrackets) ||
364
443
  commands.isToggled(autoClosingBracketsNotebook) ||
365
- commands.isToggled(autoClosingBracketsConsole)
444
+ commands.isToggled(autoClosingBracketsConsole),
445
+ describedBy: {
446
+ args: {
447
+ type: 'object',
448
+ properties: {}
449
+ }
450
+ }
366
451
  });
367
452
  /**
368
453
  * Create a menu for the editor.
@@ -382,7 +467,22 @@ export var Commands;
382
467
  console.error(`Failed to set theme - ${reason.message}`);
383
468
  }
384
469
  },
385
- 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
+ }
386
486
  });
387
487
  commands.addCommand(CommandIDs.find, {
388
488
  label: trans.__('Find…'),
@@ -394,7 +494,13 @@ export var Commands;
394
494
  const editor = widget.content.editor;
395
495
  editor.execCommand(findNext);
396
496
  },
397
- isEnabled
497
+ isEnabled,
498
+ describedBy: {
499
+ args: {
500
+ type: 'object',
501
+ properties: {}
502
+ }
503
+ }
398
504
  });
399
505
  commands.addCommand(CommandIDs.goToLine, {
400
506
  label: trans.__('Go to Line…'),
@@ -416,7 +522,22 @@ export var Commands;
416
522
  editor.execCommand(gotoLine);
417
523
  }
418
524
  },
419
- 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
+ }
420
541
  });
421
542
  commands.addCommand(CommandIDs.changeLanguage, {
422
543
  label: args => {
@@ -450,6 +571,21 @@ export var Commands;
450
571
  const spec = languages.findByMIME(mime);
451
572
  const name = spec && spec.name;
452
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
+ }
453
589
  }
454
590
  });
455
591
  /**
@@ -466,7 +602,18 @@ export var Commands;
466
602
  (_b = (_a = widget.content.editor).replaceSelection) === null || _b === void 0 ? void 0 : _b.call(_a, text);
467
603
  },
468
604
  isEnabled,
469
- 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
+ }
470
617
  });
471
618
  /**
472
619
  * Add the Create Console for Editor command
@@ -481,7 +628,13 @@ export var Commands;
481
628
  },
482
629
  isEnabled,
483
630
  icon: consoleIcon,
484
- label: trans.__('Create Console for Editor')
631
+ label: trans.__('Create Console for Editor'),
632
+ describedBy: {
633
+ args: {
634
+ type: 'object',
635
+ properties: {}
636
+ }
637
+ }
485
638
  });
486
639
  /**
487
640
  * Restart the Console Kernel linked to the current Editor
@@ -499,7 +652,13 @@ export var Commands;
499
652
  }
500
653
  },
501
654
  label: trans.__('Restart Kernel'),
502
- isEnabled: () => consoleTracker !== null && isEnabled()
655
+ isEnabled: () => consoleTracker !== null && isEnabled(),
656
+ describedBy: {
657
+ args: {
658
+ type: 'object',
659
+ properties: {}
660
+ }
661
+ }
503
662
  });
504
663
  /**
505
664
  * Add the Run Code command
@@ -558,7 +717,13 @@ export var Commands;
558
717
  }
559
718
  },
560
719
  isEnabled,
561
- label: trans.__('Run Selected Code')
720
+ label: trans.__('Run Selected Code'),
721
+ describedBy: {
722
+ args: {
723
+ type: 'object',
724
+ properties: {}
725
+ }
726
+ }
562
727
  });
563
728
  /**
564
729
  * Add the Run All Code command
@@ -594,7 +759,13 @@ export var Commands;
594
759
  }
595
760
  },
596
761
  isEnabled,
597
- label: trans.__('Run All Code')
762
+ label: trans.__('Run All Code'),
763
+ describedBy: {
764
+ args: {
765
+ type: 'object',
766
+ properties: {}
767
+ }
768
+ }
598
769
  });
599
770
  /**
600
771
  * Add markdown preview command
@@ -618,7 +789,13 @@ export var Commands;
618
789
  return ((widget && PathExt.extname(widget.context.path) === '.md') || false);
619
790
  },
620
791
  icon: markdownIcon,
621
- label: trans.__('Show Markdown Preview')
792
+ label: trans.__('Show Markdown Preview'),
793
+ describedBy: {
794
+ args: {
795
+ type: 'object',
796
+ properties: {}
797
+ }
798
+ }
622
799
  });
623
800
  /**
624
801
  * Add the New File command
@@ -646,6 +823,41 @@ export var Commands;
646
823
  var _a;
647
824
  const cwd = args.cwd || defaultBrowser.model.path;
648
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
+ }
649
861
  }
650
862
  });
651
863
  /**
@@ -660,6 +872,21 @@ export var Commands;
660
872
  execute: args => {
661
873
  const cwd = args['cwd'] || defaultBrowser.model.path;
662
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
+ }
663
890
  }
664
891
  });
665
892
  /**
@@ -686,7 +913,13 @@ export var Commands;
686
913
  return widget.editor.model.sharedModel.canUndo();
687
914
  },
688
915
  icon: undoIcon.bindprops({ stylesheet: 'menuItem' }),
689
- label: trans.__('Undo')
916
+ label: trans.__('Undo'),
917
+ describedBy: {
918
+ args: {
919
+ type: 'object',
920
+ properties: {}
921
+ }
922
+ }
690
923
  });
691
924
  /**
692
925
  * Add redo command
@@ -712,7 +945,13 @@ export var Commands;
712
945
  return widget.editor.model.sharedModel.canRedo();
713
946
  },
714
947
  icon: redoIcon.bindprops({ stylesheet: 'menuItem' }),
715
- label: trans.__('Redo')
948
+ label: trans.__('Redo'),
949
+ describedBy: {
950
+ args: {
951
+ type: 'object',
952
+ properties: {}
953
+ }
954
+ }
716
955
  });
717
956
  /**
718
957
  * Add cut command
@@ -742,7 +981,13 @@ export var Commands;
742
981
  return isSelected(widget.editor);
743
982
  },
744
983
  icon: cutIcon.bindprops({ stylesheet: 'menuItem' }),
745
- label: trans.__('Cut')
984
+ label: trans.__('Cut'),
985
+ describedBy: {
986
+ args: {
987
+ type: 'object',
988
+ properties: {}
989
+ }
990
+ }
746
991
  });
747
992
  /**
748
993
  * Add copy command
@@ -771,7 +1016,13 @@ export var Commands;
771
1016
  return isSelected(widget.editor);
772
1017
  },
773
1018
  icon: copyIcon.bindprops({ stylesheet: 'menuItem' }),
774
- label: trans.__('Copy')
1019
+ label: trans.__('Copy'),
1020
+ describedBy: {
1021
+ args: {
1022
+ type: 'object',
1023
+ properties: {}
1024
+ }
1025
+ }
775
1026
  });
776
1027
  /**
777
1028
  * Add paste command
@@ -794,7 +1045,13 @@ export var Commands;
794
1045
  },
795
1046
  isEnabled: () => { var _a; return Boolean(isEnabled() && ((_a = tracker.currentWidget) === null || _a === void 0 ? void 0 : _a.content)); },
796
1047
  icon: pasteIcon.bindprops({ stylesheet: 'menuItem' }),
797
- label: trans.__('Paste')
1048
+ label: trans.__('Paste'),
1049
+ describedBy: {
1050
+ args: {
1051
+ type: 'object',
1052
+ properties: {}
1053
+ }
1054
+ }
798
1055
  });
799
1056
  /**
800
1057
  * Add select all command
@@ -810,7 +1067,13 @@ export var Commands;
810
1067
  editor.execCommand(selectAll);
811
1068
  },
812
1069
  isEnabled: () => { var _a; return Boolean(isEnabled() && ((_a = tracker.currentWidget) === null || _a === void 0 ? void 0 : _a.content)); },
813
- label: trans.__('Select All')
1070
+ label: trans.__('Select All'),
1071
+ describedBy: {
1072
+ args: {
1073
+ type: 'object',
1074
+ properties: {}
1075
+ }
1076
+ }
814
1077
  });
815
1078
  // All commands with isEnabled defined directly or in a semantic commands
816
1079
  const commandIds = [
@@ -852,6 +1115,12 @@ export var Commands;
852
1115
  if (id) {
853
1116
  return manager.invoke(id);
854
1117
  }
1118
+ },
1119
+ describedBy: {
1120
+ args: {
1121
+ type: 'object',
1122
+ properties: {}
1123
+ }
855
1124
  }
856
1125
  });
857
1126
  commands.addCommand(CommandIDs.selectCompleter, {
@@ -861,6 +1130,12 @@ export var Commands;
861
1130
  if (id) {
862
1131
  return manager.select(id);
863
1132
  }
1133
+ },
1134
+ describedBy: {
1135
+ args: {
1136
+ type: 'object',
1137
+ properties: {}
1138
+ }
864
1139
  }
865
1140
  });
866
1141
  commands.addKeyBinding({
@@ -1143,6 +1418,34 @@ export var Commands;
1143
1418
  label: trans.__('Open Code Viewer'),
1144
1419
  execute: (args) => {
1145
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
+ }
1146
1449
  }
1147
1450
  });
1148
1451
  }