mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 04:34:59 +00:00
feature<VSCode>: supports to open repository with Visual Studio Code
This commit is contained in:
parent
4a676e094d
commit
4456019968
8 changed files with 65 additions and 19 deletions
|
@ -56,6 +56,9 @@ namespace SourceGit.Views.Widgets {
|
|||
InitializeComponent();
|
||||
InitPages();
|
||||
|
||||
var vscode = Models.ExecutableFinder.Find("code.cmd");
|
||||
if (vscode != null) btnOpenWithVSCode.Visibility = Visibility.Visible;
|
||||
|
||||
var watcher = Models.Watcher.Get(repo.Path);
|
||||
watcher.Navigate += NavigateTo;
|
||||
watcher.BranchChanged += UpdateBranches;
|
||||
|
@ -309,6 +312,21 @@ namespace SourceGit.Views.Widgets {
|
|||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void OpenInVSCode(object sender, RoutedEventArgs e) {
|
||||
var vscode = Models.ExecutableFinder.Find("code.cmd");
|
||||
if (vscode == null) return;
|
||||
|
||||
vscode = Path.Combine(Path.GetDirectoryName(vscode), "..", "Code.exe");
|
||||
Process.Start(new ProcessStartInfo {
|
||||
WorkingDirectory = repo.Path,
|
||||
FileName = vscode,
|
||||
Arguments = $"\"{repo.Path}\"",
|
||||
UseShellExecute = false,
|
||||
});
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void Terminal(object sender, RoutedEventArgs e) {
|
||||
var bash = Path.Combine(Models.Preference.Instance.Git.Path, "..", "bash.exe");
|
||||
if (!File.Exists(bash)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue