Skip to content

Commit

Permalink
options.ReferencesOnDisk are not part of options.OtherOptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf committed Mar 4, 2024
1 parent a2ed82b commit e8245d1
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ type FcsProject =
for option in projectSnapshot.OtherOptions do
writer.WriteLine($" {option}")

writer.WriteLine("References on disk:")
for r in projectSnapshot.ReferencesOnDisk do
writer.WriteLine($" %s{r.Path}")

writer.WriteLine("Referenced projects:")
for referencedProject in projectSnapshot.ReferencedProjects do
writer.WriteLine($" {referencedProject.OutputFile}")
Expand Down Expand Up @@ -97,6 +101,7 @@ type FcsCheckerService(lifetime: Lifetime, logger: ILogger, onSolutionCloseNotif
let setting = SettingsUtil.getEntry<FSharpOptions> settingsStore name
settingsStoreLive.GetValueProperty(lifetime, setting, null)

// Hard coded for now.
let useTransparentCompiler = true
// (getSettingProperty "UseTransparentCompiler").Value

Expand Down Expand Up @@ -180,6 +185,7 @@ type FcsCheckerService(lifetime: Lifetime, logger: ILogger, onSolutionCloseNotif

x.FcsProjectProvider.PrepareAssemblyShim(psiModule)

// TODO: should this be the non virtual path?
let path = sourceFile.GetLocation().FullPath
let source = FcsCheckerService.getSourceText sourceFile.Document
logger.Trace("ParseAndCheckFile: start {0}, {1}", path, opName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ type FcsProjectProvider(lifetime: Lifetime, solution: ISolution, changeManager:
newOptions.ProjectFileName = oldOptions.ProjectFileName &&
newOptions.SourceFiles = oldOptions.SourceFiles &&
newOptions.OtherOptions = oldOptions.OtherOptions &&
newOptions.ReferencesOnDisk = oldOptions.ReferencesOnDisk &&

newOptions.ReferencedProjects.Length = oldOptions.ReferencedProjects.Length &&
(newOptions.ReferencedProjects, oldOptions.ReferencedProjects)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ type ScriptFcsProjectProvider(lifetime: Lifetime, logger: ILogger, checkerServic
List.length l1 = List.length l2 && List.forall2 (=) l1 l2

listEq options1.OtherOptions options2.OtherOptions &&
listEq options1.ReferencesOnDisk options2.ReferencesOnDisk &&
listEq options1.SourceFiles options2.SourceFiles

if not (areEqualForChecking oldOptions.ProjectSnapshot newSnapshot) then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,9 @@ type FSharpScriptPsiModulesProvider(lifetime: Lifetime, solution: ISolution, cha

let getScriptReferences (scriptPath: VirtualFileSystemPath) (scriptSnapshot: FSharpProjectSnapshot) =
let assembliesPaths = HashSet<VirtualFileSystemPath>()
for o in scriptSnapshot.OtherOptions do
if o.StartsWith("-r:", StringComparison.Ordinal) then
let path = VirtualFileSystemPath.TryParse(o.Substring(3), InteractionContext.SolutionContext)
if not path.IsEmpty then assembliesPaths.Add(path) |> ignore
for { Path = r } in scriptSnapshot.ReferencesOnDisk do
let path = VirtualFileSystemPath.TryParse(r, InteractionContext.SolutionContext)
if not path.IsEmpty then assembliesPaths.Add(path) |> ignore

let filesPaths = HashSet<VirtualFileSystemPath>()
for file in scriptSnapshot.SourceFiles do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ type FSharpTestHost(solution: ISolution, sourceCache: FSharpSourceCache, itemsCo

projectProvider.GetProjectSnapshot(sourceFile)
|> Option.map (fun options ->
options.OtherOptions
|> List.choose (fun o -> if o.StartsWith("-r:") then Some (o.Substring("-r:".Length)) else None)
|> List.map (fun p -> VirtualFileSystemPath.TryParse(p, InteractionContext.SolutionContext))
options.ReferencesOnDisk
|> List.map (fun { Path = p } -> VirtualFileSystemPath.TryParse(p, InteractionContext.SolutionContext))
|> List.filter (fun p -> not p.IsEmpty && directory.IsPrefixOf(p))
|> List.map (fun p -> p.Name)
|> List)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ type TestFcsProjectProvider(lifetime: Lifetime, checkerService: FcsCheckerServic
newOptions.ProjectFileName = oldOptions.ProjectFileName &&
newOptions.SourceFiles = oldOptions.SourceFiles &&
newOptions.OtherOptions = oldOptions.OtherOptions &&
newOptions.ReferencesOnDisk = oldOptions.ReferencesOnDisk &&
getReferencedProjectOutputs newOptions = getReferencedProjectOutputs oldOptions

let getFcsProject (psiModule: IPsiModule) =
Expand Down

0 comments on commit e8245d1

Please sign in to comment.