Skip to content

Commit

Permalink
Fix for missing selection data
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasz Gołębiowski committed Jan 6, 2025
1 parent 8c4074e commit fb2c112
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
18 changes: 12 additions & 6 deletions src/Cody.Core/DocumentSync/DocumentSyncCallback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,10 @@ public void OnOpened(string fullPath, string content, DocumentRange visibleRange
};
}

var docState = new ProtocolTextDocument
Range selRange = null;
if(selection != null)
{
Uri = fullPath.ToUri(),
Content = content.ConvertLineBreaks("\n"),
VisibleRange = vRange,
Selection = new Range
selRange = new Range
{
Start = new Position
{
Expand All @@ -141,7 +139,15 @@ public void OnOpened(string fullPath, string content, DocumentRange visibleRange
Line = selection.End.Line,
Character = selection.End.Column
}
}
};
}

var docState = new ProtocolTextDocument
{
Uri = fullPath.ToUri(),
Content = content.ConvertLineBreaks("\n"),
VisibleRange = vRange,
Selection = selRange
};

agentService.DidOpen(docState);
Expand Down
2 changes: 1 addition & 1 deletion src/Cody.VisualStudio.Tests/ChatLoggedBasicTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public ChatLoggedBasicTests(ITestOutputHelper output) : base(output)
});
}

[VsFact(Version = VsVersion.VS2022)]
[VsFact(Version = VsVersion.VS2022, Skip = "Unstable")]
public async Task Solution_Name_Is_Added_To_Chat_Input()
{
// given
Expand Down
2 changes: 1 addition & 1 deletion src/Cody.VisualStudio.Tests/ChatNotLoggedStateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ await NotInLoggedState(async () =>

}

[VsFact(Version = VsVersion.VS2022)]
[VsFact(Version = VsVersion.VS2022, Skip = "Unstable")]
public async Task Cody_Enterprise_Section_Is_Present()
{
// given
Expand Down
4 changes: 2 additions & 2 deletions src/Cody.VisualStudio/Services/DocumentsSyncService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ public void Initialize()
var content = rdt.GetRunningDocumentContents(docCookie);
var textView = GetTextView(frame);
var visibleRange = GetVisibleRange(textView);
var docRange = GetDocumentSelection(textView);
var selection = GetDocumentSelection(textView);

documentActions.OnOpened(path, content, visibleRange, docRange);
documentActions.OnOpened(path, content, visibleRange, selection);
}
catch (Exception ex)
{
Expand Down

0 comments on commit fb2c112

Please sign in to comment.