-
Notifications
You must be signed in to change notification settings - Fork 790
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
Quickinfo Tooltip and GotoDefinition Navigation Improvements #2683
Merged
KevinRansom
merged 29 commits into
dotnet:master
from
cloudRoutine:navigable-improvements
Apr 3, 2017
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
e293b8c
full type name in tooltip, provisional tab preferred
majocha da8c8d1
more entities made navigable
majocha 4f64530
use IGoToDefinition service
majocha fd885b3
this is used only here
majocha ed3f702
MEF import FSharpGotoDefinitionService into QuickInfoProvider
cloudRoutine cf9dc1a
speed up gotoDefinition
cloudRoutine 41e70c3
additional GotoDefn navigation strategies
cloudRoutine b47ff45
quickinfo navigation stays in its lane
cloudRoutine c2820d7
fix unittests
cloudRoutine 684a3db
restore recursive matchingDoc
cloudRoutine 6f55b66
asynchronous navigation from tooltips
cloudRoutine d649de8
fix cross project .fs -> .fs and .fsi -> .fsi Navigation
cloudRoutine d3f695e
cleanup and extra documentation
cloudRoutine 449fe02
missed this one
majocha 032dbb2
gotodefinition sig <-> impl at declaration location
cloudRoutine eddee9e
Merge pull request #1 from majocha/cR-navigable
cloudRoutine 6fa19e3
fix async workflow
cloudRoutine 00df745
animate status bar search and timeout on msgs
cloudRoutine b21a41a
Better links styling
majocha b661fb5
Merge pull request #2 from majocha/navigable-improvements
cloudRoutine 5bbb077
Merge remote-tracking branch 'Microsoft/master' into navigable-improv…
cloudRoutine e0f8161
integrate sig doccoms
cloudRoutine 0709e17
fix error introduced by prior merge
cloudRoutine 9b49be6
fixed invalid type access in `getUnusedOpens`
cloudRoutine d5b8980
fix invalid span bug in `symbolIsFullyQualified`
cloudRoutine 926c754
check if normalized doccom text matches
cloudRoutine 597dc4a
cleanup status bar usage
cloudRoutine 0ee04af
fix underline pen position, code cleanup and formatting
vasily-kirichenko c19adce
do not show links for symbol itself
vasily-kirichenko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
108 changes: 108 additions & 0 deletions
108
vsintegration/src/FSharp.Editor/Common/CodeAnalysisExtensions.fs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
[<AutoOpen>] | ||
module internal Microsoft.VisualStudio.FSharp.Editor.CodeAnalysisExtensions | ||
|
||
open Microsoft.CodeAnalysis | ||
open Microsoft.FSharp.Compiler.Range | ||
|
||
type Project with | ||
|
||
/// Returns the projectIds of all projects within the same solution that directly reference this project | ||
member this.GetDependentProjectIds () = | ||
this.Solution.GetProjectDependencyGraph().GetProjectsThatDirectlyDependOnThisProject this.Id | ||
|
||
|
||
/// Returns all projects within the same solution that directly reference this project. | ||
member this.GetDependentProjects () = | ||
this.Solution.GetProjectDependencyGraph().GetProjectsThatDirectlyDependOnThisProject this.Id | ||
|> Seq.map this.Solution.GetProject | ||
|
||
|
||
/// Returns the ProjectIds of all of the projects that this project directly or transitively depneds on | ||
member this.GetProjectIdsOfAllProjectsThisProjectDependsOn () = | ||
let graph = this.Solution.GetProjectDependencyGraph() | ||
let transitiveDependencies = graph.GetProjectsThatThisProjectTransitivelyDependsOn this.Id | ||
let directDependencies = graph.GetProjectsThatThisProjectDirectlyDependsOn this.Id | ||
Seq.append directDependencies transitiveDependencies | ||
|
||
|
||
/// The list all of the projects that this project directly or transitively depneds on | ||
member this.GetAllProjectsThisProjectDependsOn () = | ||
this.GetProjectIdsOfAllProjectsThisProjectDependsOn () | ||
|> Seq.map this.Solution.GetProject | ||
|
||
|
||
type Solution with | ||
|
||
/// Try to get a document inside the solution using the document's name | ||
member self.TryGetDocumentNamed docName = | ||
self.Projects |> Seq.tryPick (fun proj -> | ||
proj.Documents |> Seq.tryFind (fun doc -> doc.Name = docName)) | ||
|
||
|
||
/// Try to find the documentId corresponding to the provided filepath within this solution | ||
member self.TryGetDocumentFromPath filePath = | ||
self.GetDocumentIdsWithFilePath filePath | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will sometimes fail because FSharp often returns file paths like e.g. |
||
|> Seq.tryHead |> Option.map (fun docId -> self.GetDocument docId) | ||
|
||
|
||
/// Try to get a project inside the solution using the project's id | ||
member self.TryGetProject (projId:ProjectId) = | ||
if self.ContainsProject projId then Some (self.GetProject projId) else None | ||
|
||
|
||
/// Returns the projectIds of all projects within this solution that directly reference the provided project | ||
member self.GetDependentProjects (projectId:ProjectId) = | ||
self.GetProjectDependencyGraph().GetProjectsThatDirectlyDependOnThisProject projectId | ||
|> Seq.map self.GetProject | ||
|
||
|
||
/// Returns the projectIds of all projects within this solution that directly reference the provided project | ||
member self.GetDependentProjectIds (projectId:ProjectId) = | ||
self.GetProjectDependencyGraph().GetProjectsThatDirectlyDependOnThisProject projectId | ||
|
||
|
||
/// Returns the ProjectIds of all of the projects that directly or transitively depends on | ||
member self.GetProjectIdsOfAllProjectReferences (projectId:ProjectId) = | ||
let graph = self.GetProjectDependencyGraph() | ||
let transitiveDependencies = graph.GetProjectsThatThisProjectTransitivelyDependsOn projectId | ||
let directDependencies = graph.GetProjectsThatThisProjectDirectlyDependsOn projectId | ||
Seq.append directDependencies transitiveDependencies | ||
|
||
|
||
/// Returns all of the projects that this project that directly or transitively depends on | ||
member self.GetAllProjectsThisProjectDependsOn (projectId:ProjectId) = | ||
self.GetProjectIdsOfAllProjectReferences projectId | ||
|> Seq.map self.GetProject | ||
|
||
|
||
/// Try to retrieve the corresponding DocumentId for the range's file in the solution | ||
/// and if a projectId is provided, only try to find the document within that project | ||
/// or a project referenced by that project | ||
member self.TryGetDocumentIdFromFSharpRange (range:range,?projectId:ProjectId) = | ||
|
||
let filePath = System.IO.Path.GetFullPathSafe range.FileName | ||
let checkProjectId (docId:DocumentId) = | ||
if projectId.IsSome then docId.ProjectId = projectId.Value else false | ||
//The same file may be present in many projects. We choose one from current or referenced project. | ||
let rec matchingDoc = function | ||
| [] -> None | ||
| (docId:DocumentId)::_ when checkProjectId docId -> Some docId | ||
| docId::tail -> | ||
match projectId with | ||
| Some projectId -> | ||
if self.GetDependentProjectIds docId.ProjectId |> Seq.contains projectId | ||
then Some docId | ||
else matchingDoc tail | ||
| None -> Some docId | ||
|
||
self.GetDocumentIdsWithFilePath filePath |> List.ofSeq |> matchingDoc | ||
|
||
|
||
/// Try to retrieve the corresponding Document for the range's file in the solution | ||
/// and if a projectId is provided, only try to find the document within that project | ||
/// or a project referenced by that project | ||
member self.TryGetDocumentFromFSharpRange (range:range,?projectId:ProjectId) = | ||
match projectId with | ||
| Some projectId -> self.TryGetDocumentIdFromFSharpRange (range, projectId) | ||
| None -> self.TryGetDocumentIdFromFSharpRange range | ||
|> Option.map self.GetDocument |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unneeded change. (This function was moved up a few lines to capture full type name but that is not implemented now)