Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for missing selection data #193

Merged
merged 2 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
tomaszgolebiowski marked this conversation as resolved.
Show resolved Hide resolved
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
Loading