diff --git a/ReSharper.FSharp/src/FSharp/FSharp.Common/src/Checker/ScriptFcsProjectProvider.fs b/ReSharper.FSharp/src/FSharp/FSharp.Common/src/Checker/ScriptFcsProjectProvider.fs index a51e9aa00b..cd139b9ace 100644 --- a/ReSharper.FSharp/src/FSharp/FSharp.Common/src/Checker/ScriptFcsProjectProvider.fs +++ b/ReSharper.FSharp/src/FSharp/FSharp.Common/src/Checker/ScriptFcsProjectProvider.fs @@ -19,7 +19,7 @@ open JetBrains.ReSharper.Psi open JetBrains.Threading open JetBrains.Util -[] +[] type ScriptFcsProjectProvider(lifetime: Lifetime, logger: ILogger, checkerService: FcsCheckerService, scriptSettings: FSharpScriptSettingsProvider, fsSourceCache: FSharpSourceCache, toolset: ISolutionToolset) = diff --git a/ReSharper.FSharp/src/FSharp/FSharp.Common/src/ProjectModel/FSharpScriptPsiModuleFactory.fs b/ReSharper.FSharp/src/FSharp/FSharp.Common/src/ProjectModel/FSharpScriptPsiModuleFactory.fs index d023342527..4551e3bb56 100644 --- a/ReSharper.FSharp/src/FSharp/FSharp.Common/src/ProjectModel/FSharpScriptPsiModuleFactory.fs +++ b/ReSharper.FSharp/src/FSharp/FSharp.Common/src/ProjectModel/FSharpScriptPsiModuleFactory.fs @@ -37,7 +37,7 @@ open JetBrains.Util.DataStructures open JetBrains.Util.Dotnet.TargetFrameworkIds /// Provides psi modules for script files with referenced assemblies determined by "#r" directives. -[] +[] type FSharpScriptPsiModulesProvider(lifetime: Lifetime, solution: ISolution, changeManager: ChangeManager, documentManager: DocumentManager, scriptOptionsProvider: IScriptFcsProjectProvider, platformManager: IPlatformManager, assemblyFactory: AssemblyFactory, projectFileExtensions, @@ -192,8 +192,6 @@ type FSharpScriptPsiModulesProvider(lifetime: Lifetime, solution: ISolution, cha ) do - changeManager.RegisterChangeProvider(lifetime, this) - if not scriptOptionsProvider.SyncUpdate then scriptOptionsProvider.OptionsUpdated.Advise(lifetime, fun (path, options) -> queueUpdateReferences path options @@ -305,8 +303,9 @@ type FSharpScriptPsiModulesProvider(lifetime: Lifetime, solution: ISolution, cha interface IPsiModuleFactory with member x.Modules = psiModulesCollection - interface IChangeProvider with + interface ISolutionChangeProvider with member x.Execute _ = null + member x.Lifetime = lifetime /// Overriding psi module handler for each project (a real project, misc files project, solution folder, etc). diff --git a/ReSharper.FSharp/src/FSharp/FSharp.Common/src/Settings/FSharpOptions.fs b/ReSharper.FSharp/src/FSharp/FSharp.Common/src/Settings/FSharpOptions.fs index 346737df03..8fc6ff477c 100644 --- a/ReSharper.FSharp/src/FSharp/FSharp.Common/src/Settings/FSharpOptions.fs +++ b/ReSharper.FSharp/src/FSharp/FSharp.Common/src/Settings/FSharpOptions.fs @@ -5,6 +5,7 @@ open System.Reflection open JetBrains.Application open JetBrains.Application.Parts open JetBrains.Application.Settings +open JetBrains.Application.Threading open JetBrains.Application.UI.Options open JetBrains.Application.UI.Options.OptionsDialog.SimpleOptions open JetBrains.DataFlow @@ -119,21 +120,21 @@ type FSharpExperimentalFeatures = [] type FSharpSettingsProviderBase<'T>(lifetime: Lifetime, settings: IContextBoundSettingsStoreLive, - settingsSchema: SettingsSchema) = + settingsSchema: SettingsSchema, shellLocks: IShellLocks) = let settingsKey = settingsSchema.GetKey<'T>() new (lifetime: Lifetime, solution: ISolution, settingsStore: ISettingsStore, settingsSchema: SettingsSchema) = let settings = settingsStore.BindToContextLive(lifetime, ContextRange.Smart(solution.ToDataContext())) - FSharpSettingsProviderBase(lifetime, settings, settingsSchema) + FSharpSettingsProviderBase(lifetime, settings, settingsSchema, solution.Locks) member x.GetValueProperty<'V>(name: string) = let entry = settingsKey.TryFindEntryByMemberName(name) :?> SettingsScalarEntry - settings.GetValueProperty(lifetime, entry, null) :> IProperty<'V> + settings.GetValueProperty2(lifetime, entry, null, ApartmentForNotifications.Primary(shellLocks)) :> IProperty<'V> -[] -type FSharpScriptSettingsProvider(lifetime, solution, settings, settingsSchema) = +[] +type FSharpScriptSettingsProvider(lifetime, solution: ISolution, settings, settingsSchema) = inherit FSharpSettingsProviderBase(lifetime, solution, settings, settingsSchema) member val LanguageVersion = base.GetValueProperty("LanguageVersion") @@ -142,7 +143,7 @@ type FSharpScriptSettingsProvider(lifetime, solution, settings, settingsSchema) [] -type FSharpExperimentalFeaturesProvider(lifetime, solution, settings, settingsSchema) = +type FSharpExperimentalFeaturesProvider(lifetime, solution: ISolution, settings, settingsSchema) = inherit FSharpSettingsProviderBase(lifetime, solution, settings, settingsSchema) member val EnablePostfixTemplates = base.GetValueProperty("PostfixTemplates") @@ -154,7 +155,7 @@ type FSharpExperimentalFeaturesProvider(lifetime, solution, settings, settingsSc [] -type FSharpOptionsProvider(lifetime, solution, settings, settingsSchema) = +type FSharpOptionsProvider(lifetime, solution: ISolution, settings, settingsSchema) = inherit FSharpSettingsProviderBase(lifetime, solution, settings, settingsSchema) member val NonFSharpProjectInMemoryReferences = @@ -165,7 +166,7 @@ type FSharpOptionsProvider(lifetime, solution, settings, settingsSchema) = base.GetValueProperty("NonFSharpProjectInMemoryReferences").Value [] -type FSharpFantomasSettingsProvider(lifetime, solution, settings, settingsSchema) = +type FSharpFantomasSettingsProvider(lifetime, solution: ISolution, settings, settingsSchema) = inherit FSharpSettingsProviderBase(lifetime, solution, settings, settingsSchema) member val Location = base.GetValueProperty("Location") diff --git a/ReSharper.FSharp/src/FSharp/FSharp.Common/src/Shim/FileSystem/FSharpSourceCache.fs b/ReSharper.FSharp/src/FSharp/FSharp.Common/src/Shim/FileSystem/FSharpSourceCache.fs index 79e97ac373..47236be1ba 100644 --- a/ReSharper.FSharp/src/FSharp/FSharp.Common/src/Shim/FileSystem/FSharpSourceCache.fs +++ b/ReSharper.FSharp/src/FSharp/FSharp.Common/src/Shim/FileSystem/FSharpSourceCache.fs @@ -26,7 +26,7 @@ type FSharpSource = | Exists(source, timestamp) -> RdFSharpSource(Encoding.UTF8.GetString(source), timestamp) | _ -> RdFSharpSource("NotExists", DateTime.MinValue) -[] +[] type FSharpSourceCache(lifetime: Lifetime, solution: ISolution, changeManager, documentManager: DocumentManager, solutionDocumentChangeProvider: SolutionDocumentChangeProvider, fileExtensions: IProjectFileExtensions, logger: ILogger) = diff --git a/ReSharper.FSharp/src/FSharp/FSharp.Psi.Features/src/Fsi/FsiOptions.fs b/ReSharper.FSharp/src/FSharp/FSharp.Psi.Features/src/Fsi/FsiOptions.fs index 5eb546e5c1..d5e70f36a9 100644 --- a/ReSharper.FSharp/src/FSharp/FSharp.Psi.Features/src/Fsi/FsiOptions.fs +++ b/ReSharper.FSharp/src/FSharp/FSharp.Psi.Features/src/Fsi/FsiOptions.fs @@ -2,6 +2,7 @@ namespace JetBrains.ReSharper.Plugins.FSharp.Psi.Features.Fsi open JetBrains.Application.Parts open JetBrains.Application.Settings +open JetBrains.Application.Threading open JetBrains.Lifetimes open JetBrains.ProjectModel open JetBrains.ProjectModel.DataContext @@ -94,12 +95,12 @@ type FsiOptions = [] -type FsiOptionsProvider(lifetime, settings, settingsSchema) = - inherit FSharpSettingsProviderBase(lifetime, settings, settingsSchema) +type FsiOptionsProvider(lifetime, settings, settingsSchema, shellLocks: IShellLocks) = + inherit FSharpSettingsProviderBase(lifetime, settings, settingsSchema, shellLocks) new (lifetime: Lifetime, solution: ISolution, settingsStore: ISettingsStore, settingsSchema) = let settings = settingsStore.BindToContextLive(lifetime, ContextRange.Smart(solution.ToDataContext())) - FsiOptionsProvider(lifetime, settings, settingsSchema) + FsiOptionsProvider(lifetime, settings, settingsSchema, solution.Locks) member val AutoDetect = base.GetValueProperty("AutoDetect") member val IsCustomTool = base.GetValueProperty("IsCustomTool") diff --git a/ReSharper.FSharp/src/FSharp/FSharp.Psi.Features/src/Fsi/FsiOptionsPage.fs b/ReSharper.FSharp/src/FSharp/FSharp.Psi.Features/src/Fsi/FsiOptionsPage.fs index df843b8ee8..4c8a19d50a 100644 --- a/ReSharper.FSharp/src/FSharp/FSharp.Psi.Features/src/Fsi/FsiOptionsPage.fs +++ b/ReSharper.FSharp/src/FSharp/FSharp.Psi.Features/src/Fsi/FsiOptionsPage.fs @@ -4,6 +4,7 @@ open System open System.Runtime.InteropServices open JetBrains.Application open JetBrains.Application.BuildScript.Application.Zones +open JetBrains.Application.Threading open JetBrains.Application.UI.Controls.FileSystem open JetBrains.Application.UI.Options open JetBrains.Application.UI.Options.OptionsDialog.SimpleOptions.ViewModel @@ -27,14 +28,14 @@ open JetBrains.Util [, HelpKeyword = fsiHelpKeyword)>] type FsiOptionsPage(lifetime: Lifetime, optionsPageContext, settings, settingsSchema, fsiDetector: FsiDetector, [] solution: ISolution, dialogs: ICommonFileDialogs, - iconHost: IconHostBase) as this = + iconHost: IconHostBase, shellLocks: IShellLocks) as this = inherit FSharpOptionsPageBase(lifetime, optionsPageContext, settings) let (|FsiTool|) (obj: obj) = obj :?> FsiTool let Not = Func<_,_>(not) - let fsiOptions = FsiOptionsProvider(lifetime, settings, settingsSchema) + let fsiOptions = FsiOptionsProvider(lifetime, settings, settingsSchema, shellLocks) let tools = fsiDetector.GetFsiTools(solution) let autoDetectAllowed = tools.Length > 1