Browse Source

Adds terminal.overrideGitEditor setting

main
Nafiur Rahman Khadem 2 years ago
committed by Eric Amodio
parent
commit
4e999e52c2
4 changed files with 16 additions and 2 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +7
    -0
      package.json
  3. +3
    -0
      src/config.ts
  4. +5
    -2
      src/terminal.ts

+ 1
- 0
CHANGELOG.md View File

@ -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) - 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 - 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)) - 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 ### Fixed

+ 7
- 0
package.json View File

@ -2692,6 +2692,13 @@
"markdownDescription": "Specifies whether to show the _Commit Details_ view when clicking on a commit link in the integrated terminal", "markdownDescription": "Specifies whether to show the _Commit Details_ view when clicking on a commit link in the integrated terminal",
"scope": "window", "scope": "window",
"order": 20 "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
} }
} }
}, },

+ 3
- 0
src/config.ts View File

@ -154,6 +154,9 @@ export interface Config {
}; };
}; };
}; };
terminal: {
overrideGitEditor: boolean;
};
terminalLinks: { terminalLinks: {
enabled: boolean; enabled: boolean;
showDetailsView: boolean; showDetailsView: boolean;

+ 5
- 2
src/terminal.ts View File

@ -1,5 +1,6 @@
import type { Disposable, Terminal } from 'vscode'; import type { Disposable, Terminal } from 'vscode';
import { window } from 'vscode'; import { window } from 'vscode';
import { configuration } from './configuration';
import { Container } from './container'; import { Container } from './container';
import { getEditorCommand } from './system/utils'; import { getEditorCommand } from './system/utils';
@ -28,6 +29,8 @@ function ensureTerminal(): Terminal {
export function runGitCommandInTerminal(command: string, args: string, cwd: string, execute: boolean = false) { export function runGitCommandInTerminal(command: string, args: string, cwd: string, execute: boolean = false) {
const terminal = ensureTerminal(); const terminal = ensureTerminal();
terminal.show(false); 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);
} }

Loading…
Cancel
Save