Skip to content

Fix vb event generation in navbars#53876

Merged
CyrusNajmabadi merged 1 commit intodotnet:mainfrom
CyrusNajmabadi:vbNavBarEvents
Jun 4, 2021
Merged

Fix vb event generation in navbars#53876
CyrusNajmabadi merged 1 commit intodotnet:mainfrom
CyrusNajmabadi:vbNavBarEvents

Conversation

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

We need integration tests for this. That is tracked by: #53875

@CyrusNajmabadi CyrusNajmabadi requested a review from dibarbet June 4, 2021 02:49
@CyrusNajmabadi CyrusNajmabadi requested review from a team as code owners June 4, 2021 02:49
@ghost ghost added the Area-IDE label Jun 4, 2021
var workspace = document.Project.Solution.Workspace;
var navigationService = VSTypeScriptDocumentNavigationServiceWrapper.Create(workspace);
navigationService.TryNavigateToPosition(workspace, document.Id, item.Spans[0].Start, virtualSpace: 0, options: null, cancellationToken: cancellationToken);
return true;
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.

note: i'm preserving behavior for TS and F#. Neither of which have any sort of special 'type list item is selected, so update the member list' behavior like VB has.

// list. So selecting such an item should only update the member list, and we do not want a refresh
// to wipe that out.
if (!await navBarService.TryNavigateToItemAsync(document, item, view, cancellationToken).ConfigureAwait(true))
return;
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.

this regressed in: https://github.com/dotnet/roslyn/pull/52530/files#diff-902dbb57c78c6bbd71f7409a96a3db1dbd4813fb5658a069ef3b3b33da063a8aL305

THe reason for this is that the old code effectively would say: ok, something was selected. However the semantic version of the solution is the same, so i won't refresh anything.

The approach here is cleaner. If trying to navigate failed, there's no need for us to have our controller change anything, and we'll instead just let the view update accordingly.

Return True
End If

Return False
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.

this is the critical part of the change. We didn't navigate or generate, so this means the user effectively only picked the item just to get the refreshed navbars.

// ConfigureAwait(true) as we have to come back to UI thread in order to kick of the refresh task
// below. Note that we only want to refresh if selecting the item had an effect (either navigating
// or generating). If nothing happened to don't want to refresh. This is important as some items
// exist in the type list that are only there to show a set a particular set of items in the member
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.

Suggested change
// exist in the type list that are only there to show a set a particular set of items in the member
// exist in the type list that are only there to show a particular set of items in the member

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.

WIll do in next PR :)

@CyrusNajmabadi CyrusNajmabadi merged commit 4596487 into dotnet:main Jun 4, 2021
@ghost ghost added this to the Next milestone Jun 4, 2021
@CyrusNajmabadi CyrusNajmabadi deleted the vbNavBarEvents branch June 4, 2021 04:23
@RikkiGibson RikkiGibson modified the milestones: Next, 17.0.P2 Jun 29, 2021
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.

3 participants