@@ -22,18 +22,15 @@ open System.Threading
2222open Microsoft.VisualStudio .Shell .Interop
2323open Microsoft.VisualStudio .LanguageServices .Implementation .TaskList
2424
25- type private CpsStamp = DateTime
26-
2725[<AutoOpen>]
2826module private FSharpProjectOptionsHelpers =
2927
30- let mapCpsProjectToSite ( workspace : VisualStudioWorkspaceImpl , project : Project , serviceProvider : System.IServiceProvider , cpsCommandLineOptions : IDictionary < ProjectId , CpsStamp * string [] * string []>) =
28+ let mapCpsProjectToSite ( workspace : VisualStudioWorkspaceImpl , project : Project , serviceProvider : System.IServiceProvider , cpsCommandLineOptions : IDictionary < ProjectId , string [] * string []>) =
3129let hier = workspace.GetHierarchy( project.Id)
32- let cpsStampOpt , sourcePaths , referencePaths , options =
30+ let sourcePaths , referencePaths , options =
3331match cpsCommandLineOptions.TryGetValue( project.Id) with
34- | true , ( cpsStamp, sourcePaths, options) -> Some( cpsStamp), sourcePaths, [||], options
35- | false , _ -> None, [||], [||], [||]
36- cpsStampOpt,
32+ | true , ( sourcePaths, options) -> sourcePaths, [||], options
33+ | false , _ -> [||], [||], [||]
3734{
3835new IProvideProjectSitewith
3936member x.GetProjectSite () =
@@ -94,9 +91,9 @@ type private FSharpProjectOptionsReactor (workspace: VisualStudioWorkspaceImpl,
9491let cancellationTokenSource = new CancellationTokenSource()
9592
9693// Hack to store command line options from HandleCommandLineChanges
97- let cpsCommandLineOptions = new ConcurrentDictionary< ProjectId, DateTime * string[] * string[]>()
94+ let cpsCommandLineOptions = new ConcurrentDictionary< ProjectId, string[] * string[]>()
9895
99- let cache = Dictionary< ProjectId, CpsStamp option * VersionStamp* FSharpParsingOptions* FSharpProjectOptions>()
96+ let cache = Dictionary< ProjectId, VersionStamp* FSharpParsingOptions* FSharpProjectOptions>()
10097
10198let rec tryComputeOptions ( project : Project ) =
10299let projectId = project.Id
@@ -133,14 +130,14 @@ type private FSharpProjectOptionsReactor (workspace: VisualStudioWorkspaceImpl,
133130else
134131
135132let hier = workspace.GetHierarchy( projectId)
136- let cpsStampOpt , projectSite =
133+ let projectSite =
137134match hierwith
138135// Legacy
139- | (:? IProvideProjectSiteas provideSite) -> None , provideSite.GetProjectSite()
136+ | (:? IProvideProjectSiteas provideSite) -> provideSite.GetProjectSite()
140137// Cps
141138| _ ->
142- let cpsStampOpt , provideSite = mapCpsProjectToSite( workspace, project, serviceProvider, cpsCommandLineOptions)
143- cpsStampOpt , provideSite.GetProjectSite()
139+ let provideSite = mapCpsProjectToSite( workspace, project, serviceProvider, cpsCommandLineOptions)
140+ provideSite.GetProjectSite()
144141
145142let otherOptions =
146143 project.ProjectReferences
@@ -182,16 +179,12 @@ type private FSharpProjectOptionsReactor (workspace: VisualStudioWorkspaceImpl,
182179
183180let parsingOptions , _ = checkerProvider.Checker.GetParsingOptionsFromProjectOptions( projectOptions)
184181
185- cache.[ projectId] <- ( cpsStampOpt , projectStamp, parsingOptions, projectOptions)
182+ cache.[ projectId] <- ( projectStamp, parsingOptions, projectOptions)
186183
187184 Some( parsingOptions, projectOptions)
188185
189- | true , ( cpsStampOpt, projectStamp2, parsingOptions, projectOptions) ->
190- let cpsStampOpt2 =
191- match cpsCommandLineOptions.TryGetValue( projectId) with
192- | true , ( cpsStampOpt2, _, _) -> Some( cpsStampOpt2)
193- | _ -> None
194- if projectStamp<> projectStamp2|| cpsStampOpt<> cpsStampOpt2then
186+ | true , ( projectStamp2, parsingOptions, projectOptions) ->
187+ if projectStamp<> projectStamp2then
195188 cache.Remove( projectId) |> ignore
196189 tryComputeOptions project
197190else
@@ -219,8 +212,8 @@ type private FSharpProjectOptionsReactor (workspace: VisualStudioWorkspaceImpl,
219212member __.ClearOptionsByProjectId ( projectId ) =
220213 agent.Post( FSharpProjectOptionsMessage.ClearOptions( projectId))
221214
222- member __.SetCpsCommandLineOptions ( projectId , stamp , sourcePaths , options ) =
223- cpsCommandLineOptions.[ projectId] <- ( stamp , sourcePaths, options)
215+ member __.SetCpsCommandLineOptions ( projectId , sourcePaths , options ) =
216+ cpsCommandLineOptions.[ projectId] <- ( sourcePaths, options)
224217
225218member __.TryGetCachedOptionsByProjectId ( projectId ) =
226219match cache.TryGetValue( projectId) with
@@ -302,7 +295,7 @@ type internal FSharpProjectOptionsManager
302295member this.GetCompilationDefinesForEditingDocument ( document : Document ) =
303296let parsingOptions =
304297match reactor.TryGetCachedOptionsByProjectId( document.Project.Id) with
305- | Some(_, _, parsingOptions, _) -> parsingOptions
298+ | Some(_, parsingOptions, _) -> parsingOptions
306299| _ -> { FSharpParsingOptions.Defaultwith IsInteractive= IsScript document.Name}
307300 CompilerEnvironment.GetCompilationDefinesForEditing parsingOptions
308301
@@ -370,6 +363,6 @@ type internal FSharpProjectOptionsManager
370363else Path.Combine( Path.GetDirectoryName( path), p)
371364let sourcePaths = sources|> Seq.map( fun s -> fullPath s.Path) |> Seq.toArray
372365
373- reactor.SetCpsCommandLineOptions( projectId, DateTime.UtcNow , sourcePaths, options.ToArray())
366+ reactor.SetCpsCommandLineOptions( projectId, sourcePaths, options.ToArray())
374367
375368member __.Checker = checkerProvider.Checker