Ignore updates with no changes for csharp files#8162
Conversation
JoeRobich
left a comment
There was a problem hiding this comment.
Say verbose logging was enabled. How many of these requests are we talking about?
~9x |
Will definitely notice that in the log |
| } | ||
|
|
||
| this.notifyDocumentChange(document, RazorDocumentChangeKind.closed); | ||
| this.notifyDocumentChange(document, RazorDocumentChangeKind.closed, []); |
There was a problem hiding this comment.
intentionally leaving these empty. For open/close/add/remove the changes are irrelevant.
| ); | ||
| this.documentManager.onChange(async (e) => { | ||
| if (e.kind == RazorDocumentChangeKind.csharpChanged && !e.document.isOpen) { | ||
| if (e.kind == RazorDocumentChangeKind.csharpChanged && !e.document.isOpen && e.changes.length > 0) { |
There was a problem hiding this comment.
this is the change that reduces updates. Even if our version is bumped as long as the csharp text didn't change no point in sending a notification to Roslyn
| ); | ||
| this.documentManager.onChange(async (e) => { | ||
| if (e.kind == RazorDocumentChangeKind.csharpChanged && !e.document.isOpen) { | ||
| if (e.kind == RazorDocumentChangeKind.csharpChanged && !e.document.isOpen && e.changes.length > 0) { |
There was a problem hiding this comment.
Thanks for walking through this with me offline! Since it's perf sensitive, consider adding a comment here to describe the conditions that we don't want to update the dynamic file info.
dibarbet
left a comment
There was a problem hiding this comment.
Fixes the issue on aspire for me
|
/backport to release |
|
Started backporting to release: https://github.com/dotnet/vscode-csharp/actions/runs/14393236954 |
Before #7826 razor would use textdocument/{open, changed, closed} for csharp changes. That would mean that if the text didn't actually change vs code wouldn't notify roslyn. After that change the notification is handled for closed files by the razorDocumentManager. This causes a loop where csharp generated -> workspace changed for generated csharp -> workspace listeners notifies change -> generation is queued -> change is reported -> workspace changed for csharp -> ....
This is a quicker fix to hopefully unblock while I investigate a more comprehensive fix on the razor side