Skip to content

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

Merged
filipw merged 2 commits intoOmniSharp:masterfrom
JoeRobich:versioned-document-highlight
Dec 8, 2021
Merged

Allow for alternate versions of documents to be semantically highlighted#2304
filipw merged 2 commits intoOmniSharp:masterfrom
JoeRobich:versioned-document-highlight

Conversation

@JoeRobich
Copy link
Copy Markdown
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
Copy Markdown
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