Skip to content

Commit ffc8e1f

Browse files
feat: Visual Studio 2026 icon support
1 parent 0194e79 commit ffc8e1f

File tree

8 files changed

+34
-2
lines changed

8 files changed

+34
-2
lines changed

src/Models/ExternalMerger.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ static ExternalMerger()
3434
new ExternalMerger("git", "Use Git Settings", "", "", ""),
3535
new ExternalMerger("vscode", "Visual Studio Code", "Code.exe", "-n --wait \"$MERGED\"", "-n --wait --diff \"$LOCAL\" \"$REMOTE\""),
3636
new ExternalMerger("vscode_insiders", "Visual Studio Code - Insiders", "Code - Insiders.exe", "-n --wait \"$MERGED\"", "-n --wait --diff \"$LOCAL\" \"$REMOTE\""),
37-
new ExternalMerger("vs", "Visual Studio", "vsDiffMerge.exe", "\"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\" /m", "\"$LOCAL\" \"$REMOTE\""),
37+
new ExternalMerger("vs17", "Visual Studio", "vsDiffMerge.exe", "\"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\" /m", "\"$LOCAL\" \"$REMOTE\""),
3838
new ExternalMerger("tortoise_merge", "Tortoise Merge", "TortoiseMerge.exe;TortoiseGitMerge.exe", "-base:\"$BASE\" -theirs:\"$REMOTE\" -mine:\"$LOCAL\" -merged:\"$MERGED\"", "-base:\"$LOCAL\" -theirs:\"$REMOTE\""),
3939
new ExternalMerger("kdiff3", "KDiff3", "kdiff3.exe", "\"$REMOTE\" -b \"$BASE\" \"$LOCAL\" -o \"$MERGED\"", "\"$LOCAL\" \"$REMOTE\""),
4040
new ExternalMerger("beyond_compare", "Beyond Compare", "BComp.exe", "\"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\"", "\"$LOCAL\" \"$REMOTE\""),

src/Models/ExternalTool.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,21 @@ public class VisualStudioInstance
5858

5959
[JsonPropertyName("isPrerelease")]
6060
public bool IsPrerelease { get; set; } = false;
61+
62+
[JsonPropertyName("installationVersion")]
63+
public string InstallationVersion { get; set; } = string.Empty;
64+
65+
[JsonPropertyName("catalog")]
66+
public VisualStudioCatalog Catalog { get; set; } = new();
67+
}
68+
69+
public class VisualStudioCatalog
70+
{
71+
[JsonPropertyName("productLine")]
72+
public string ProductLine { get; set; } = string.Empty;
73+
74+
[JsonIgnore]
75+
public VisualStudioProductLine ParsedProductLine => Enum.TryParse<VisualStudioProductLine>(ProductLine, out var ppl) ? ppl : VisualStudioProductLine.Dev17;
6176
}
6277

6378
public class JetBrainsState
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
namespace SourceGit.Models
2+
{
3+
public enum VisualStudioProductLine
4+
{
5+
/// <summary>
6+
/// Visual Studio 2022
7+
/// </summary>
8+
Dev17 = 17,
9+
/// <summary>
10+
/// Visual Studio 2026
11+
/// </summary>
12+
Dev18 = 18
13+
}
14+
}

src/Native/Windows.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using Avalonia.Controls;
1212
using Avalonia.Platform;
1313
using Avalonia.Threading;
14+
using SourceGit.Models;
1415

1516
namespace SourceGit.Native
1617
{
@@ -404,7 +405,9 @@ private void FindVisualStudio(Models.ExternalToolsFinder finder)
404405
foreach (var instance in instances)
405406
{
406407
var exec = instance.ProductPath;
407-
var icon = instance.IsPrerelease ? "vs-preview" : "vs";
408+
var productLine = instance.Catalog?.ParsedProductLine ?? VisualStudioProductLine.Dev17;
409+
var icon = instance.IsPrerelease ? $"vs{(int)productLine}-preview" : $"vs{(int)productLine}";
410+
408411
finder.TryAdd(instance.DisplayName, icon, () => exec, GenerateCommandlineArgsForVisualStudio);
409412
}
410413
}
File renamed without changes.
File renamed without changes.
5.92 KB
Loading
3.36 KB
Loading

0 commit comments

Comments
 (0)