import { CSpellUserSettings, MappedText, ParsedText } from '@cspell/cspell-types'; import { CSpellSettingsInternal, CSpellSettingsInternalFinalized } from '../Models/CSpellSettingsInternalDef'; import { TextDocument } from '../Models/TextDocument'; import { ValidationIssue } from '../Models/ValidationIssue'; import { SpellingDictionaryCollection } from '../SpellingDictionary'; import { MatchRange } from '../util/TextRange'; import { TextValidator } from './lineValidatorFactory'; import { SimpleRange } from './parsedText'; import { ValidationOptions } from './ValidationTypes'; import { ValidateTextOptions } from './validator'; export interface DocumentValidatorOptions extends ValidateTextOptions { /** * Optional path to a configuration file. * If given, it will be used instead of searching for a configuration file. */ configFile?: string; /** * Prevents searching for local configuration files * By default the spell checker looks for configuration files * starting at the location of given filename. * If `configFile` is defined it will still be loaded instead of searching. * `false` will override the value in `settings.noConfigSearch`. * @defaultValue undefined */ noConfigSearch?: boolean; } export declare class DocumentValidator { readonly options: DocumentValidatorOptions; readonly settings: CSpellUserSettings; private _document; private _ready; readonly errors: Error[]; private _prepared; private _preparations; private _preparationTime; private _suggestions; /** * @param doc - Document to validate * @param config - configuration to use (not finalized). */ constructor(doc: TextDocument, options: DocumentValidatorOptions, settings: CSpellUserSettings); get ready(): boolean; prepareSync(): void; prepare(): Promise; private _prepareAsync; private _updatePrep; /** * The amount of time in ms to prepare for validation. */ get prepTime(): number; get validateDirectives(): boolean; checkText(range: SimpleRange, _text: string, scope: string[]): ValidationIssue[]; check(parsedText: ParsedText): ValidationIssue[]; /** * Check a Document for Validation Issues. * @param forceCheck - force a check even if the document would normally be excluded. * @returns the validation issues. */ checkDocumentAsync(forceCheck?: boolean): Promise; /** * Check a Document for Validation Issues. * * Note: The validator must be prepared before calling this method. * @param forceCheck - force a check even if the document would normally be excluded. * @returns the validation issues. */ checkDocument(forceCheck?: boolean): ValidationIssue[]; checkDocumentDirectives(forceCheck?: boolean): ValidationIssue[]; get document(): TextDocument; updateDocumentText(text: string): void; private defaultParser; private _checkParsedText; private addPossibleError; private catchError; private errorCatcherWrapper; private _parse; private getSuggestions; private genSuggestions; getFinalizedDocSettings(): CSpellSettingsInternal; /** * Returns true if the final result of the configuration calculation results * in the document being enabled. Note: in some cases, checking the document * might still make sense, for example, the `@cspell/eslint-plugin` relies on * `eslint` configuration to make that determination. * @returns true if the document settings have resolved to be `enabled` */ shouldCheckDocument(): boolean; /** * Internal `cspell-lib` use. */ _getPreparations(): Preparations | undefined; } interface Preparations { /** loaded config */ config: CSpellSettingsInternal; dictionary: SpellingDictionaryCollection; /** configuration after applying in-doc settings */ docSettings: CSpellSettingsInternal; finalSettings: CSpellSettingsInternalFinalized; includeRanges: MatchRange[]; textValidator: TextValidator; segmenter: (texts: MappedText) => Iterable; shouldCheck: boolean; validateOptions: ValidationOptions; localConfig: CSpellUserSettings | undefined; localConfigFilepath: string | undefined; } export {}; //# sourceMappingURL=docValidator.d.ts.map