From 4e999e52c210123279d43dbe79adb640879648f0 Mon Sep 17 00:00:00 2001 From: Nafiur Rahman Khadem Date: Fri, 4 Nov 2022 00:37:43 +0600 Subject: [PATCH] Adds terminal.overrideGitEditor setting --- CHANGELOG.md | 1 + package.json | 7 +++++++ src/config.ts | 3 +++ src/terminal.ts | 7 +++++-- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02f3226..5971906 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p - Changes SHA terminal links to use the _Commit Details_ view — closes [#2320](https://github.com/gitkraken/vscode-gitlens/issues/2320) - Adds a `gitlens.terminalLinks.showDetailsView` setting to specify whether to show the _Commit Details_ view when clicking on a commit link - Changes to uses VS Code as Git's `core.editor` for terminal run commands — closes [#2134](https://github.com/gitkraken/vscode-gitlens/pull/2134) thanks to [PR #2135](https://github.com/gitkraken/vscode-gitlens/pull/2135) by Nafiur Rahman Khadem ([@ShafinKhadem](https://github.com/ShafinKhadem)) + - Adds a `gitlens.terminal.overrideGitEditor` setting to specify whether to use VS Code as Git's `core.editor` for Gitlens terminal commands ### Fixed diff --git a/package.json b/package.json index 4c34e0a..7002cc0 100644 --- a/package.json +++ b/package.json @@ -2692,6 +2692,13 @@ "markdownDescription": "Specifies whether to show the _Commit Details_ view when clicking on a commit link in the integrated terminal", "scope": "window", "order": 20 + }, + "gitlens.terminal.overrideGitEditor": { + "type": "boolean", + "default": true, + "markdownDescription": "Specifies whether to use VS Code as Git's `core.editor` for Gitlens terminal commands", + "scope": "window", + "order": 100 } } }, diff --git a/src/config.ts b/src/config.ts index b509885..13db762 100644 --- a/src/config.ts +++ b/src/config.ts @@ -154,6 +154,9 @@ export interface Config { }; }; }; + terminal: { + overrideGitEditor: boolean; + }; terminalLinks: { enabled: boolean; showDetailsView: boolean; diff --git a/src/terminal.ts b/src/terminal.ts index 0118c94..dddf4d9 100644 --- a/src/terminal.ts +++ b/src/terminal.ts @@ -1,5 +1,6 @@ import type { Disposable, Terminal } from 'vscode'; import { window } from 'vscode'; +import { configuration } from './configuration'; import { Container } from './container'; import { getEditorCommand } from './system/utils'; @@ -28,6 +29,8 @@ function ensureTerminal(): Terminal { export function runGitCommandInTerminal(command: string, args: string, cwd: string, execute: boolean = false) { const terminal = ensureTerminal(); terminal.show(false); - const editor = getEditorCommand(); - terminal.sendText(`git -C "${cwd}" -c "core.editor=${editor}" ${command} ${args}`, execute); + const coreEditorConfig = configuration.get('terminal.overrideGitEditor') + ? `-c "core.editor=${getEditorCommand()}" ` + : ''; + terminal.sendText(`git -C "${cwd}" ${coreEditorConfig}${command} ${args}`, execute); }