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

Allow for alternate versions of documents to be semantically highlighted #2304

Merged
merged 2 commits into from
Dec 8, 2021

Conversation

JoeRobich
Copy link
Member

To fix diff highlighting in the VSCode C# extension, we need to pass along alternate versions of the document we are highlighting. Request has a Buffer property but populating that will invoke the updateBufferHandler when the request is handled (as alluded to in dotnet/vscode-csharp#4915 (comment)).

if (request is Request && _updateBufferHandler.Value != null)
{
var realRequest = request as Request;
if (!string.IsNullOrWhiteSpace(realRequest.FileName) && (realRequest.Buffer != null || realRequest.Changes != null))
{
await _updateBufferHandler.Value.Process(packet, model, requestObject);
}
}

This PR adds an optional VersionedText property to the highlight request which can carry the alternate version of the document contents. The highlight service will then swap the document text for the duration of the request when it is populated.

Copy link
Member

@filipw filipw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! 👏

@filipw filipw merged commit 8ddf23f into OmniSharp:master Dec 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants