Skip to content

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

Merged
CyrusNajmabadi merged 20 commits intodotnet:release/dev17.3from
CyrusNajmabadi:asyncNavigation3
Mar 2, 2022
Merged

Update go-to-def handler to support entirely async go-to-def operation.#59801
CyrusNajmabadi merged 20 commits intodotnet:release/dev17.3from
CyrusNajmabadi:asyncNavigation3

Conversation

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

Precursor to the BackgroundWorkIndicator work.

Followup to #59798

@CyrusNajmabadi CyrusNajmabadi requested review from a team as code owners February 27, 2022 03:36
@CyrusNajmabadi CyrusNajmabadi requested a review from a team February 27, 2022 03:36
@ghost ghost added the Area-IDE label Feb 27, 2022
@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
Copy Markdown
Contributor 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.

@CyrusNajmabadi CyrusNajmabadi requested a review from dibarbet March 1, 2022 21:38
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor 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
Copy Markdown
Contributor 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor 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.

// 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
Copy Markdown
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
Copy Markdown
Contributor 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 enabled auto-merge March 2, 2022 02:07
@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