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

Push the two-step navigation system further through roslyn. #59802

Merged

Conversation

CyrusNajmabadi
Copy link
Member

Precursor to the background-work-indicator work.

Followup to #59801.

THis just takes the concept further as we have many navigation components taht call into each other. This way we can do as much work as possible in stage one and then return the deepest level stage-2 navigation step as possible.

@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review March 2, 2022 20:24
@CyrusNajmabadi CyrusNajmabadi requested review from a team as code owners March 2, 2022 20:24
@CyrusNajmabadi CyrusNajmabadi changed the base branch from main to release/dev17.3 March 2, 2022 20:24
@CyrusNajmabadi
Copy link
Member Author

@jasonmalinowski this is ready for review. Note: there continues to be more coming down the line :)

editorWorkspace, documentId, resolvedRenameToken.Span, cancellationToken).ConfigureAwait(false);

if (location != null &&
await location.NavigateToAsync(cancellationToken).ConfigureAwait(false))
Copy link
Member Author

Choose a reason for hiding this comment

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

not this pattern gets simpler in the next followup.

@CyrusNajmabadi
Copy link
Member Author

@jasonmalinowski this is ready for review.

Presenter._workspace, options, cancellationToken); // Only activate the tab if requested
public async Task NavigateToAsync(NavigationOptions options, CancellationToken cancellationToken)
{
// Only activate the tab if requested
Copy link
Member

Choose a reason for hiding this comment

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

Not sure the comment makes sense here?

@@ -117,6 +117,7 @@ private class ExternalDefinitionItem : DefinitionItem
public override Task<bool> CanNavigateToAsync(Workspace workspace, CancellationToken cancellationToken)
=> SpecializedTasks.True;

[Obsolete]
Copy link
Member

Choose a reason for hiding this comment

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

What is preventing deletion here?

Copy link
Member Author

Choose a reason for hiding this comment

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

i will look into this.

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 subclasses hte DefinitionItem guy that i'm not sure is totally isolated from TS/F#. I will figure out what the EA story is there and delete if i can in followup.

Comment on lines +131 to +132
if (!await this.CanNavigateToSpanAsync(workspace, documentId, textSpan, allowInvalidSpan, cancellationToken).ConfigureAwait(false))
return null;
Copy link
Member

Choose a reason for hiding this comment

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

GetNavigableLocationAsync won't already return null if it's not navigable here?

Copy link
Member

Choose a reason for hiding this comment

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

(comment applies to the other methods here)

Copy link
Member Author

Choose a reason for hiding this comment

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

it should... but i wanted to make absolutely sure there was no disagreement on behavior so this helps enforce that.

@@ -422,6 +397,23 @@ static VsTextSpan GetVsTextSpan(SourceText text, int position, int virtualSpace)
private static int GetPositionWithinDocumentBounds(int position, int documentLength)
=> Math.Min(documentLength, Math.Max(position, 0));

private static VsTextSpan GetVsTextSpan(SourceText text, TextSpan textSpan, bool allowInvalidSpan)
Copy link
Member

Choose a reason for hiding this comment

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

Not your doing, but oh goodness is a parameter called "allowInvalidSpan" terrifying.

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. for context. this allows us to use 'cached navto results from previous vs session' without having to do the costly work to ensure they're valid. IN a sense the feature is allowing navigation to invalid locations, albeit, with a message to the user that this may be happening. it enables huge speedups, but it means we need to be resilient to old data being stale and innacurate.

@CyrusNajmabadi
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 4 pipeline(s).

@CyrusNajmabadi CyrusNajmabadi merged commit fd728d5 into dotnet:release/dev17.3 Mar 4, 2022
@CyrusNajmabadi CyrusNajmabadi deleted the asyncNavigation4 branch May 3, 2022 22:06
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