Class IndenterSettingsImport
- Namespace
- RDCore.SDK.Formatting
- Assembly
- RDCore.SDK.dll
The indenter settings Rubberduck has, as Formatting settings of the platform: the mapping of what a client read of them
(RubberduckIndenterSettingsResult) to the settings of SdkFormattingOptions.
public sealed record IndenterSettingsImport : IEquatable<IndenterSettingsImport>
- Inheritance
-
IndenterSettingsImport
- Implements
- Inherited Members
Remarks
The mapping is made here, once, so that every client only reads Rubberduck's settings and says them as they are. A setting is mapped only when the source says it: one it says nothing of is not one the user chose, and keeps its default. A number is kept to the limits of its setting, as Rubberduck keeps it.
From Rubberduck's configuration, a child of IndenterSettings is the setting of its name. From the legacy Smart Indenter's registry key
(Rubberduck IndenterSettings.LoadLegacyFromRegistry), IndentProc is IndentEntireProcedureBody, IndentFirst
IndentFirstCommentBlock, IndentDim IndentFirstDeclarationBlock, IndentCmt AlignCommentsWithCode, AlignContinued
AlignContinuations, AlignIgnoreOps IgnoreOperatorsInContinuations, IndentCase, DebugCol1 all four Force...InColumn1 debug
settings, CompilerCol1 ForceCompilerDirectivesInColumn1, IndentCompiler IndentCompilerDirectives, AlignDim AlignDims,
AlignDimCol AlignDimColumn, EOLComments EndOfLineCommentStyle (AlignInCol is AlignInColumn), EOLAlignCol
EndOfLineCommentColumnSpaceAlignment; a flag is Y or it is not, and an empty one is not said. The VBA editor's TabWidth is IndentSpaces.
Constructors
IndenterSettingsImport(RubberduckIndenterSettingsSource, IReadOnlyDictionary<string, string>)
The indenter settings Rubberduck has, as Formatting settings of the platform: the mapping of what a client read of them
(RubberduckIndenterSettingsResult) to the settings of SdkFormattingOptions.
public IndenterSettingsImport(RubberduckIndenterSettingsSource Source, IReadOnlyDictionary<string, string> Values)
Parameters
SourceRubberduckIndenterSettingsSourceWhere the settings were found.
ValuesIReadOnlyDictionary<string, string>The settings, by their keys:
Formatting.IndentSpaces, with the value as it is written (TryParse(SettingDescriptor, string, out object?)).
Remarks
The mapping is made here, once, so that every client only reads Rubberduck's settings and says them as they are. A setting is mapped only when the source says it: one it says nothing of is not one the user chose, and keeps its default. A number is kept to the limits of its setting, as Rubberduck keeps it.
From Rubberduck's configuration, a child of IndenterSettings is the setting of its name. From the legacy Smart Indenter's registry key
(Rubberduck IndenterSettings.LoadLegacyFromRegistry), IndentProc is IndentEntireProcedureBody, IndentFirst
IndentFirstCommentBlock, IndentDim IndentFirstDeclarationBlock, IndentCmt AlignCommentsWithCode, AlignContinued
AlignContinuations, AlignIgnoreOps IgnoreOperatorsInContinuations, IndentCase, DebugCol1 all four Force...InColumn1 debug
settings, CompilerCol1 ForceCompilerDirectivesInColumn1, IndentCompiler IndentCompilerDirectives, AlignDim AlignDims,
AlignDimCol AlignDimColumn, EOLComments EndOfLineCommentStyle (AlignInCol is AlignInColumn), EOLAlignCol
EndOfLineCommentColumnSpaceAlignment; a flag is Y or it is not, and an empty one is not said. The VBA editor's TabWidth is IndentSpaces.
Properties
RubberduckSettingNames
The names of the settings Rubberduck has, which are the ones that are imported: its own, and none of the platform's.
public static IReadOnlyList<string> RubberduckSettingNames { get; }
Property Value
Source
Where the settings were found.
public RubberduckIndenterSettingsSource Source { get; init; }
Property Value
Values
The settings, by their keys: Formatting.IndentSpaces, with the value as it is written (TryParse(SettingDescriptor, string, out object?)).
public IReadOnlyDictionary<string, string> Values { get; init; }
Property Value
Methods
ApplyTo(UserSettingsStore, IReadOnlyDictionary<string, string>)
Sets the settings for the user, as the CONFIG verb does: what a client whose settings are the user's file does with the settings it is asked to apply
(RubberduckIndenterSettingsApplyParams).
public static IndenterSettingsApplied ApplyTo(UserSettingsStore store, IReadOnlyDictionary<string, string> settings)
Parameters
storeUserSettingsStoreThe user's settings.
settingsIReadOnlyDictionary<string, string>The settings, by their keys, with the value as it is written.
Returns
- IndenterSettingsApplied
How many were set, and the keys that were not: a key no import sets, or a value the setting cannot be.
From(RubberduckIndenterSettingsResult)
Maps what a client read of Rubberduck's indenter settings to Formatting settings.
public static IndenterSettingsImport? From(RubberduckIndenterSettingsResult read)
Parameters
readRubberduckIndenterSettingsResultWhat the client read.
Returns
- IndenterSettingsImport
The settings; null when the client found none, or none of what it found is a setting.
Imports(string)
Whether a key is one of the settings an import sets: Formatting. and the name of one of Rubberduck's settings.
public static bool Imports(string key)
Parameters
keystringThe key of a setting.
Returns
KeyOf(string)
The key of a Formatting setting.
public static string KeyOf(string name)
Parameters
namestringThe name the setting has in Rubberduck and here.