-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Apply changes directly to text buffer #62337
Conversation
@CyrusNajmabadi PTAL |
|
||
workspace.ApplyDocumentChanges(formattedDocument, cancellationToken); | ||
transaction.Complete(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the part i'm least comfortable with. can you smoke test this otu a bit?
I don't understand this part though, how to apply changes via |
@genlu We have an extension method that does that:
I should have perhaps said a combination of GetTextChangesAsync, UpdateDocument and TryApplyChanges. Workspace.TryApplyChanges actually also runs async task and waits for it :-/
|
Thanks for the explanation, looks like we'd see UI delay improvement in completion commit action for sure with this change👍 |
That's the hope :) |
* upstream/main: (62 commits) Prevent assert from being hit (dotnet#62366) Don't offer '??=' for pointer types (dotnet#62476) Integrate generator times into /reportAnalyzer (dotnet#61661) Switch to a callback for cleaning up resources instead of passing in an explicit IDisposable. (dotnet#62373) Filter trees to only those containing global-usings or attributes prior to analyzing them. (dotnet#62444) Update PublishData.json Complete 'file' support for `SyntaxGenerator` (dotnet#62413) Apply changes directly to text buffer (dotnet#62337) Remove LangVer check from extended nameof binding (dotnet#62339) Fixed shared project file error (dotnet#62466) Handle new error codes Use MSBuid generated property for package path Exclude BCL libraries from Roslyn vsix Bump the integration test timeouts a bit Skip the balanced switch dispatch optimization for patterns on floating-point inputs (dotnet#62322) Test helpers shouldn't escape quotes by default (dotnet#62321) Reuse prior TableEntry values in the increment NodeTable builder if possible. (dotnet#62320) Install 3.1 runtime for SBOM tool Generate VS SBOM during official build. Minor refactoring in 'required' handling for override completion (dotnet#62422) ...
…dotnet#62589)" This reverts commit 0a39dcf.
…dotnet#62589)" This reverts commit 0a39dcf.
…dotnet#62589)" This reverts commit 0a39dcf.
…dotnet#62589)" This reverts commit 0a39dcf.
* Revert "Revert "Apply changes directly to text buffer (dotnet#62337)" (dotnet#62589)" This reverts commit 0a39dcf. * Apply changes to ContainedDocument subject buffer
Some command handlers apply changes to workspace via
GetTextChangesAsync
, which may block the UI thread until a background task is complete. This change updates these handlers to apply the changes directly to the editor buffer.Contributes to #57554
Validation PR: https://dev.azure.com/devdiv/DevDiv/_git/VS/pullrequest/409315