Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1422322

Browse files
vasily-kirichenkoKevinRansom
authored andcommitted
Fix go to definition to symbols defined in referenced assemblies and have not normalized file paths (#3773)
* fix Solution.TryGetDocumentFromPath for relative paths* temp logging* debug* normalize range.filename in TaskPickle* remove debug* Revert "normalize range.filename in TaskPickle"This reverts commit 31967a5833b566ad3cfb6270d685c0eb012d38f5.* normalize full paths in mkRange* remove null check
1 parentd2cb414 commit1422322

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

‎src/fsharp/range.fs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,11 @@ type range(code:int64) =
170170
overrider.Equals(obj)=match objwith:? rangeas r2-> code= r2.Code|_->false
171171
overrider.GetHashCode()= hash code
172172

173-
letmkRange f b e= range(fileIndexOfFile f, b, e)
173+
letmkRange f b e=
174+
// remove relative parts from full path
175+
letnormalizedFilePath=if Path.IsPathRooted fthentry Path.GetFullPath fwith_-> felse f
176+
range(fileIndexOfFile normalizedFilePath, b, e)
177+
174178
letmkFileIndexRange fi b e= range(fi, b, e)
175179

176180
(* end representation, start derived ops*)

‎vsintegration/src/FSharp.Editor/Common/CodeAnalysisExtensions.fs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ module internal Microsoft.VisualStudio.FSharp.Editor.CodeAnalysisExtensions
33

44
openMicrosoft.CodeAnalysis
55
openMicrosoft.FSharp.Compiler.Range
6+
openSystem.IO
67

78
typeProjectwith
89

@@ -41,7 +42,9 @@ type Solution with
4142

4243
/// Try to find the documentId corresponding to the provided filepath within this solution
4344
memberself.TryGetDocumentFromPath filePath=
44-
self.GetDocumentIdsWithFilePath filePath
45+
// It's crucial to normalize file path here (specificaly, remove relative parts),
46+
// otherwise Roslyn does not find documents.
47+
self.GetDocumentIdsWithFilePath(Path.GetFullPath filePath)
4548
|> Seq.tryHead|> Option.map(fun docId-> self.GetDocument docId)
4649

4750

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp