Skip to content

Commit 4623460

Browse files
author
Kartik Raj
authored
Allow to specify language id in command to create a new untitled file (microsoft#153872)
* Allow to specify language id in command to create a new untitled file * Make viewtype optional
1 parent f4ab348 commit 4623460

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/vs/workbench/contrib/files/browser/fileCommands.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -628,29 +628,32 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
628628
args: [
629629
{
630630
isOptional: true,
631-
name: 'viewType',
632-
description: 'The editor view type',
631+
name: 'New Untitled File args',
632+
description: 'The editor view type and language ID if known',
633633
schema: {
634634
'type': 'object',
635-
'required': ['viewType'],
636635
'properties': {
637636
'viewType': {
638637
'type': 'string'
638+
},
639+
'languageId': {
640+
'type': 'string'
639641
}
640642
}
641643
}
642644
}
643645
]
644646
},
645-
handler: async (accessor, args?: { viewType: string }) => {
647+
handler: async (accessor, args?: { languageId?: string; viewType?: string }) => {
646648
const editorService = accessor.get(IEditorService);
647649

648650
await editorService.openEditor({
649651
resource: undefined,
650652
options: {
651653
override: args?.viewType,
652654
pinned: true
653-
}
655+
},
656+
languageId: args?.languageId,
654657
});
655658
}
656659
});

0 commit comments

Comments
 (0)