1
1
mirror of https://github.com/kahole/edamagit.git synced 2024-09-11 07:15:31 +03:00

Allows magit.dispatch from anywhere (#56)

* allows magit.dispatch from anywhere

* remove the when clause of magit.status and magit.dispatch
This commit is contained in:
Milo Lee 2020-07-09 05:07:27 +08:00 committed by GitHub
parent 1d1760a316
commit 3476269367
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 9 deletions

View File

@ -195,12 +195,10 @@
"menus": {
"commandPalette": [
{
"command": "magit.status",
"when": "activeEditor"
"command": "magit.status"
},
{
"command": "magit.dispatch",
"when": "activeEditor"
"command": "magit.dispatch"
},
{
"command": "magit.help",

View File

@ -120,11 +120,16 @@ export function activate(context: ExtensionContext) {
context.subscriptions.push(commands.registerTextEditorCommand('magit.stage-file', Command.primeFileCommand(stageFile)));
context.subscriptions.push(commands.registerTextEditorCommand('magit.unstage-file', Command.primeFileCommand(unstageFile)));
context.subscriptions.push(commands.registerTextEditorCommand('magit.dispatch', Command.primeRepo(async (repository: MagitRepository) => {
const uri = DispatchView.encodeLocation(repository);
views.set(uri.toString(), new DispatchView(uri));
return workspace.openTextDocument(uri).then(doc => window.showTextDocument(doc, { viewColumn: MagitUtils.showDocumentColumn(), preview: false }));
}, false)));
context.subscriptions.push(commands.registerCommand('magit.dispatch', async () => {
const editor = window.activeTextEditor;
const repository = await MagitUtils.getCurrentMagitRepo(editor?.document.uri);
if (repository) {
const uri = DispatchView.encodeLocation(repository);
views.set(uri.toString(), new DispatchView(uri));
return workspace.openTextDocument(uri).then(doc => window.showTextDocument(doc, { viewColumn: MagitUtils.showDocumentColumn(), preview: false }));
}
}));
context.subscriptions.push(commands.registerTextEditorCommand('magit.toggle-fold', Command.primeRepoAndView(async (repo: MagitRepository, view: DocumentView) => {
const selectedView = view.click(window.activeTextEditor!.selection.active);