Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync with the ultimate master #774

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ open JetBrains.ReSharper.Psi
open JetBrains.Threading
open JetBrains.Util

[<SolutionComponent(InstantiationEx.LegacyDefault)>]
[<SolutionComponent(Instantiation.DemandAnyThreadSafe)>]
type ScriptFcsProjectProvider(lifetime: Lifetime, logger: ILogger, checkerService: FcsCheckerService,
scriptSettings: FSharpScriptSettingsProvider, fsSourceCache: FSharpSourceCache, toolset: ISolutionToolset) =

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
[<SolutionComponent(InstantiationEx.LegacyDefault)>]
[<SolutionComponent(Instantiation.DemandAnyThreadSafe)>]
type FSharpScriptPsiModulesProvider(lifetime: Lifetime, solution: ISolution, changeManager: ChangeManager,
documentManager: DocumentManager, scriptOptionsProvider: IScriptFcsProjectProvider,
platformManager: IPlatformManager, assemblyFactory: AssemblyFactory, projectFileExtensions,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -119,21 +120,21 @@ type FSharpExperimentalFeatures =

[<AllowNullLiteral>]
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>


[<SolutionInstanceComponent(InstantiationEx.LegacyDefault)>]
type FSharpScriptSettingsProvider(lifetime, solution, settings, settingsSchema) =
[<SolutionInstanceComponent(Instantiation.DemandAnyThreadSafe)>]
type FSharpScriptSettingsProvider(lifetime, solution: ISolution, settings, settingsSchema) =
inherit FSharpSettingsProviderBase<FSharpScriptOptions>(lifetime, solution, settings, settingsSchema)

member val LanguageVersion = base.GetValueProperty<FSharpLanguageVersion>("LanguageVersion")
Expand All @@ -142,7 +143,7 @@ type FSharpScriptSettingsProvider(lifetime, solution, settings, settingsSchema)


[<SolutionInstanceComponent(InstantiationEx.LegacyDefault)>]
type FSharpExperimentalFeaturesProvider(lifetime, solution, settings, settingsSchema) =
type FSharpExperimentalFeaturesProvider(lifetime, solution: ISolution, settings, settingsSchema) =
inherit FSharpSettingsProviderBase<FSharpExperimentalFeatures>(lifetime, solution, settings, settingsSchema)

member val EnablePostfixTemplates = base.GetValueProperty<bool>("PostfixTemplates")
Expand All @@ -154,7 +155,7 @@ type FSharpExperimentalFeaturesProvider(lifetime, solution, settings, settingsSc


[<SolutionInstanceComponent(InstantiationEx.LegacyDefault)>]
type FSharpOptionsProvider(lifetime, solution, settings, settingsSchema) =
type FSharpOptionsProvider(lifetime, solution: ISolution, settings, settingsSchema) =
inherit FSharpSettingsProviderBase<FSharpOptions>(lifetime, solution, settings, settingsSchema)

member val NonFSharpProjectInMemoryReferences =
Expand All @@ -165,7 +166,7 @@ type FSharpOptionsProvider(lifetime, solution, settings, settingsSchema) =
base.GetValueProperty<bool>("NonFSharpProjectInMemoryReferences").Value

[<SolutionInstanceComponent(InstantiationEx.LegacyDefault)>]
type FSharpFantomasSettingsProvider(lifetime, solution, settings, settingsSchema) =
type FSharpFantomasSettingsProvider(lifetime, solution: ISolution, settings, settingsSchema) =
inherit FSharpSettingsProviderBase<FSharpFantomasOptions>(lifetime, solution, settings, settingsSchema)

member val Location = base.GetValueProperty<FantomasLocationSettings>("Location")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type FSharpSource =
| Exists(source, timestamp) -> RdFSharpSource(Encoding.UTF8.GetString(source), timestamp)
| _ -> RdFSharpSource("NotExists", DateTime.MinValue)

[<SolutionComponent(InstantiationEx.LegacyDefault)>]
[<SolutionComponent(Instantiation.DemandAnyThreadSafe)>]
type FSharpSourceCache(lifetime: Lifetime, solution: ISolution, changeManager, documentManager: DocumentManager,
solutionDocumentChangeProvider: SolutionDocumentChangeProvider, fileExtensions: IProjectFileExtensions,
logger: ILogger) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -94,12 +95,12 @@ type FsiOptions =


[<SolutionInstanceComponent(InstantiationEx.LegacyDefault)>]
type FsiOptionsProvider(lifetime, settings, settingsSchema) =
inherit FSharpSettingsProviderBase<FsiOptions>(lifetime, settings, settingsSchema)
type FsiOptionsProvider(lifetime, settings, settingsSchema, shellLocks: IShellLocks) =
inherit FSharpSettingsProviderBase<FsiOptions>(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<bool>("AutoDetect")
member val IsCustomTool = base.GetValueProperty<bool>("IsCustomTool")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -27,14 +28,14 @@ open JetBrains.Util
[<OptionsPage("FsiOptionsPage", "Fsi", typeof<ProjectModelThemedIcons.Fsharp>, HelpKeyword = fsiHelpKeyword)>]
type FsiOptionsPage(lifetime: Lifetime, optionsPageContext, settings, settingsSchema, fsiDetector: FsiDetector,
[<Optional; DefaultParameterValue(null: ISolution)>] 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
Expand Down
Loading