Skip to content

Commit

Permalink
Invalidate self
Browse files Browse the repository at this point in the history
  • Loading branch information
georgewfraser committed Jul 3, 2018
1 parent 018bc43 commit d233f48
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/FSharpLanguageServer/ProjectManager.fs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type private ProjectCache() =
let knownProjects = new Dictionary<String, LazyProject>()

member this.Invalidate(fsprojOrFsx: FileInfo) =
knownProjects.Remove(fsprojOrFsx.FullName)
knownProjects.Remove(fsprojOrFsx.FullName) |> ignore
member this.Get(fsprojOrFsx: FileInfo, analyzeLater: FileInfo -> LazyProject): LazyProject =
if not(knownProjects.ContainsKey(fsprojOrFsx.FullName)) then
knownProjects.Add(fsprojOrFsx.FullName, analyzeLater(fsprojOrFsx))
Expand Down Expand Up @@ -313,14 +313,15 @@ type ProjectManager(checker: FSharpChecker) =

/// Invalidate all descendents of a modified .fsproj or .fsx file
let invalidateDescendents(fsprojOrFsx: FileInfo) =
cache.Invalidate(fsprojOrFsx)
for fileName in knownProjects do
let file = FileInfo(fileName)
let project = cache.Get(file, analyzeLater)
if project.resolved.IsValueCreated then
for _, ancestor in project.resolved.Value.options.ReferencedProjects do
if ancestor.ProjectFileName = fsprojOrFsx.FullName then
dprintfn "%s has been invalidated by changes to %s" ancestor.ProjectFileName fsprojOrFsx.Name
cache.Invalidate(FileInfo(ancestor.ProjectFileName)) |> ignore
cache.Invalidate(FileInfo(ancestor.ProjectFileName))

/// All transitive deps of anproject, including itself
let transitiveDeps(fsprojOrFsx: FileInfo) =
Expand Down

0 comments on commit d233f48

Please sign in to comment.