diff --git a/package.json b/package.json index 9ef9b5d..bc96f89 100644 --- a/package.json +++ b/package.json @@ -219,6 +219,10 @@ ], "viewsWelcome": [], "commands": [ + { + "command": "ecl.newECLDocument", + "title": "ECL File" + }, { "command": "ecl.submit", "category": "ECL", @@ -755,6 +759,7 @@ } } ], + "submenus": [ { "id": "setState", @@ -766,6 +771,12 @@ } ], "menus": { + "file/newFile": [ + { + "command": "ecl.newECLDocument", + "group": "file" + } + ], "setPriority": [ { "command": "hpccPlatform.moveJobUp", @@ -835,6 +846,11 @@ } ], "explorer/context": [ + { + "command": "ecl.newECLDocument", + "group": "ecl", + "when": "ecl.isActive" + }, { "when": "resourceLangId == ecl && resourceExtname == .ecl", "command": "ecl.copyAsEclID", @@ -1130,6 +1146,10 @@ ] }, "keybindings": [ + { + "command": "ecl.newECLDocument", + "key": "Alt+J Alt+N" + }, { "command": "ecl.searchTerm", "key": "shift+f1", diff --git a/src/ecl/command.ts b/src/ecl/command.ts index 11e62fb..2694a71 100644 --- a/src/ecl/command.ts +++ b/src/ecl/command.ts @@ -42,6 +42,7 @@ export class ECLCommands { ctx.subscriptions.push(vscode.commands.registerCommand("ecl.verify", this.verify, this)); ctx.subscriptions.push(vscode.commands.registerCommand("ecl.importModFile", this.importModFile, this)); ctx.subscriptions.push(vscode.commands.registerCommand("ecl.copyAsEclID", this.copyAsEclID, this)); + ctx.subscriptions.push(vscode.commands.registerCommand("ecl.newECLDocument", this.newECLDocument, this)); } static attach(ctx: vscode.ExtensionContext): ECLCommands { @@ -51,6 +52,13 @@ export class ECLCommands { return eclCommands; } + newECLDocument() + { + vscode.workspace.openTextDocument({ language: "ecl" }).then(document => { + vscode.window.showTextDocument(document); + }); + } + checkSyntax() { if (vscode.window.activeTextEditor) { vscode.commands.executeCommand("workbench.panel.markers.view.focus");