Skip to content

Commit 0c1f673

Browse files
fixed: ProjectCracker returns empty ProjectFileName list
fixed: ProjectCracker returns unnormalized (regarding to platform) ProjectFileName list, which causes symbols to be not equal while Find Usages performs
1 parent 427a0b6 commit 0c1f673

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/fsharp/FSharp.Compiler.Service.ProjectCracker/ProjectCracker.fs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ open System.IO
1010
open System
1111

1212
type ProjectCracker =
13-
1413
static member GetProjectOptionsFromProjectFileLogged(projectFileName : string, ?properties : (string * string) list, ?loadedTimeStamp, ?enableLogging) =
1514
let loadedTimeStamp = defaultArg loadedTimeStamp DateTime.MaxValue // Not 'now', we don't want to force reloading
1615
let properties = defaultArg properties []
@@ -19,10 +18,22 @@ type ProjectCracker =
1918

2019
let rec convert (opts: Microsoft.FSharp.Compiler.SourceCodeServices.ProjectCrackerTool.ProjectOptions) : FSharpProjectOptions =
2120
let referencedProjects = Array.map (fun (a, b) -> a, convert b) opts.ReferencedProjectOptions
21+
let sourceFiles, otherOptions =
22+
opts.Options |> Array.partition (fun x -> x.EndsWith (".fs", StringComparison.InvariantCultureIgnoreCase))
23+
24+
let sepChar = Path.DirectorySeparatorChar
25+
26+
let sourceFiles = sourceFiles |> Array.map (fun x ->
27+
match sepChar with
28+
| '\\' -> x.Replace('/', '\\')
29+
| '/' -> x.Replace('\\', '/')
30+
| _ -> x
31+
)
32+
2233
logMap := Map.add opts.ProjectFile opts.LogOutput !logMap
2334
{ ProjectFileName = opts.ProjectFile
24-
ProjectFileNames = [| |]
25-
OtherOptions = opts.Options
35+
ProjectFileNames = sourceFiles
36+
OtherOptions = Array.append otherOptions sourceFiles
2637
ReferencedProjects = referencedProjects
2738
IsIncompleteTypeCheckEnvironment = false
2839
UseScriptResolutionRules = false

0 commit comments

Comments
 (0)