Skip to content

Commit

Permalink
feat: add a new ecl file type to the new file command
Browse files Browse the repository at this point in the history
Signed-off-by: David de Hilster <[email protected]>
  • Loading branch information
dehilsterlexis committed Mar 29, 2024
1 parent bd3f656 commit 63458c3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
20 changes: 20 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@
],
"viewsWelcome": [],
"commands": [
{
"command": "ecl.newECLDocument",
"title": "ECL File"
},
{
"command": "ecl.submit",
"category": "ECL",
Expand Down Expand Up @@ -755,6 +759,7 @@
}
}
],

"submenus": [
{
"id": "setState",
Expand All @@ -766,6 +771,12 @@
}
],
"menus": {
"file/newFile": [
{
"command": "ecl.newECLDocument",
"group": "file"
}
],
"setPriority": [
{
"command": "hpccPlatform.moveJobUp",
Expand Down Expand Up @@ -835,6 +846,11 @@
}
],
"explorer/context": [
{
"command": "ecl.newECLDocument",
"group": "ecl",
"when": "ecl.isActive"
},
{
"when": "resourceLangId == ecl && resourceExtname == .ecl",
"command": "ecl.copyAsEclID",
Expand Down Expand Up @@ -1130,6 +1146,10 @@
]
},
"keybindings": [
{
"command": "ecl.newECLDocument",
"key": "Alt+J Alt+N"
},
{
"command": "ecl.searchTerm",
"key": "shift+f1",
Expand Down
8 changes: 8 additions & 0 deletions src/ecl/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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");
Expand Down

0 comments on commit 63458c3

Please sign in to comment.