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

Avoid linking back to the original TreeSource in document state updates if the associated lazy is already completed #75355

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,11 @@ public DocumentState UpdateTextAndTreeContents(
// We only need to look one deep here as we'll pull that tree source forward to our level. If another link is
// later added to us, it will do the same thing.
var originalTreeSource = this.TreeSource;
if (originalTreeSource is LinkedFileReuseTreeAndVersionSource linkedFileTreeAndVersionSource)
if (originalTreeSource is LinkedFileReuseTreeAndVersionSource linkedFileTreeAndVersionSource
&& !linkedFileTreeAndVersionSource.TryGetValue(out var _))
Copy link
Member

Choose a reason for hiding this comment

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

this def needs docs.

Copy link
Member

Choose a reason for hiding this comment

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

alternatively, if you are able to get the value from the linkedSource, why not pass it along instead? And if you can't, you defer to the original tree source it points to.

Also, i think we should doc .OriginalTreeSource. Mention that it's there to produce a long chain if we haven't computed the intermediary steps. But if we have, we'll use that value instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved code around a bit and added some comments.

{
originalTreeSource = linkedFileTreeAndVersionSource.OriginalTreeSource;
}

// Always pass along the sibling text. We will always be in sync with that.

Expand Down
Loading