@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 +7 -3
- package/lib/commands.js +341 -28
- package/lib/commands.js.map +1 -1
- package/lib/index.js +44 -14
- package/lib/index.js.map +1 -1
- package/package.json +25 -23
- package/src/commands.ts +381 -42
- package/src/index.ts +61 -24
- package/style/index.css +1 -0
- package/style/index.js +1 -0
package/src/commands.ts
CHANGED
|
@@ -53,6 +53,7 @@ import {
|
|
|
53
53
|
ReadonlyJSONObject,
|
|
54
54
|
ReadonlyPartialJSONObject
|
|
55
55
|
} from '@lumino/coreutils';
|
|
56
|
+
import { DisposableSet, IDisposable } from '@lumino/disposable';
|
|
56
57
|
|
|
57
58
|
const autoClosingBracketsNotebook = 'notebook:toggle-autoclosing-brackets';
|
|
58
59
|
const autoClosingBracketsConsole = 'console:toggle-autoclosing-brackets';
|
|
@@ -288,6 +289,26 @@ export namespace Commands {
|
|
|
288
289
|
? trans.__('Decrease Text Editor Font Size')
|
|
289
290
|
: trans.__('Decrease Font Size');
|
|
290
291
|
}
|
|
292
|
+
},
|
|
293
|
+
describedBy: {
|
|
294
|
+
args: {
|
|
295
|
+
type: 'object',
|
|
296
|
+
properties: {
|
|
297
|
+
delta: {
|
|
298
|
+
type: 'number',
|
|
299
|
+
description: trans.__(
|
|
300
|
+
'The font size change delta (positive to increase, negative to decrease)'
|
|
301
|
+
)
|
|
302
|
+
},
|
|
303
|
+
isMenu: {
|
|
304
|
+
type: 'boolean',
|
|
305
|
+
description: trans.__(
|
|
306
|
+
'Whether the command is called from a menu context'
|
|
307
|
+
)
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
required: ['delta']
|
|
311
|
+
}
|
|
291
312
|
}
|
|
292
313
|
});
|
|
293
314
|
|
|
@@ -308,7 +329,13 @@ export namespace Commands {
|
|
|
308
329
|
isEnabled,
|
|
309
330
|
isToggled: () =>
|
|
310
331
|
config.lineNumbers ?? extensions.baseConfiguration.lineNumbers,
|
|
311
|
-
label: trans.__('Show Line Numbers')
|
|
332
|
+
label: trans.__('Show Line Numbers'),
|
|
333
|
+
describedBy: {
|
|
334
|
+
args: {
|
|
335
|
+
type: 'object',
|
|
336
|
+
properties: {}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
312
339
|
});
|
|
313
340
|
|
|
314
341
|
commands.addCommand(CommandIDs.currentLineNumbers, {
|
|
@@ -330,6 +357,12 @@ export namespace Commands {
|
|
|
330
357
|
| boolean
|
|
331
358
|
| undefined) ?? false
|
|
332
359
|
);
|
|
360
|
+
},
|
|
361
|
+
describedBy: {
|
|
362
|
+
args: {
|
|
363
|
+
type: 'object',
|
|
364
|
+
properties: {}
|
|
365
|
+
}
|
|
333
366
|
}
|
|
334
367
|
});
|
|
335
368
|
|
|
@@ -353,7 +386,18 @@ export namespace Commands {
|
|
|
353
386
|
(config.lineWrap ?? extensions.baseConfiguration.lineWrap)
|
|
354
387
|
);
|
|
355
388
|
},
|
|
356
|
-
label: trans.__('Word Wrap')
|
|
389
|
+
label: trans.__('Word Wrap'),
|
|
390
|
+
describedBy: {
|
|
391
|
+
args: {
|
|
392
|
+
type: 'object',
|
|
393
|
+
properties: {
|
|
394
|
+
mode: {
|
|
395
|
+
type: 'boolean',
|
|
396
|
+
description: trans.__('Whether to enable word wrap')
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
357
401
|
});
|
|
358
402
|
|
|
359
403
|
commands.addCommand(CommandIDs.currentLineWrap, {
|
|
@@ -373,6 +417,12 @@ export namespace Commands {
|
|
|
373
417
|
return (
|
|
374
418
|
(widget?.content.editor.getOption('lineWrap') as boolean) ?? false
|
|
375
419
|
);
|
|
420
|
+
},
|
|
421
|
+
describedBy: {
|
|
422
|
+
args: {
|
|
423
|
+
type: 'object',
|
|
424
|
+
properties: {}
|
|
425
|
+
}
|
|
376
426
|
}
|
|
377
427
|
});
|
|
378
428
|
|
|
@@ -406,6 +456,19 @@ export namespace Commands {
|
|
|
406
456
|
return args['size']
|
|
407
457
|
? args['size'] === currentIndentUnit
|
|
408
458
|
: 'Tab' == currentIndentUnit;
|
|
459
|
+
},
|
|
460
|
+
describedBy: {
|
|
461
|
+
args: {
|
|
462
|
+
type: 'object',
|
|
463
|
+
properties: {
|
|
464
|
+
size: {
|
|
465
|
+
type: 'string',
|
|
466
|
+
description: trans.__(
|
|
467
|
+
'The number of spaces for indentation (or Tab for tab indentation)'
|
|
468
|
+
)
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
409
472
|
}
|
|
410
473
|
});
|
|
411
474
|
|
|
@@ -426,7 +489,13 @@ export namespace Commands {
|
|
|
426
489
|
label: trans.__('Match Brackets'),
|
|
427
490
|
isEnabled,
|
|
428
491
|
isToggled: () =>
|
|
429
|
-
config.matchBrackets ?? extensions.baseConfiguration.matchBrackets
|
|
492
|
+
config.matchBrackets ?? extensions.baseConfiguration.matchBrackets,
|
|
493
|
+
describedBy: {
|
|
494
|
+
args: {
|
|
495
|
+
type: 'object',
|
|
496
|
+
properties: {}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
430
499
|
});
|
|
431
500
|
|
|
432
501
|
commands.addCommand(CommandIDs.currentMatchBrackets, {
|
|
@@ -448,6 +517,12 @@ export namespace Commands {
|
|
|
448
517
|
| boolean
|
|
449
518
|
| undefined) ?? false
|
|
450
519
|
);
|
|
520
|
+
},
|
|
521
|
+
describedBy: {
|
|
522
|
+
args: {
|
|
523
|
+
type: 'object',
|
|
524
|
+
properties: {}
|
|
525
|
+
}
|
|
451
526
|
}
|
|
452
527
|
});
|
|
453
528
|
|
|
@@ -472,7 +547,20 @@ export namespace Commands {
|
|
|
472
547
|
label: trans.__('Auto Close Brackets in Text Editor'),
|
|
473
548
|
isToggled: () =>
|
|
474
549
|
config.autoClosingBrackets ??
|
|
475
|
-
extensions.baseConfiguration.autoClosingBrackets
|
|
550
|
+
extensions.baseConfiguration.autoClosingBrackets,
|
|
551
|
+
describedBy: {
|
|
552
|
+
args: {
|
|
553
|
+
type: 'object',
|
|
554
|
+
properties: {
|
|
555
|
+
force: {
|
|
556
|
+
type: 'boolean',
|
|
557
|
+
description: trans.__(
|
|
558
|
+
'Force enable/disable auto closing brackets'
|
|
559
|
+
)
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
476
564
|
});
|
|
477
565
|
|
|
478
566
|
commands.addCommand(CommandIDs.autoClosingBracketsUniversal, {
|
|
@@ -501,7 +589,13 @@ export namespace Commands {
|
|
|
501
589
|
isToggled: () =>
|
|
502
590
|
commands.isToggled(CommandIDs.autoClosingBrackets) ||
|
|
503
591
|
commands.isToggled(autoClosingBracketsNotebook) ||
|
|
504
|
-
commands.isToggled(autoClosingBracketsConsole)
|
|
592
|
+
commands.isToggled(autoClosingBracketsConsole),
|
|
593
|
+
describedBy: {
|
|
594
|
+
args: {
|
|
595
|
+
type: 'object',
|
|
596
|
+
properties: {}
|
|
597
|
+
}
|
|
598
|
+
}
|
|
505
599
|
});
|
|
506
600
|
|
|
507
601
|
/**
|
|
@@ -523,7 +617,22 @@ export namespace Commands {
|
|
|
523
617
|
}
|
|
524
618
|
},
|
|
525
619
|
isToggled: args =>
|
|
526
|
-
args['theme'] === (config.theme ?? extensions.baseConfiguration.theme)
|
|
620
|
+
args['theme'] === (config.theme ?? extensions.baseConfiguration.theme),
|
|
621
|
+
describedBy: {
|
|
622
|
+
args: {
|
|
623
|
+
type: 'object',
|
|
624
|
+
properties: {
|
|
625
|
+
theme: {
|
|
626
|
+
type: 'string',
|
|
627
|
+
description: trans.__('The theme name to change to')
|
|
628
|
+
},
|
|
629
|
+
displayName: {
|
|
630
|
+
type: 'string',
|
|
631
|
+
description: trans.__('The display name of the theme')
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
527
636
|
});
|
|
528
637
|
|
|
529
638
|
commands.addCommand(CommandIDs.find, {
|
|
@@ -536,7 +645,13 @@ export namespace Commands {
|
|
|
536
645
|
const editor = widget.content.editor as CodeMirrorEditor;
|
|
537
646
|
editor.execCommand(findNext);
|
|
538
647
|
},
|
|
539
|
-
isEnabled
|
|
648
|
+
isEnabled,
|
|
649
|
+
describedBy: {
|
|
650
|
+
args: {
|
|
651
|
+
type: 'object',
|
|
652
|
+
properties: {}
|
|
653
|
+
}
|
|
654
|
+
}
|
|
540
655
|
});
|
|
541
656
|
|
|
542
657
|
commands.addCommand(CommandIDs.goToLine, {
|
|
@@ -559,7 +674,22 @@ export namespace Commands {
|
|
|
559
674
|
editor.execCommand(gotoLine);
|
|
560
675
|
}
|
|
561
676
|
},
|
|
562
|
-
isEnabled
|
|
677
|
+
isEnabled,
|
|
678
|
+
describedBy: {
|
|
679
|
+
args: {
|
|
680
|
+
type: 'object',
|
|
681
|
+
properties: {
|
|
682
|
+
line: {
|
|
683
|
+
type: 'number',
|
|
684
|
+
description: trans.__('The line number to go to (1-indexed)')
|
|
685
|
+
},
|
|
686
|
+
column: {
|
|
687
|
+
type: 'number',
|
|
688
|
+
description: trans.__('The column number to go to (1-indexed)')
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
}
|
|
563
693
|
});
|
|
564
694
|
|
|
565
695
|
commands.addCommand(CommandIDs.changeLanguage, {
|
|
@@ -592,6 +722,21 @@ export namespace Commands {
|
|
|
592
722
|
const spec = languages.findByMIME(mime);
|
|
593
723
|
const name = spec && spec.name;
|
|
594
724
|
return args['name'] === name;
|
|
725
|
+
},
|
|
726
|
+
describedBy: {
|
|
727
|
+
args: {
|
|
728
|
+
type: 'object',
|
|
729
|
+
properties: {
|
|
730
|
+
name: {
|
|
731
|
+
type: 'string',
|
|
732
|
+
description: trans.__('The language name to change to')
|
|
733
|
+
},
|
|
734
|
+
displayName: {
|
|
735
|
+
type: 'string',
|
|
736
|
+
description: trans.__('The display name of the language')
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
}
|
|
595
740
|
}
|
|
596
741
|
});
|
|
597
742
|
|
|
@@ -609,7 +754,20 @@ export namespace Commands {
|
|
|
609
754
|
widget.content.editor.replaceSelection?.(text);
|
|
610
755
|
},
|
|
611
756
|
isEnabled,
|
|
612
|
-
label: trans.__('Replace Selection in Editor')
|
|
757
|
+
label: trans.__('Replace Selection in Editor'),
|
|
758
|
+
describedBy: {
|
|
759
|
+
args: {
|
|
760
|
+
type: 'object',
|
|
761
|
+
properties: {
|
|
762
|
+
text: {
|
|
763
|
+
type: 'string',
|
|
764
|
+
description: trans.__(
|
|
765
|
+
'The text to replace the current selection with'
|
|
766
|
+
)
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
}
|
|
613
771
|
});
|
|
614
772
|
|
|
615
773
|
/**
|
|
@@ -627,7 +785,13 @@ export namespace Commands {
|
|
|
627
785
|
},
|
|
628
786
|
isEnabled,
|
|
629
787
|
icon: consoleIcon,
|
|
630
|
-
label: trans.__('Create Console for Editor')
|
|
788
|
+
label: trans.__('Create Console for Editor'),
|
|
789
|
+
describedBy: {
|
|
790
|
+
args: {
|
|
791
|
+
type: 'object',
|
|
792
|
+
properties: {}
|
|
793
|
+
}
|
|
794
|
+
}
|
|
631
795
|
});
|
|
632
796
|
|
|
633
797
|
/**
|
|
@@ -649,7 +813,13 @@ export namespace Commands {
|
|
|
649
813
|
}
|
|
650
814
|
},
|
|
651
815
|
label: trans.__('Restart Kernel'),
|
|
652
|
-
isEnabled: () => consoleTracker !== null && isEnabled()
|
|
816
|
+
isEnabled: () => consoleTracker !== null && isEnabled(),
|
|
817
|
+
describedBy: {
|
|
818
|
+
args: {
|
|
819
|
+
type: 'object',
|
|
820
|
+
properties: {}
|
|
821
|
+
}
|
|
822
|
+
}
|
|
653
823
|
});
|
|
654
824
|
|
|
655
825
|
/**
|
|
@@ -713,7 +883,13 @@ export namespace Commands {
|
|
|
713
883
|
}
|
|
714
884
|
},
|
|
715
885
|
isEnabled,
|
|
716
|
-
label: trans.__('Run Selected Code')
|
|
886
|
+
label: trans.__('Run Selected Code'),
|
|
887
|
+
describedBy: {
|
|
888
|
+
args: {
|
|
889
|
+
type: 'object',
|
|
890
|
+
properties: {}
|
|
891
|
+
}
|
|
892
|
+
}
|
|
717
893
|
});
|
|
718
894
|
|
|
719
895
|
/**
|
|
@@ -751,7 +927,13 @@ export namespace Commands {
|
|
|
751
927
|
}
|
|
752
928
|
},
|
|
753
929
|
isEnabled,
|
|
754
|
-
label: trans.__('Run All Code')
|
|
930
|
+
label: trans.__('Run All Code'),
|
|
931
|
+
describedBy: {
|
|
932
|
+
args: {
|
|
933
|
+
type: 'object',
|
|
934
|
+
properties: {}
|
|
935
|
+
}
|
|
936
|
+
}
|
|
755
937
|
});
|
|
756
938
|
|
|
757
939
|
/**
|
|
@@ -778,7 +960,13 @@ export namespace Commands {
|
|
|
778
960
|
);
|
|
779
961
|
},
|
|
780
962
|
icon: markdownIcon,
|
|
781
|
-
label: trans.__('Show Markdown Preview')
|
|
963
|
+
label: trans.__('Show Markdown Preview'),
|
|
964
|
+
describedBy: {
|
|
965
|
+
args: {
|
|
966
|
+
type: 'object',
|
|
967
|
+
properties: {}
|
|
968
|
+
}
|
|
969
|
+
}
|
|
782
970
|
});
|
|
783
971
|
|
|
784
972
|
/**
|
|
@@ -808,6 +996,42 @@ export namespace Commands {
|
|
|
808
996
|
cwd as string,
|
|
809
997
|
(args.fileExt as string) ?? 'txt'
|
|
810
998
|
);
|
|
999
|
+
},
|
|
1000
|
+
describedBy: {
|
|
1001
|
+
args: {
|
|
1002
|
+
type: 'object',
|
|
1003
|
+
properties: {
|
|
1004
|
+
cwd: {
|
|
1005
|
+
type: 'string',
|
|
1006
|
+
description: trans.__('The current working directory path')
|
|
1007
|
+
},
|
|
1008
|
+
fileExt: {
|
|
1009
|
+
type: 'string',
|
|
1010
|
+
description: trans.__('The file extension for the new file')
|
|
1011
|
+
},
|
|
1012
|
+
isPalette: {
|
|
1013
|
+
type: 'boolean',
|
|
1014
|
+
description:
|
|
1015
|
+
'Whether the command is being called from the command palette'
|
|
1016
|
+
},
|
|
1017
|
+
paletteLabel: {
|
|
1018
|
+
type: 'string',
|
|
1019
|
+
description: trans.__('The label to show in the command palette')
|
|
1020
|
+
},
|
|
1021
|
+
launcherLabel: {
|
|
1022
|
+
type: 'string',
|
|
1023
|
+
description: trans.__('The label to show in the launcher')
|
|
1024
|
+
},
|
|
1025
|
+
caption: {
|
|
1026
|
+
type: 'string',
|
|
1027
|
+
description: trans.__('The caption for the command')
|
|
1028
|
+
},
|
|
1029
|
+
iconName: {
|
|
1030
|
+
type: 'string',
|
|
1031
|
+
description: trans.__('The name of the icon to use')
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
811
1035
|
}
|
|
812
1036
|
});
|
|
813
1037
|
|
|
@@ -824,6 +1048,22 @@ export namespace Commands {
|
|
|
824
1048
|
execute: args => {
|
|
825
1049
|
const cwd = args['cwd'] || defaultBrowser.model.path;
|
|
826
1050
|
return createNew(commands, cwd as string, 'md');
|
|
1051
|
+
},
|
|
1052
|
+
describedBy: {
|
|
1053
|
+
args: {
|
|
1054
|
+
type: 'object',
|
|
1055
|
+
properties: {
|
|
1056
|
+
cwd: {
|
|
1057
|
+
type: 'string',
|
|
1058
|
+
description: trans.__('The current working directory path')
|
|
1059
|
+
},
|
|
1060
|
+
isPalette: {
|
|
1061
|
+
type: 'boolean',
|
|
1062
|
+
description:
|
|
1063
|
+
'Whether the command is being called from the command palette'
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
827
1067
|
}
|
|
828
1068
|
});
|
|
829
1069
|
|
|
@@ -854,7 +1094,13 @@ export namespace Commands {
|
|
|
854
1094
|
return widget.editor.model.sharedModel.canUndo();
|
|
855
1095
|
},
|
|
856
1096
|
icon: undoIcon.bindprops({ stylesheet: 'menuItem' }),
|
|
857
|
-
label: trans.__('Undo')
|
|
1097
|
+
label: trans.__('Undo'),
|
|
1098
|
+
describedBy: {
|
|
1099
|
+
args: {
|
|
1100
|
+
type: 'object',
|
|
1101
|
+
properties: {}
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
858
1104
|
});
|
|
859
1105
|
|
|
860
1106
|
/**
|
|
@@ -884,7 +1130,13 @@ export namespace Commands {
|
|
|
884
1130
|
return widget.editor.model.sharedModel.canRedo();
|
|
885
1131
|
},
|
|
886
1132
|
icon: redoIcon.bindprops({ stylesheet: 'menuItem' }),
|
|
887
|
-
label: trans.__('Redo')
|
|
1133
|
+
label: trans.__('Redo'),
|
|
1134
|
+
describedBy: {
|
|
1135
|
+
args: {
|
|
1136
|
+
type: 'object',
|
|
1137
|
+
properties: {}
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
888
1140
|
});
|
|
889
1141
|
|
|
890
1142
|
/**
|
|
@@ -919,7 +1171,13 @@ export namespace Commands {
|
|
|
919
1171
|
return isSelected(widget.editor as CodeMirrorEditor);
|
|
920
1172
|
},
|
|
921
1173
|
icon: cutIcon.bindprops({ stylesheet: 'menuItem' }),
|
|
922
|
-
label: trans.__('Cut')
|
|
1174
|
+
label: trans.__('Cut'),
|
|
1175
|
+
describedBy: {
|
|
1176
|
+
args: {
|
|
1177
|
+
type: 'object',
|
|
1178
|
+
properties: {}
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
923
1181
|
});
|
|
924
1182
|
|
|
925
1183
|
/**
|
|
@@ -953,7 +1211,13 @@ export namespace Commands {
|
|
|
953
1211
|
return isSelected(widget.editor as CodeMirrorEditor);
|
|
954
1212
|
},
|
|
955
1213
|
icon: copyIcon.bindprops({ stylesheet: 'menuItem' }),
|
|
956
|
-
label: trans.__('Copy')
|
|
1214
|
+
label: trans.__('Copy'),
|
|
1215
|
+
describedBy: {
|
|
1216
|
+
args: {
|
|
1217
|
+
type: 'object',
|
|
1218
|
+
properties: {}
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
957
1221
|
});
|
|
958
1222
|
|
|
959
1223
|
/**
|
|
@@ -980,7 +1244,13 @@ export namespace Commands {
|
|
|
980
1244
|
},
|
|
981
1245
|
isEnabled: () => Boolean(isEnabled() && tracker.currentWidget?.content),
|
|
982
1246
|
icon: pasteIcon.bindprops({ stylesheet: 'menuItem' }),
|
|
983
|
-
label: trans.__('Paste')
|
|
1247
|
+
label: trans.__('Paste'),
|
|
1248
|
+
describedBy: {
|
|
1249
|
+
args: {
|
|
1250
|
+
type: 'object',
|
|
1251
|
+
properties: {}
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
984
1254
|
});
|
|
985
1255
|
|
|
986
1256
|
/**
|
|
@@ -998,7 +1268,13 @@ export namespace Commands {
|
|
|
998
1268
|
editor.execCommand(selectAll);
|
|
999
1269
|
},
|
|
1000
1270
|
isEnabled: () => Boolean(isEnabled() && tracker.currentWidget?.content),
|
|
1001
|
-
label: trans.__('Select All')
|
|
1271
|
+
label: trans.__('Select All'),
|
|
1272
|
+
describedBy: {
|
|
1273
|
+
args: {
|
|
1274
|
+
type: 'object',
|
|
1275
|
+
properties: {}
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1002
1278
|
});
|
|
1003
1279
|
|
|
1004
1280
|
// All commands with isEnabled defined directly or in a semantic commands
|
|
@@ -1048,6 +1324,12 @@ export namespace Commands {
|
|
|
1048
1324
|
if (id) {
|
|
1049
1325
|
return manager.invoke(id);
|
|
1050
1326
|
}
|
|
1327
|
+
},
|
|
1328
|
+
describedBy: {
|
|
1329
|
+
args: {
|
|
1330
|
+
type: 'object',
|
|
1331
|
+
properties: {}
|
|
1332
|
+
}
|
|
1051
1333
|
}
|
|
1052
1334
|
});
|
|
1053
1335
|
|
|
@@ -1059,6 +1341,12 @@ export namespace Commands {
|
|
|
1059
1341
|
if (id) {
|
|
1060
1342
|
return manager.select(id);
|
|
1061
1343
|
}
|
|
1344
|
+
},
|
|
1345
|
+
describedBy: {
|
|
1346
|
+
args: {
|
|
1347
|
+
type: 'object',
|
|
1348
|
+
properties: {}
|
|
1349
|
+
}
|
|
1062
1350
|
}
|
|
1063
1351
|
});
|
|
1064
1352
|
|
|
@@ -1157,20 +1445,27 @@ export namespace Commands {
|
|
|
1157
1445
|
|
|
1158
1446
|
/**
|
|
1159
1447
|
* Add ___ File items to the Launcher for common file types associated with available kernels
|
|
1448
|
+
* Returns a DisposableSet containing all added items
|
|
1160
1449
|
*/
|
|
1161
1450
|
export function addKernelLanguageLauncherItems(
|
|
1162
1451
|
launcher: ILauncher,
|
|
1163
1452
|
trans: TranslationBundle,
|
|
1164
1453
|
availableKernelFileTypes: Iterable<IFileTypeData>
|
|
1165
|
-
):
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1454
|
+
): IDisposable {
|
|
1455
|
+
const disposables = new DisposableSet();
|
|
1456
|
+
|
|
1457
|
+
for (const ext of availableKernelFileTypes) {
|
|
1458
|
+
disposables.add(
|
|
1459
|
+
launcher.add({
|
|
1460
|
+
command: CommandIDs.createNew,
|
|
1461
|
+
category: trans.__('Other'),
|
|
1462
|
+
rank: 3,
|
|
1463
|
+
args: ext
|
|
1464
|
+
})
|
|
1465
|
+
);
|
|
1173
1466
|
}
|
|
1467
|
+
|
|
1468
|
+
return disposables;
|
|
1174
1469
|
}
|
|
1175
1470
|
|
|
1176
1471
|
/**
|
|
@@ -1260,20 +1555,27 @@ export namespace Commands {
|
|
|
1260
1555
|
|
|
1261
1556
|
/**
|
|
1262
1557
|
* Add New ___ File commands to the File Editor palette for common file types associated with available kernels
|
|
1558
|
+
* Returns a DisposableSet containing all added items
|
|
1263
1559
|
*/
|
|
1264
1560
|
export function addKernelLanguagePaletteItems(
|
|
1265
1561
|
palette: ICommandPalette,
|
|
1266
1562
|
trans: TranslationBundle,
|
|
1267
1563
|
availableKernelFileTypes: Iterable<IFileTypeData>
|
|
1268
|
-
):
|
|
1564
|
+
): IDisposable {
|
|
1565
|
+
const disposables = new DisposableSet();
|
|
1269
1566
|
const paletteCategory = trans.__('Text Editor');
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1567
|
+
|
|
1568
|
+
for (const ext of availableKernelFileTypes) {
|
|
1569
|
+
disposables.add(
|
|
1570
|
+
palette.addItem({
|
|
1571
|
+
command: CommandIDs.createNew,
|
|
1572
|
+
args: { ...ext, isPalette: true },
|
|
1573
|
+
category: paletteCategory
|
|
1574
|
+
})
|
|
1575
|
+
);
|
|
1276
1576
|
}
|
|
1577
|
+
|
|
1578
|
+
return disposables;
|
|
1277
1579
|
}
|
|
1278
1580
|
|
|
1279
1581
|
/**
|
|
@@ -1323,18 +1625,25 @@ export namespace Commands {
|
|
|
1323
1625
|
|
|
1324
1626
|
/**
|
|
1325
1627
|
* Add Create New ___ File commands to the File menu for common file types associated with available kernels
|
|
1628
|
+
* Returns a DisposableSet containing all added items
|
|
1326
1629
|
*/
|
|
1327
1630
|
export function addKernelLanguageMenuItems(
|
|
1328
1631
|
menu: IMainMenu,
|
|
1329
1632
|
availableKernelFileTypes: Iterable<IFileTypeData>
|
|
1330
|
-
):
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1633
|
+
): IDisposable {
|
|
1634
|
+
const disposables = new DisposableSet();
|
|
1635
|
+
|
|
1636
|
+
for (const ext of availableKernelFileTypes) {
|
|
1637
|
+
disposables.add(
|
|
1638
|
+
menu.fileMenu.newMenu.addItem({
|
|
1639
|
+
command: CommandIDs.createNew,
|
|
1640
|
+
args: ext,
|
|
1641
|
+
rank: 31
|
|
1642
|
+
})
|
|
1643
|
+
);
|
|
1337
1644
|
}
|
|
1645
|
+
|
|
1646
|
+
return disposables;
|
|
1338
1647
|
}
|
|
1339
1648
|
|
|
1340
1649
|
/**
|
|
@@ -1418,6 +1727,36 @@ export namespace Commands {
|
|
|
1418
1727
|
label: trans.__('Open Code Viewer'),
|
|
1419
1728
|
execute: (args: any) => {
|
|
1420
1729
|
return openCodeViewer(args);
|
|
1730
|
+
},
|
|
1731
|
+
describedBy: {
|
|
1732
|
+
args: {
|
|
1733
|
+
type: 'object',
|
|
1734
|
+
properties: {
|
|
1735
|
+
content: {
|
|
1736
|
+
type: 'string',
|
|
1737
|
+
description: trans.__('The content to display in the code viewer')
|
|
1738
|
+
},
|
|
1739
|
+
label: {
|
|
1740
|
+
type: 'string',
|
|
1741
|
+
description: trans.__('The label for the code viewer')
|
|
1742
|
+
},
|
|
1743
|
+
mimeType: {
|
|
1744
|
+
type: 'string',
|
|
1745
|
+
description: trans.__('The MIME type of the content')
|
|
1746
|
+
},
|
|
1747
|
+
extension: {
|
|
1748
|
+
type: 'string',
|
|
1749
|
+
description: trans.__(
|
|
1750
|
+
'The file extension to derive MIME type from'
|
|
1751
|
+
)
|
|
1752
|
+
},
|
|
1753
|
+
widgetId: {
|
|
1754
|
+
type: 'string',
|
|
1755
|
+
description: trans.__('The ID to assign to the widget')
|
|
1756
|
+
}
|
|
1757
|
+
},
|
|
1758
|
+
required: ['content']
|
|
1759
|
+
}
|
|
1421
1760
|
}
|
|
1422
1761
|
});
|
|
1423
1762
|
}
|