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

Commita08481c

Browse files
TIHanbrettfo
authored andcommitted
Check command line option cps stamps for recompute as a backup
1 parent8a9fe75 commita08481c

File tree

1 file changed

+24
-18
lines changed

1 file changed

+24
-18
lines changed

‎vsintegration/src/FSharp.Editor/LanguageService/FSharpProjectOptionsManager.fs‎

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,18 @@ open System.Threading
2222
openMicrosoft.VisualStudio.Shell.Interop
2323
openMicrosoft.VisualStudio.LanguageServices.Implementation.TaskList
2424

25+
typeprivateCpsStamp= DateTime
26+
2527
[<AutoOpen>]
2628
moduleprivateFSharpProjectOptionsHelpers=
2729

28-
letmapCpsProjectToSite(workspace:VisualStudioWorkspaceImpl,project:Project,serviceProvider:System.IServiceProvider,cpsCommandLineOptions:IDictionary<ProjectId,DateTime*string[]*string[]*string[]>)=
30+
letmapCpsProjectToSite(workspace:VisualStudioWorkspaceImpl,project:Project,serviceProvider:System.IServiceProvider,cpsCommandLineOptions:IDictionary<ProjectId,CpsStamp*string[]*string[]*string[]>)=
2931
lethier= workspace.GetHierarchy(project.Id)
30-
letgetCommandLineOptionsWithProjectId(projectId)=
31-
match cpsCommandLineOptions.TryGetValue(projectId)with
32-
|true,(_, sourcePaths, referencePaths, options)-> sourcePaths, referencePaths, options
33-
|false,_->[||],[||],[||]
32+
letcpsStampOpt,sourcePaths,referencePaths,options=
33+
match cpsCommandLineOptions.TryGetValue(project.Id)with
34+
|true,(cpsStamp, sourcePaths, referencePaths, options)-> Some(cpsStamp), sourcePaths, referencePaths, options
35+
|false,_-> None,[||],[||],[||]
36+
cpsStampOpt,
3437
{
3538
new IProvideProjectSitewith
3639
memberx.GetProjectSite()=
@@ -43,11 +46,10 @@ module private FSharpProjectOptionsHelpers =
4346
{
4447
new IProjectSitewith
4548
member__.Description= project.Name
46-
member__.CompilationSourceFiles=getCommandLineOptionsWithProjectId(project.Id)|> fst
49+
member__.CompilationSourceFiles=sourcePaths
4750
member__.CompilationOptions=
48-
let_,references,options= getCommandLineOptionsWithProjectId(project.Id)
49-
Array.concat[options; references|> Array.map(fun r->"-r:"+ r)]
50-
member__.CompilationReferences= getCommandLineOptionsWithProjectId(project.Id)|> snd
51+
Array.concat[options; referencePaths|> Array.map(fun r->"-r:"+ r)]
52+
member__.CompilationReferences= referencePaths
5153
membersite.CompilationBinOutputPath= site.CompilationOptions|> Array.tryPick(fun s->if s.StartsWith("-o:")then Some s.[3..]else None)
5254
member__.ProjectFileName= project.FilePath
5355
member__.AdviseProjectSiteChanges(_,_)=()
@@ -94,7 +96,7 @@ type private FSharpProjectOptionsReactor (workspace: VisualStudioWorkspaceImpl,
9496
// Hack to store command line options from HandleCommandLineChanges
9597
letcpsCommandLineOptions=new ConcurrentDictionary<ProjectId, DateTime* string[]* string[]* string[]>()
9698

97-
letcache= Dictionary<ProjectId, VersionStamp* FSharpParsingOptions* FSharpProjectOptions>()
99+
letcache= Dictionary<ProjectId,CpsStamp option*VersionStamp* FSharpParsingOptions* FSharpProjectOptions>()
98100

99101
let rectryComputeOptions(project:Project)=
100102
letprojectId= project.Id
@@ -131,14 +133,14 @@ type private FSharpProjectOptionsReactor (workspace: VisualStudioWorkspaceImpl,
131133
else
132134

133135
lethier= workspace.GetHierarchy(projectId)
134-
letprojectSite=
136+
letcpsStampOpt,projectSite=
135137
match hierwith
136138
// Legacy
137-
|(:? IProvideProjectSiteas provideSite)-> provideSite.GetProjectSite()
139+
|(:? IProvideProjectSiteas provideSite)->None,provideSite.GetProjectSite()
138140
// Cps
139141
|_->
140-
letprovideSite= mapCpsProjectToSite(workspace, project, serviceProvider, cpsCommandLineOptions)
141-
provideSite.GetProjectSite()
142+
letcpsStampOpt,provideSite= mapCpsProjectToSite(workspace, project, serviceProvider, cpsCommandLineOptions)
143+
cpsStampOpt,provideSite.GetProjectSite()
142144

143145
letprojectOptions=
144146
{
@@ -164,12 +166,16 @@ type private FSharpProjectOptionsReactor (workspace: VisualStudioWorkspaceImpl,
164166

165167
letparsingOptions,_= checkerProvider.Checker.GetParsingOptionsFromProjectOptions(projectOptions)
166168

167-
cache.[projectId]<-(projectStamp, parsingOptions, projectOptions)
169+
cache.[projectId]<-(cpsStampOpt,projectStamp, parsingOptions, projectOptions)
168170

169171
Some(parsingOptions, projectOptions)
170172

171-
|true,(projectStamp2, parsingOptions, projectOptions)->
172-
if projectStamp<> projectStamp2then
173+
|true,(cpsStampOpt, projectStamp2, parsingOptions, projectOptions)->
174+
letcpsStampOpt2=
175+
match cpsCommandLineOptions.TryGetValue(projectId)with
176+
|true,(cpsStampOpt2,_,_,_)-> Some(cpsStampOpt2)
177+
|_-> None
178+
if projectStamp<> projectStamp2|| cpsStampOpt<> cpsStampOpt2then
173179
cache.Remove(projectId)|> ignore
174180
tryComputeOptions project
175181
else
@@ -280,7 +286,7 @@ type internal FSharpProjectOptionsManager
280286
memberthis.GetCompilationDefinesForEditingDocument(document:Document)=
281287
letparsingOptions=
282288
match reactor.TryGetCachedOptionsByProjectId(document.Project.Id)with
283-
| Some(_, parsingOptions,_)-> parsingOptions
289+
| Some(_,_,parsingOptions,_)-> parsingOptions
284290
|_->{ FSharpParsingOptions.Defaultwith IsInteractive= IsScript document.Name}
285291
CompilerEnvironment.GetCompilationDefinesForEditing parsingOptions
286292

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp