mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-25 04:14:59 +00:00
feature: support Visual Studio external tool on Windows
This commit is contained in:
parent
06762615b6
commit
987ab96419
3 changed files with 26 additions and 0 deletions
|
@ -127,6 +127,7 @@ This app supports open repository in external tools listed in the table below.
|
|||
| JetBrains Fleet | YES | YES | YES | FLEET |
|
||||
| Sublime Text | YES | YES | YES | SUBLIME_TEXT |
|
||||
| Zed | NO | YES | YES | ZED |
|
||||
| Visual Studio | YES | YES | YES | VISUALSTUDIO |
|
||||
|
||||
> [!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.
|
||||
|
|
|
@ -154,6 +154,11 @@ namespace SourceGit.Models
|
|||
TryAdd("Zed", "zed", "\"{0}\"", "ZED", platformFinder);
|
||||
}
|
||||
|
||||
public void VisualStudio(Func<string> platformFinder)
|
||||
{
|
||||
TryAdd("Visual Studio", "vs", "\"{0}\"", "VISUALSTUDIO", platformFinder);
|
||||
}
|
||||
|
||||
public void FindJetBrainsFromToolbox(Func<string> platformFinder)
|
||||
{
|
||||
var exclude = new List<string> { "fleet", "dotmemory", "dottrace", "resharper-u", "androidstudio" };
|
||||
|
|
|
@ -134,6 +134,7 @@ namespace SourceGit.Native
|
|||
finder.Fleet(() => $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\\Programs\\Fleet\\Fleet.exe");
|
||||
finder.FindJetBrainsFromToolbox(() => $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\\JetBrains\\Toolbox");
|
||||
finder.SublimeText(FindSublimeText);
|
||||
finder.VisualStudio(FindVisualStudio);
|
||||
return finder.Founded;
|
||||
}
|
||||
|
||||
|
@ -313,6 +314,25 @@ namespace SourceGit.Native
|
|||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
private string FindVisualStudio()
|
||||
{
|
||||
var localMachine = Microsoft.Win32.RegistryKey.OpenBaseKey(
|
||||
Microsoft.Win32.RegistryHive.LocalMachine,
|
||||
Microsoft.Win32.RegistryView.Registry64);
|
||||
|
||||
// Get default class for VisualStudio.Launcher.sln - the handler for *.sln files
|
||||
if (localMachine.OpenSubKey(@"SOFTWARE\Classes\VisualStudio.Launcher.sln\CLSID") is Microsoft.Win32.RegistryKey launcher)
|
||||
{
|
||||
// Get actual path to the executable
|
||||
if (launcher.GetValue(string.Empty) is string CLSID && localMachine.OpenSubKey(@$"SOFTWARE\Classes\CLSID\{CLSID}\LocalServer32") is Microsoft.Win32.RegistryKey devenv && devenv.GetValue(string.Empty) is string localServer32)
|
||||
{
|
||||
return localServer32!.Trim('\"');
|
||||
}
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void OpenFolderAndSelectFile(string folderPath)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue