/TestMake-contribution.ts Secret
Created
June 25, 2021 14:48
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { injectable, inject } from "inversify"; | |
import { CommandContribution, CommandRegistry, MenuContribution, MenuModelRegistry, MessageService } from "@theia/core/lib/common"; | |
import { CommonMenus } from "@theia/core/lib/browser"; | |
import { TaskConfiguration, TaskScope } from '@theia/task/lib/common'; | |
import { TaskService } from '@theia/task/lib/browser/task-service'; | |
export const TestMakeCommand = { | |
id: 'TestMake.command', | |
label: "Test Make" | |
}; | |
const myTask: TaskConfiguration = { | |
"_scope": TaskScope.Global, | |
"label": "Test Make", | |
"type": "shell", | |
"command": "/usr/bin/make", | |
"args": [ | |
"-v" | |
], | |
"options": { | |
"cwd": "/home/bud-rey/Test" | |
} | |
} | |
@injectable() | |
export class TestMakeCommandContribution implements CommandContribution { | |
constructor( | |
@inject(TaskService) private readonly taskService: TaskService, | |
@inject(MessageService) private readonly messageService: MessageService, | |
) { } | |
registerCommands(registry: CommandRegistry): void { | |
registry.registerCommand(TestMakeCommand, { | |
execute: () => { | |
this.taskService.runTask(myTask); | |
this.messageService.info('Test Make'); | |
} | |
}); | |
} | |
} | |
@injectable() | |
export class TestMakeMenuContribution implements MenuContribution { | |
registerMenus(menus: MenuModelRegistry): void { | |
menus.registerMenuAction(CommonMenus.EDIT_FIND, { | |
commandId: TestMakeCommand.id, | |
label: TestMakeCommand.label | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment