From ba9c3058edfff3ee2c941755115cc9298281e7dd Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 18 Sep 2024 10:00:32 +0800 Subject: [PATCH] feature: supports `Zed` editor as an external editor (#477) --- README.md | 1 + src/Models/ExternalTool.cs | 5 +++++ src/Native/Linux.cs | 1 + src/Native/MacOS.cs | 1 + src/Resources/Images/ExternalToolIcons/zed.png | Bin 0 -> 5420 bytes 5 files changed, 8 insertions(+) create mode 100644 src/Resources/Images/ExternalToolIcons/zed.png diff --git a/README.md b/README.md index 170e7bd6..255d7c11 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,7 @@ This app supports open repository in external tools listed in the table below. | VSCodium | YES | YES | YES | VSCODIUM | | JetBrains Fleet | YES | YES | YES | FLEET | | Sublime Text | YES | YES | YES | SUBLIME_TEXT | +| Zed | NO | YES | YES | ZED | > [!NOTE] > This app will try to find those tools based on some pre-defined or expected locations automatically. If you are using one portable version of these tools, it will not be detected by this app. diff --git a/src/Models/ExternalTool.cs b/src/Models/ExternalTool.cs index 45682dab..b26a9a90 100644 --- a/src/Models/ExternalTool.cs +++ b/src/Models/ExternalTool.cs @@ -149,6 +149,11 @@ namespace SourceGit.Models TryAdd("Sublime Text", "sublime_text", "\"{0}\"", "SUBLIME_TEXT", platformFinder); } + public void Zed(Func platformFinder) + { + TryAdd("Zed", "zed", "\"{0}\"", "ZED", platformFinder); + } + public void FindJetBrainsFromToolbox(Func platformFinder) { var exclude = new List { "fleet", "dotmemory", "dottrace", "resharper-u", "androidstudio" }; diff --git a/src/Native/Linux.cs b/src/Native/Linux.cs index 9df41160..7c3f20f8 100644 --- a/src/Native/Linux.cs +++ b/src/Native/Linux.cs @@ -50,6 +50,7 @@ namespace SourceGit.Native finder.Fleet(FindJetBrainsFleet); finder.FindJetBrainsFromToolbox(() => $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}/JetBrains/Toolbox"); finder.SublimeText(() => FindExecutable("subl")); + finder.Zed(() => FindExecutable("zed")); return finder.Founded; } diff --git a/src/Native/MacOS.cs b/src/Native/MacOS.cs index 0ad608b2..81918284 100644 --- a/src/Native/MacOS.cs +++ b/src/Native/MacOS.cs @@ -46,6 +46,7 @@ namespace SourceGit.Native finder.Fleet(() => $"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}/Applications/Fleet.app/Contents/MacOS/Fleet"); finder.FindJetBrainsFromToolbox(() => $"{Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)}/Library/Application Support/JetBrains/Toolbox"); finder.SublimeText(() => "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"); + finder.Zed(() => File.Exists("/usr/local/bin/zed") ? "/usr/local/bin/zed" : "/Applications/Zed.app/Contents/MacOS/cli"); return finder.Founded; } diff --git a/src/Resources/Images/ExternalToolIcons/zed.png b/src/Resources/Images/ExternalToolIcons/zed.png new file mode 100644 index 0000000000000000000000000000000000000000..07c4c50fd33ec00c3974382f62375cc0f5650688 GIT binary patch literal 5420 zcmV+{71Qd8P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGf5&!@T5&_cPe*6Fc6v0VEK~#8N)tg(4 zp2c~`=iTpHd)LM>7z{q)T_3&LMmK< zgaidONI(b#(}Ej;j8r9+sf8h^1zZr|6CfWbHa_fk=>PYhdA@!3^X_6ty>R|yzL|IC znddamJTvdRPL+-TXPj}y(oSmpI8~kRce`nIqtRH>Znft%2b;6HolYgBsv1bGb}J1G z45R_IQ|fwdH?=j^P^+V{MryaadahDejHnAy>U1SRbJeZKJQq}*c4?(FFbE&!NY>a` zYNTdL4O8#e&u+E04Gs=`(CW1RV@B2dmyH`Y{*Nb4gJ~VGX3d)O+MVh?$-8hs7GePC zbUIcZ{jF*-rlVSPc0yY;jLOtB&}^hmOO6<5%1E_MCqAuC>e^R%ex(|7t(1PMPB%3* zx825xmBupNfcW6Rfv#k#ud83pwiBTT%|@fE>2Efx>K`_2*zlG+C&8o+7#SHkerRau z5jAhF2Fh>u)w~+O)@=HDpa{ zShj50>0=e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