Class IndenterSettingsOffer
- Namespace
- RDCore.SDK.Formatting
- Assembly
- RDCore.SDK.dll
Offers, once, to import the indenter settings of Rubberduck: when the client has them, the user never set a Formatting setting, and the user was not offered
already.
public sealed class IndenterSettingsOffer
- Inheritance
-
IndenterSettingsOffer
- Inherited Members
Remarks
Rubberduck offered its user the settings of the legacy Smart Indenter the same way. The offer is made once, whatever the answer: a file in the folder of the platform's
user - it is no setting - remembers it was made, and rdcore.importIndenterSettings imports at any time. A question nobody answered - the client says
so with an error, as a shell whose input is a script does - or one withdrawn before it was, was not an offer made: it is made at the next start. Neither is
an import the user chose that the client could not take. What the user chose is done even when the file can't be written, and the offer is then made again at
the next start, unless the import set a Formatting setting.
Constructors
IndenterSettingsOffer(IFileSystem, string)
Offers, once, to import the indenter settings of Rubberduck: when the client has them, the user never set a Formatting setting, and the user was not offered
already.
public IndenterSettingsOffer(IFileSystem fileSystem, string markerPath)
Parameters
fileSystemIFileSystemThe file system the file that remembers the offer is in.
markerPathstringThe path of the file that remembers the offer was made (MarkerIn(string)).
Remarks
Rubberduck offered its user the settings of the legacy Smart Indenter the same way. The offer is made once, whatever the answer: a file in the folder of the platform's
user - it is no setting - remembers it was made, and rdcore.importIndenterSettings imports at any time. A question nobody answered - the client says
so with an error, as a shell whose input is a script does - or one withdrawn before it was, was not an offer made: it is made at the next start. Neither is
an import the user chose that the client could not take. What the user chose is done even when the file can't be written, and the offer is then made again at
the next start, unless the import set a Formatting setting.
Fields
MarkerFileName
The name of the file that remembers the offer was made.
public const string MarkerFileName = "indenter-import.offered"
Field Value
Properties
WasMade
Whether the offer was made.
public bool WasMade { get; }
Property Value
Methods
MarkerIn(string)
The path of the file that remembers the offer was made, in the folder of the platform's user.
public static string MarkerIn(string userDataDirectory)
Parameters
userDataDirectorystringThe folder (UserDataDirectory).
Returns
OfferAsync(bool, Func<CancellationToken, Task<RubberduckIndenterSettingsResult>>, Func<string, IReadOnlyList<string>, CancellationToken, Task<string?>>, Func<RubberduckIndenterSettingsApplyParams, CancellationToken, Task<RubberduckIndenterSettingsApplyResult>>, CancellationToken)
Makes the offer, if there is one to make, and imports the settings when the user says to.
public Task<IndenterSettingsImportOutcome?> OfferAsync(bool formattingWasSet, Func<CancellationToken, Task<RubberduckIndenterSettingsResult>> read, Func<string, IReadOnlyList<string>, CancellationToken, Task<string?>> ask, Func<RubberduckIndenterSettingsApplyParams, CancellationToken, Task<RubberduckIndenterSettingsApplyResult>> apply, CancellationToken token)
Parameters
formattingWasSetboolWhether the client said any
Formattingsetting: the user chose already.readFunc<CancellationToken, Task<RubberduckIndenterSettingsResult>>Sends RubberduckIndenterSettingsParams to the client.
askFunc<string, IReadOnlyList<string>, CancellationToken, Task<string>>Asks the user to choose among the buttons; null when they chose none. It throws when nobody answered: the offer is still to make.
applyFunc<RubberduckIndenterSettingsApplyParams, CancellationToken, Task<RubberduckIndenterSettingsApplyResult>>Sends RubberduckIndenterSettingsApplyParams to the client.
tokenCancellationTokenA token that cancels the requests.
Returns
- Task<IndenterSettingsImportOutcome>
What was imported; null when nothing was offered, or the user did not choose to import.