threads / patch / 62035

patchmergetools: vscode: new tool

Subject: [PATCH] mergetools: vscode: new tool

## tl;dr

3 messages between Sep 2, 2024 and Sep 3, 2024. Diffs are folded; open one to read it.

replies: 2people: 3as markdown or json

Alex Henrie· Sep 2, 2024, 02:59 UTC · lore

VSCode has supported three-way merges since 2022, see <https://github.com/microsoft/vscode/issues/5770#issuecomment-1188658476>.

Although the program binary is located at /usr/bin/code, name the mergetool "vscode" because the word "code" is too generic and would lead to confusion. The name "vscode" also matches Git's existing contrib/vscode directory.

On Windows, VSCode adds the directory that contains code.cmd to %PATH%, so there is no need to invoke mergetool_find_win32_cmd to search for the program.

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
---
 mergetools/vscode | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 mergetools/vscode
Show changes to mergetools/vscode +19 −0
diff --git a/mergetools/vscode b/mergetools/vscode
new file mode 100644
index 0000000000..3b39b458d6
--- /dev/null
+++ b/mergetools/vscode
@@ -0,0 +1,19 @@
+diff_cmd () {
+	"$merge_tool_path" --wait --diff "$LOCAL" "$REMOTE"
+}
+
+diff_cmd_help () {
+	echo "Use Visual Studio Code (requires a graphical session)"
+}
+
+merge_cmd () {
+	"$merge_tool_path" --wait --merge "$REMOTE" "$LOCAL" "$BASE" "$MERGED"
+}
+
+merge_cmd_help () {
+	echo "Use Visual Studio Code (requires a graphical session)"
+}
+
+translate_merge_tool_path () {
+	echo code
+}
-- 
2.46.0
Johannes Schindelin· Sep 3, 2024, 11:11 UTC · re: Alex Henrie · lore

Re: [PATCH] mergetools: vscode: new tool

Hi Alex,
On Sun, 1 Sep 2024, Alex Henrie wrote:
Show 11 quoted lines
> VSCode has supported three-way merges since 2022, see
> <https://github.com/microsoft/vscode/issues/5770#issuecomment-1188658476>.
>
> Although the program binary is located at /usr/bin/code, name the
> mergetool "vscode" because the word "code" is too generic and would lead
> to confusion. The name "vscode" also matches Git's existing
> contrib/vscode directory.
>
> On Windows, VSCode adds the directory that contains code.cmd to %PATH%,
> so there is no need to invoke mergetool_find_win32_cmd to search for the
> program.
The commit message and the patch look good to me.

Thank you! Johannes

Show 36 quoted lines
>
> Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
> ---
>  mergetools/vscode | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
>  create mode 100644 mergetools/vscode
>
> diff --git a/mergetools/vscode b/mergetools/vscode
> new file mode 100644
> index 0000000000..3b39b458d6
> --- /dev/null
> +++ b/mergetools/vscode
> @@ -0,0 +1,19 @@
> +diff_cmd () {
> +	"$merge_tool_path" --wait --diff "$LOCAL" "$REMOTE"
> +}
> +
> +diff_cmd_help () {
> +	echo "Use Visual Studio Code (requires a graphical session)"
> +}
> +
> +merge_cmd () {
> +	"$merge_tool_path" --wait --merge "$REMOTE" "$LOCAL" "$BASE" "$MERGED"
> +}
> +
> +merge_cmd_help () {
> +	echo "Use Visual Studio Code (requires a graphical session)"
> +}
> +
> +translate_merge_tool_path () {
> +	echo code
> +}
> --
> 2.46.0
>
>
Junio C Hamano· Sep 3, 2024, 15:56 UTC · re: Johannes Schindelin · lore

Re: [PATCH] mergetools: vscode: new tool

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 5 quoted lines
>> On Windows, VSCode adds the directory that contains code.cmd to %PATH%,
>> so there is no need to invoke mergetool_find_win32_cmd to search for the
>> program.
>
> The commit message and the patch look good to me.
Thanks, both.  Let me mark the topic for 'next'.

← back to recent threads