public sealed class StringDeclarationAnalyzerChecks a StringId declaration class against the two sides nobody was comparing.
Remarks
A declaration class writes every string twice — once as a property, once as a name in the All list beside it — and until this analyzer existed nothing compared the two. A declaration left out of All is in no translator's template and is therefore permanently English, and the omission is invisible: the class compiles, the label shows, and the only symptom is a language that is quietly incomplete.
⚠ It checks the shape rather than deciding it. docs/plan/46 § A3 is explicit that the declaration shape is the thing worth having upstream, because a second generator outside this repository emits the same shape and a string moved between the two should be a copy rather than a translation. So nothing here asks a declaration class to be written differently: an id, its source text, and an All list is exactly what EditorStrings and ControlStrings already are, and what a generated class emits. What this adds is that the shape is now enforced instead of remembered — which is also what makes an independently written generator's output verifiable here.
⚠ It is an analyzer rather than a generator, and that is the finding rather than a shortcut. A generator would need catalogue *source* — a file the ids come from — and where that file lives is undecided for Vixen and is Trinix's by its own scope rule. Every property doc 11 asks a generator for that does not need that decision is decidable by reading the declarations, and this is that half. The other half — an id declared and used nowhere at all — cannot be seen from inside one compilation, because six of ControlStrings' thirteen are used only from Vixen.Ui.Controls.Advanced; that is ./build.sh CheckStrings, which reads the whole tree.
Fields and properties (4)
public const string MissingFromAllIdThe id reported for a declaration missing from its All list.
public const string DuplicateIdIdThe id reported for two declarations sharing one string id.
public const string UndeclaredIdThe id reported for a StringId built outside a declaration class.
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnosticsReturns a set of descriptors for the diagnostics that this analyzer is capable of producing.
Methods (1)
public override void Initialize(AnalysisContext context)Called once at session start to register actions in the analysis context.
Used by (2)
- AnalyzerHarnessVixen.Ui.Generators.Tests
- StringDeclarationTestsVixen.Ui.Generators.Tests