Fixes
fix: Add Experimental Validation setting. (#9250)
fix: Add Experimental Validation setting. (#9250)
This pull request introduces new experimental support for fine-grained validation control and refactors plugin support in the CSpell types package. The main changes add the ability to specify which segments of parsed text should be spell-checked using tag-based validation, and reorganize plugin configuration for future extensibility. The changes also update type definitions and exports to support these new features.
Validation Tag Support:
- Introduced the
CSpellSettingsValidationinterface, allowing configuration of which tagged segments of text are spell-checked via the newvalidateproperty. This uses the newValidationTagsandTagPatterntypes to enable hierarchical and wildcard matching of tags. [1] [2] - Updated exports to include
TagPatternandValidationTagsfor external usage.
Plugin Configuration Refactor:
- Added the
CSpellSettingsPluginsinterface to encapsulate plugin-related settings, including an experimentalpluginsarray. [1] [2] - Refactored
ExperimentalFileSettingsto extend bothCSpellSettingsPluginsandCSpellSettingsValidation, consolidating experimental settings. [1] [2]
API and Type Definition Updates:
- Changed the
defineConfigfunction and its type definition to acceptAdvancedCSpellSettingsinstead ofCSpellSettings, reflecting the expanded configuration options. [1] [2] - Updated imports and type usage throughout the codebase to align with the new structure for plugins and validation settings.
These changes lay the groundwork for more flexible and precise spell-checking configuration and future plugin extensibility.
fix: Plugin (#9244)
fix: Plugin (#9244)
This pull request introduces support for a new DocumentParser interface alongside the existing Parser interface, modernizing the way documents are parsed throughout the codebase. It updates type definitions, internal APIs, and logic to handle both parser types, and refactors related code for improved clarity and flexibility.
Key changes include:
API and Type Definition Updates:
- Added
DocumentParser,TextDocument, and related types to@cspell/cspell-types, and updated theParseResultinterface to removecontentandfilenamefields, making it compatible with both parser interfaces. - Deprecated the old
Plugininterface in favor of the newCSpellPlugininterface, which now supports bothParserandDocumentParserinstances.
Core Library Refactoring:
- Updated parser handling in
CSpellSettingsServer.tsto support bothParserandDocumentParser, including changes to caches, type signatures, and plugin mapping functions. - Refactored
DocumentValidatorindocValidator.tsto use a newparseDocumentWithParserhelper, which abstracts over the two parser interfaces.
Parser Implementation and Test Updates:
- Modified the TypeScript parser and its tests to align with the new
ParseResultstructure, removing direct dependencies oncontentandfilenamein the result.
These changes make the system more flexible and future-proof by supporting richer document parsing scenarios and decoupling the parsing logic from file-based assumptions.
fix: remove unused dependency `fast-json-stable-stringify` (#9243)
fix: remove unused dependency fast-json-stable-stringify (#9243)
fix: Adjust check text to show only the text that was actually checked. (#9241)
fix: Adjust check text to show only the text that was actually checked. (#9241)
fix: Add tags to ParsedText (#9237)
fix: Add tags to ParsedText (#9237)
This pull request introduces the concept of "tags" for parsed text segments in the CSpell types, allowing each segment of text to be annotated with a set of named tags. These tags can hold boolean, string, or undefined values, supporting richer metadata for parsers and downstream consumers. The changes affect both the TypeScript source and the type definitions.
The most important changes are:
Tagging Support for Parsed Text
- Added a new optional
tagsproperty to theParsedTextinterface, allowing each parsed text segment to carry a set of tags as metadata. (ParsedTextinparser.ts,index.d.mts,index.d.mts) [1] [2] [3] - Introduced the
ParsedTagtype (boolean | string | undefined) and theParsedTagsinterface (a map of tag names toParsedTagvalues) to define the structure of tags. (parser.ts,index.d.mts,index.d.mts) [1] [2] [3]
Type Exports and API Surface
- Updated exports throughout the codebase to include
ParsedTagandParsedTags, making these types available to consumers. (src/Parser/index.ts,src/index.ts,index.d.mts,index.d.mts) [1] [2] [3] [4] - Changed the export style in
src/Parser/index.mtsfromexport *toexport type *, ensuring only types are exported.
These changes lay the groundwork for parsers and other tools to annotate text with structured metadata, improving extensibility and downstream processing.