Skip to content

Conversation

@CyrusNajmabadi
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi commented Mar 15, 2023

This is showing up as extremely expensive in code action application, as some code actions track the whole tree, which adds hundreds of thousands of nodes to a CWT with annotations.

We're reverting back to the original design/impl here as it's extremely trivial and has almost no perf overhead. The single case that needed this behavior is much better served by a dedicated 2-line fix within the feature itself.

@ghost ghost added the Area-IDE label Mar 15, 2023
destinationEditor.SemanticModel.Compilation,
node,
node.GetCurrentNode(newDestination),
node.GetAnnotatedNodes(s_destinationNodeAnnotation).FirstOrDefault(),
Copy link
Member Author

Choose a reason for hiding this comment

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

this was the bad line. They were basically trying to find this totally fresh node in the current root. but that totally fresh node was already morphed into a different node when teh replacement happened. Trivial fix is to just use our own annotation to track it, instead of the editor tracking all nodes.

@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review March 15, 2023 19:17
@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner March 15, 2023 19:17
@CyrusNajmabadi
Copy link
Member Author

@mavasani @ToddGrun this is ready for review. In all of roslyn, it looks like there was only one feature that depended on this, and that feature is pretty funky to begin with wrt how it's using editors. :)

@ToddGrun
Copy link
Contributor

        var nodes = Enumerable.Distinct(_changes.Where(c => OriginalRoot.Contains(c.OriginalNode))

Was added in the PR this is essentially reverting. Still needed?


Refers to: src/Workspaces/Core/Portable/Editing/SyntaxEditor.cs:108 in 9d46e37. [](commit_id = 9d46e37, deletion_comment = False)

@CyrusNajmabadi
Copy link
Member Author

Was added in the PR this is essentially reverting. Still needed?

hrmm... i would think so. otehrwise i'm not sure how we would find the node after edits... teh tracking of change.OriginalNode seems very important...

Copy link
Contributor

@mavasani mavasani left a comment

Choose a reason for hiding this comment

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

Awesome!

@CyrusNajmabadi CyrusNajmabadi merged commit 5de1a7f into dotnet:main Mar 16, 2023
@CyrusNajmabadi CyrusNajmabadi deleted the syntaxEditor branch March 16, 2023 05:44
@ghost ghost added this to the Next milestone Mar 16, 2023
@allisonchou allisonchou modified the milestones: Next, 17.6 P3 Mar 28, 2023
CyrusNajmabadi added a commit to CyrusNajmabadi/roslyn that referenced this pull request Mar 29, 2023
…tor"

This reverts commit 5de1a7f, reversing
changes made to 69efd11.
arunchndr added a commit that referenced this pull request Mar 29, 2023
Revert "Remove descendent node tracking from SyntaxEditor #67314" from 17.6
@mavasani mavasani added the Performance-Scenario-Diagnostics This issue affects diagnostics computation performance for lightbulb, background analysis, tagger. label May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-IDE Performance-Scenario-Diagnostics This issue affects diagnostics computation performance for lightbulb, background analysis, tagger.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants