Add support for navigation to mapped file paths.#45956
Merged
dibarbet merged 8 commits intodotnet:release/dev16.8-preview1from Jul 21, 2020
Merged
Add support for navigation to mapped file paths.#45956dibarbet merged 8 commits intodotnet:release/dev16.8-preview1from
dibarbet merged 8 commits intodotnet:release/dev16.8-preview1from
Conversation
This supports go to def / impl / far from a c# file to a razor file.
dibarbet
commented
Jul 14, 2020
| public bool TryNavigateToSpan(Workspace workspace, DocumentId documentId, TextSpan textSpan, OptionSet options) | ||
| { | ||
| // Navigation should not change the context of linked files and Shared Projects. | ||
| documentId = workspace.GetDocumentIdInCurrentContext(documentId); |
Member
Author
There was a problem hiding this comment.
All the logic in this method was duplicated across multiple methods, I just combined them all.
There's basically 3 different parameters - TextSpan, line position + character, and just position. The APIs we call require both a TextSpan (just a start and end location) or a VsTextSpan(line positions + characters)
dibarbet
commented
Jul 14, 2020
|
|
||
| static VsTextSpan GetVsTextSpan(SourceText text, int position, int virtualSpace) | ||
| { | ||
| var boundedPosition = GetPositionWithinDocumentBounds(position, text.Length); |
Member
Author
There was a problem hiding this comment.
moved from line 225 in original file
dibarbet
commented
Jul 14, 2020
| { | ||
| var document = OpenDocument(workspace, documentId); | ||
| // Before attempting to open the document, check if the location maps to a different file that should be opened instead. | ||
| var document = workspace.CurrentSolution.GetDocument(documentId); |
dibarbet
commented
Jul 14, 2020
| } | ||
| } | ||
|
|
||
| private bool TryNavigateToMappedFile(Workspace workspace, ISpanMappingService spanMappingService, Document generatedDocument, TextSpan textSpan) |
Member
Author
There was a problem hiding this comment.
this is also entirely new logic.
Member
Author
src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioDocumentNavigationService.cs
Outdated
Show resolved
Hide resolved
src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioDocumentNavigationService.cs
Outdated
Show resolved
Hide resolved
src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioDocumentNavigationService.cs
Outdated
Show resolved
Hide resolved
src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioDocumentNavigationService.cs
Outdated
Show resolved
Hide resolved
src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioDocumentNavigationService.cs
Outdated
Show resolved
Hide resolved
src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioDocumentNavigationService.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: CyrusNajmabadi <cyrus.najmabadi@gmail.com>
jasonmalinowski
previously requested changes
Jul 14, 2020
Member
jasonmalinowski
left a comment
There was a problem hiding this comment.
This is potentially adding a deadlock risk because of use of GetService in a MEF constructor; that definitely needs to be fixed up. Other comments are less critical. 😄
...ualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioWorkspaceImpl.OpenFileTracker.cs
Show resolved
Hide resolved
src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioDocumentNavigationService.cs
Outdated
Show resolved
Hide resolved
src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioDocumentNavigationService.cs
Show resolved
Hide resolved
src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioDocumentNavigationService.cs
Show resolved
Hide resolved
src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioDocumentNavigationService.cs
Show resolved
Hide resolved
src/VisualStudio/Core/Def/Implementation/ProjectSystem/RunningDocumentTableEventTracker.cs
Show resolved
Hide resolved
src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioDocumentNavigationService.cs
Outdated
Show resolved
Hide resolved
src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioDocumentNavigationService.cs
Show resolved
Hide resolved
src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioWorkspaceImpl.cs
Show resolved
Hide resolved
src/VisualStudio/Core/Def/Implementation/Workspace/VisualStudioDocumentNavigationService.cs
Outdated
Show resolved
Hide resolved
JoeRobich
approved these changes
Jul 21, 2020
src/VisualStudio/Core/Def/Implementation/ProjectSystem/RunningDocumentTableEventTracker.cs
Outdated
Show resolved
Hide resolved
Member
Author
|
@jinujoseph for m2 approval |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This supports go to def / impl / far from a c# file to a razor file.
With #45954 we can remove a bit of the logic around opening the file and reading the RDT.
Resolves #45767 and partially #45063 TODO).