Skip to content

Commit

Permalink
After call
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf committed Feb 14, 2024
1 parent b135692 commit 7303448
Show file tree
Hide file tree
Showing 9 changed files with 384 additions and 363 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module FcsCheckerService =
type FcsProject =
{ OutputPath: VirtualFileSystemPath
ProjectOptions: FSharpProjectOptions
ProjectSnapshot: FSharpProjectSnapshot option
ParsingOptions: FSharpParsingOptions
FileIndices: IDictionary<VirtualFileSystemPath, int>
ImplementationFilesWithSignatures: ISet<VirtualFileSystemPath>
Expand Down Expand Up @@ -88,25 +89,27 @@ type FcsProjectInvalidationType =
type FcsCheckerService(lifetime: Lifetime, logger: ILogger, onSolutionCloseNotifier: OnSolutionCloseNotifier,
settingsStore: ISettingsStore, locks: IShellLocks, configurations: RunsProducts.ProductConfigurations) =

let checker =
Environment.SetEnvironmentVariable("FCS_CheckFileInProjectCacheSize", "20")

let settingsStoreLive = settingsStore.BindToContextLive(lifetime, ContextRange.ApplicationWide)
let settingsStoreLive = settingsStore.BindToContextLive(lifetime, ContextRange.ApplicationWide)

let getSettingProperty name =
let setting = SettingsUtil.getEntry<FSharpOptions> settingsStore name
settingsStoreLive.GetValueProperty(lifetime, setting, null)
let getSettingProperty name =
let setting = SettingsUtil.getEntry<FSharpOptions> settingsStore name
settingsStoreLive.GetValueProperty(lifetime, setting, null)

let useTransparentCompiler = (getSettingProperty "UseTransparentCompiler").Value

let checker =
Environment.SetEnvironmentVariable("FCS_CheckFileInProjectCacheSize", "20")
let skipImpl = getSettingProperty "SkipImplementationAnalysis"
let analyzerProjectReferencesInParallel = getSettingProperty "ParallelProjectReferencesAnalysis"

lazy
let checker =
FSharpChecker.Create(projectCacheSize = 200,
keepAllBackgroundResolutions = false,
keepAllBackgroundSymbolUses = false,
enablePartialTypeChecking = skipImpl.Value,
parallelReferenceResolution = analyzerProjectReferencesInParallel.Value)
parallelReferenceResolution = analyzerProjectReferencesInParallel.Value,
useTransparentCompiler = useTransparentCompiler)

checker

Expand Down Expand Up @@ -156,11 +159,15 @@ type FcsCheckerService(lifetime: Lifetime, logger: ILogger, onSolutionCloseNotif
| Some(parseResults, checkResults) -> Some({ ParseResults = parseResults; CheckResults = checkResults })
| _ ->



ProhibitTypeCheckCookie.AssertTypeCheckIsAllowed()
locks.AssertReadAccessAllowed()
x.AssertFcsAccessThread()

let psiModule = sourceFile.PsiModule
// check if is active ...
if useTransparentCompiler then ()
match x.FcsProjectProvider.GetFcsProject(psiModule) with
| None -> None
| Some fcsProject ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ type FcsProjectProvider(lifetime: Lifetime, solution: ISolution, changeManager:
match scriptFcsProjectProvider.GetScriptOptions(sourceFile) with
| None -> None
| Some projectOptions ->

// let snapshot = FSharpProjectSnapshot.FromOptions projectOptions

let parsingOptions =
{ FSharpParsingOptions.Default with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module FSharpOptions =
let [<Literal>] nonFSharpProjectInMemoryReferences = "Analyze C# and VB.NET project references in-memory"
let [<Literal>] outOfScopeCompletion = "Enable out of scope items completion"
let [<Literal>] topLevelOpenCompletion = "Add 'open' declarations to top level module or namespace"
let [<Literal>] useTransparentCompilerDescription = "Use TransparentCompiler"


[<SettingsKey(typeof<FSharpSettings>, "FSharpOptions")>]
Expand All @@ -46,7 +47,10 @@ type FSharpOptions =
mutable EnableOutOfScopeCompletion: bool

[<SettingsEntry(true, topLevelOpenCompletion); DefaultValue>]
mutable TopLevelOpenCompletion: bool }
mutable TopLevelOpenCompletion: bool

[<SettingsEntry(false, useTransparentCompilerDescription)>]
mutable UseTransparentCompiler: bool }

type FantomasLocationSettings =
| AutoDetected = 0
Expand Down Expand Up @@ -154,6 +158,9 @@ type FSharpOptionsProvider(lifetime, solution, settings, settingsSchema) =

member val NonFSharpProjectInMemoryReferences =
base.GetValueProperty<bool>("NonFSharpProjectInMemoryReferences").Value with get, set

member val UseTransparentCompiler =
base.GetValueProperty<bool>("UseTransparentCompiler").Value

member this.UpdateAssemblyReaderSetting() =
this.NonFSharpProjectInMemoryReferences <-
Expand Down Expand Up @@ -210,6 +217,7 @@ type FSharpOptionsPage(lifetime: Lifetime, optionsPageContext, settings,
this.AddBoolOptionWithComment((fun key -> key.SkipImplementationAnalysis), skipImplementationAnalysis, "Requires restart") |> ignore
this.AddBoolOptionWithComment((fun key -> key.ParallelProjectReferencesAnalysis), parallelProjectReferencesAnalysis, "Requires restart") |> ignore
this.AddBoolOptionWithComment((fun key -> key.OutOfProcessTypeProviders), FSharpExperimentalFeatures.outOfProcessTypeProviders, "Requires restart") |> ignore
this.AddBoolOptionWithComment((fun key -> key.UseTransparentCompiler), useTransparentCompilerDescription, "Requires restart") |> ignore

do
use indent = this.Indent()
Expand Down
Loading

0 comments on commit 7303448

Please sign in to comment.