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

Update go-to-def handler to support entirely async go-to-def operation. #59801

Merged

Conversation

CyrusNajmabadi
Copy link
Member

Precursor to the BackgroundWorkIndicator work.

Followup to #59798

@CyrusNajmabadi CyrusNajmabadi changed the base branch from main to release/dev17.3 March 1, 2022 20:07
@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review March 1, 2022 20:08
@CyrusNajmabadi
Copy link
Member Author

@jasonmalinowski this is ready for review. note: the actual changes are pretty small. it's just the mechanical test changs that bloated the PR.

Copy link
Member

@jasonmalinowski jasonmalinowski left a comment

Choose a reason for hiding this comment

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

Generally approved, with one caveat that there's an errant edit to the VisualBasicGoToDefinitionTests which wasn't what you wanted. (That's flagged with a specific comment.)

Comment on lines 57 to 58
public bool TryGoToDefinition(Document document, int position, CancellationToken cancellationToken)
=> throw new NotImplementedException("Use FindDefinitionLocationAsync instead.");
Copy link
Member

Choose a reason for hiding this comment

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

Why is this method here at all at this point?

Copy link
Member Author

Choose a reason for hiding this comment

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

yup. nasty. will fixup.

Copy link
Member Author

Choose a reason for hiding this comment

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

removed

Comment on lines 136 to 137
return await _streamingPresenter.GetNavigableLocationAsync(
_threadingContext, solution.Workspace, title, definitions, cancellationToken).ConfigureAwait(false);
Copy link
Member

Choose a reason for hiding this comment

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

Seems a bit odd this is a method on the streaming presenter here?

Copy link
Member

Choose a reason for hiding this comment

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

Ah: I see it's also displaying the items too; should this still be called PresentAndGetItems? Or what happens if we're presenting and then nothing further is shown?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah... this guy is funky in that it gets back an object that can optionally navigate you to a since location (if there is one) or which actually displayes the presenter if there are many. Importantly though, that presentation/navigation only happens on the stage-2 of the navigation. will think on a better name here.

@@ -88,27 +87,27 @@ internal static class IStreamingFindUsagesPresenterExtensions
// If we're directly going to a location we need to activate the preview so
// that focus follows to the new cursor position. This behavior is expected
// because we are only going to navigate once successfully
if (await item.TryNavigateToAsync(workspace, new NavigationOptions(PreferProvisionalTab: true, ActivateTab: true), cancellationToken).ConfigureAwait(false))
return true;
return new NavigableLocation(cancellationToken => item.TryNavigateToAsync(workspace, options, cancellationToken));
Copy link
Member

Choose a reason for hiding this comment

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

I'm now confused why we introduced INavigableLocation when we also had an INavigableItem here. (I swore we had something earlier but couldn't remember what it was called...now I know. 😄)

Copy link
Member Author

Choose a reason for hiding this comment

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

So NavigableItem truly is "i have a single document and a span and i will go to that". INavigableItem encapsulates the idea of just anything generic that can be navigated to. You've seen already taht one example of that with the streaming-presenter 'navigating' by presenting a set of results. Other examples include calling out to 3rd parties to take over the navigation (we call this '3rd party navigation) and take the user somewhere.

@CyrusNajmabadi CyrusNajmabadi merged commit ec27179 into dotnet:release/dev17.3 Mar 2, 2022
@CyrusNajmabadi CyrusNajmabadi deleted the asyncNavigation3 branch March 2, 2022 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants