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

Document outline updates #69921

Merged
merged 3 commits into from
Sep 14, 2023
Merged

Conversation

sharwell
Copy link
Member

@sharwell sharwell requested a review from a team as a code owner September 12, 2023 21:57
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Sep 12, 2023
// Retry the update after a delay
_workQueue.AddWork(cancelExistingWork: true);
return;
}
Copy link
Member

Choose a reason for hiding this comment

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

instead of all 3, it likely suffices to just have teh first case. worst that happens is that the user switches away, and we finish up the work here. but any future work requsts will bail out at the top.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, that works for me

Copy link
Member Author

@sharwell sharwell Sep 12, 2023

Choose a reason for hiding this comment

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

On second thought, given the difficulty of proving the change works, I'm concerned about edge cases like switching back and forth between a Windows Forms designer and a C# source document (resulting in a visibility change for each switch). I'm more comfortable with the original change in terms of confidence that work is avoided when the UI is not visible. If you'd like, I could eliminate the middle of the three checks, though the explanation of why it's omitted might end up longer than the check itself.

@@ -282,7 +288,8 @@ private void SymbolTreeItem_SourceUpdated(object sender, DataTransferEventArgs e
{
var textView = _viewTracker.GetActiveView();
textView.TryMoveCaretToAndEnsureVisible(
symbolModel.Data.SelectionRangeSpan.TranslateTo(textView.TextSnapshot, SpanTrackingMode.EdgeInclusive).Start);
symbolModel.Data.SelectionRangeSpan.TranslateTo(textView.TextSnapshot, SpanTrackingMode.EdgeInclusive).Start,
_outliningManagerService);
Copy link
Member

Choose a reason for hiding this comment

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

how does this work, does this helper just know to expand in that case?

note: if so, it seems like a super weird helper since we'd always want htis behavior, in which case we should always require the outlining manager. but this is ok for now.

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 exactly my conclusion

@ToddGrun
Copy link
Contributor

        await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

Could the searchText, sortOption, and lastPresentedViewState locals be captured in the first time on the ui thread in this method, and thus not need this UI thread hop?


Refers to: src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineViewModel.cs:291 in 7404ed0. [](commit_id = 7404ed0, deletion_comment = False)

@CyrusNajmabadi
Copy link
Member

Could the searchText, sortOption, and lastPresentedViewState locals be captured in the first time on the ui thread in this method, and thus not need this UI thread hop?

only if changes to those are guaranteed to kick off new computation. otherwise you risk the user chnaging UI state and that not being respected when updating the UI with new results.

@sharwell
Copy link
Member Author

Could the searchText, sortOption, and lastPresentedViewState locals be captured in the first time on the ui thread in this method, and thus not need this UI thread hop?

The background work to compute the items in the document could take a noticeable amount of time, so I prefer to capture these variables after the long-running work is complete.

Copy link
Contributor

@ToddGrun ToddGrun left a comment

Choose a reason for hiding this comment

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

:shipit:

@arunchndr arunchndr changed the base branch from main to release/dev17.7 September 13, 2023 14:45
@arunchndr arunchndr merged commit b5c9211 into dotnet:release/dev17.7 Sep 14, 2023
19 of 24 checks passed
@sharwell sharwell deleted the doc-outline-updates branch September 14, 2023 02:27
@sharwell
Copy link
Member Author

sharwell commented Sep 22, 2023

@arkalyanms Do you know what version this will ship in?

@arunchndr
Copy link
Member

@arkalyanms Do you know what version this will ship in?

Its inserted into the next 17.7 servicing build. We are waiting on the final build next week. Barring any unexpected regressions, it should catch 17.7.5.

@sharwell sharwell added this to the 17.7.5 milestone Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE OnDeckForServicing untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
4 participants