Skip to content

Add block extents, a literal-only write mode and per-parse keyword sets - #116

Merged
FabienTschanz merged 6 commits into
Microsoft365DSC:devfrom
FabienTschanz:feature/extents-and-literal-emit
Nov 18, 2026
Merged

FabienTschanz merged 6 commits into
Microsoft365DSC:devfrom
FabienTschanz:feature/extents-and-literal-emit

Conversation

@FabienTschanz

Copy link
Copy Markdown
Collaborator

Adds three parser capabilities for consumers that edit and generate DSC configuration files, and bumps the version to 3.1.0.8.

  • Block extents. Every parsed DscResourceInstance now has an Extent (StartOffset, EndOffset exclusive, StartLine, EndLine) into the content passed in, also after bare values were quoted to make the content parse. The new DscParser.ParseConfiguration(content, options, dscResources) returns a DscParseResult with the resources and the SkippedStatements inside Node blocks (unrecognized statement, undefined resource or unloaded resource), each with its text and extent.
  • Literal-only write mode. The writing code of ConvertFromDscObject moved into an internal DscConfigurationWriter. The existing overload writes the same text as before. A new overload ConvertFromDscObject(resources, DscWriteOptions, childLevel) returns a DscWriteResult. With IsLiteralOnly, a string that would run as code becomes a single-quoted literal. A value no literal can hold fails the write with a DscWriteError that tells which resource was affected, the instance and setting.
  • Per-parse keyword sets. DscKeywordSet.FromSchemaCache(entries) builds the resource keywords once per schema version. DscParseOptions.Keywords parses against that set alone, without reading or writing process-wide state. DscParseOptions.WarningSink receives the warnings of that parse. The engine's keyword table is thread-static, so parses with different schema versions run in parallel without a lock.

These are feature extensions meant for C# usage and integration into other systems. No bugfixes are in this release.

@FabienTschanz
FabienTschanz merged commit e4a92d2 into Microsoft365DSC:dev Nov 18, 2026
1 check passed
@FabienTschanz
FabienTschanz deleted the feature/extents-and-literal-emit branch November 18, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant