Skip to content

Commit 4d8788a

Browse files
tomaszgolebiowskiTomasz Gołębiowski
andauthored
Parsing insider version number (#381)
This fix adds support for parsing the Visual Studio 2026 Insider version number. ## Test plan N/A <!-- REQUIRED; info at https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles --> --------- Co-authored-by: Tomasz Gołębiowski <tgolebiowski@virtuslab.com>
1 parent f8dbd0d commit 4d8788a

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

src/Cody.VisualStudio.Tests/SmartApplyTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace Cody.VisualStudio.Tests
1414
{
15-
public class SmartApplyTests: PlaywrightTestsBase, IDisposable
15+
public class SmartApplyTests : PlaywrightTestsBase, IDisposable
1616
{
1717

1818
private readonly JoinableTaskContext _context = ThreadHelper.JoinableTaskContext;
@@ -57,7 +57,7 @@ public async Task Apply_Suggestion_Is_Modifying_Point_Document()
5757
Assert.NotEqual(modifiedText, originalText);
5858
}
5959

60-
[VsFact(Version = VsVersion.VS2022)]
60+
[VsFact(Version = VsVersion.VS2022, Skip = "Unstable")]
6161
public async Task Apply_Suggestion_Is_Modifying_Manager_Document()
6262
{
6363
// given
@@ -88,7 +88,7 @@ private async Task ApplyLastSuggestionFor(string chatText)
8888
if (hasHiddenClass)
8989
await apply.EvaluateAsync("element => element.classList.remove('tw-hidden')"); // force shows "Apply" text so it will be possible to click on it
9090

91-
await apply.ClickAsync(new() {Force = true});
91+
await apply.ClickAsync(new() { Force = true });
9292

9393
await EditAppliedAsync();
9494
}

src/Cody.VisualStudio/Services/VsVersionService.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using Cody.Core.Ide;
22
using Cody.Core.Logging;
3-
using Microsoft.VisualStudio.Settings;
43
using Microsoft.VisualStudio.Shell;
54
using System;
65
using System.Runtime.CompilerServices;
@@ -12,6 +11,8 @@ public class VsVersionService : IVsVersionService
1211
{
1312
private readonly ILog _logger;
1413

14+
private const string InsidersPrefix = "Insiders [";
15+
1516
public VsVersionService(ILog logger)
1617
{
1718
_logger = logger;
@@ -32,8 +33,16 @@ public VsVersionService(ILog logger)
3233

3334
private Version ParseVersion(string version)
3435
{
35-
int spaceIndex = version.IndexOf(' ');
36-
if (spaceIndex >= 0) version = version.Substring(0, spaceIndex).Trim();
36+
if (version.StartsWith(InsidersPrefix))
37+
{
38+
version = version.Substring(InsidersPrefix.Length);
39+
version = version.Replace("]", string.Empty);
40+
}
41+
else
42+
{
43+
int spaceIndex = version.IndexOf(' ');
44+
if (spaceIndex >= 0) version = version.Substring(0, spaceIndex).Trim();
45+
}
3746

3847
return Version.Parse(version);
3948
}

0 commit comments

Comments
 (0)