Class: DocumentValidator
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:110
Constructors
Constructor
new DocumentValidator(
doc,options,settings):DocumentValidator
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:145
Parameters
doc
Document to validate
options
options controlling how the document is validated.
settings
configuration to use (not finalized).
Returns
DocumentValidator
Properties
errors
readonlyerrors:Error[] =[]
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:113
options
readonlyoptions:DocumentValidatorOptions
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:118
perfTiming
readonlyperfTiming:PerfTimings={}
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:119
settings
readonlysettings:CSpellSettings
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:148
configuration to use (not finalized).
skipValidation
skipValidation:
boolean
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:120
Accessors
document
Get Signature
get document():
TextDocument
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:462
Returns
prepTime
Get Signature
get prepTime():
number
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:315
The amount of time in ms to prepare for validation.
Returns
number
ready
Get Signature
get ready():
boolean
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:161
Returns
boolean
recordCheckedRanges
Get Signature
get recordCheckedRanges():
boolean
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:645
Returns
boolean
Set Signature
set recordCheckedRanges(
value):void
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:649
Parameters
value
boolean
Returns
void
validateDirectives
Get Signature
get validateDirectives():
boolean
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:319
Returns
boolean
Methods
_getLocalConfig()
_getLocalConfig():
CSpellSettings|undefined
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:612
Internal cspell-lib use.
Returns
CSpellSettings | undefined
the config file found for the document, if any.
_getLocalConfigFilepath()
_getLocalConfigFilepath():
string|undefined
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:620
Internal cspell-lib use.
Returns
string | undefined
the path of the config file found for the document, if any.
_getPreparations()
_getPreparations():
Preparations|undefined
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:604
Internal cspell-lib use.
Returns
Preparations | undefined
Deprecated
Will be removed in a future major version. Use _getLocalConfig and _getLocalConfigFilepath instead.
check()
check(
parsedText):ValidationIssue[]
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:336
Parameters
parsedText
Returns
checkDocument()
checkDocument(
forceCheck?):ValidationIssue[]
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:420
Check a Document for Validation Issues.
Note: The validator must be prepared before calling this method.
Parameters
forceCheck?
boolean = false
force a check even if the document would normally be excluded.
Returns
the validation issues.
checkDocumentAsync()
checkDocumentAsync(
forceCheck?):Promise<ValidationIssue[]>
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:408
Check a Document for Validation Issues.
Parameters
forceCheck?
boolean
force a check even if the document would normally be excluded.
Returns
Promise<ValidationIssue[]>
the validation issues.
checkDocumentDirectives()
checkDocumentDirectives(
forceCheck?):ValidationIssue[]
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:440
Parameters
forceCheck?
boolean = false
Returns
checkText()
checkText(
range,_text,scope?):ValidationIssue[]
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:330
Check a range of text for validation issues.
Parameters
range
readonly [number, number]
the range of text to check.
_text
string | undefined
the text to check. If not given, the text will be taken from the document.
scope?
string | string[]
the scope to use for validation. If not given, the default scope will be used.
Returns
the validation issues.
getCheckedTextRanges()
getCheckedTextRanges():
MatchRange[]
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:631
Get the calculated ranges of text that should be included in the spell checking.
Use getRangesChecked to retrieve the ranges of text that have been checked.
Returns
MatchRange[]
MatchRanges of text to include.
getConfigErrors()
getConfigErrors():
ImportFileRefWithError[] |undefined
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:571
Returns
ImportFileRefWithError[] | undefined
getDictionaryErrors()
getDictionaryErrors():
Map<string,Error[]> |undefined
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:577
Returns
Map<string, Error[]> | undefined
getFinalizedDocSettings()
getFinalizedDocSettings():
CSpellSettingsInternal
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:565
Returns
CSpellSettingsInternal
getRangesChecked()
getRangesChecked():
Iterable<readonly [number,number]>
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:636
Returns
Iterable<readonly [number, number]>
prepare()
prepare():
Promise<void>
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:165
Returns
Promise<void>
shouldCheckDocument()
shouldCheckDocument():
boolean
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:594
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
boolean
true if the document settings have resolved to be enabled
traceWord()
traceWord(
word):TraceResult
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:472
Parameters
word
string
Returns
TraceResult
updateDocumentText()
updateDocumentText(
text):Promise<void>
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:466
Parameters
text
string
Returns
Promise<void>
create()
staticcreate(doc,options,settingsOrConfigFile):Promise<DocumentValidator>
Defined in: packages/cspell-lib/src/lib/textValidation/docValidator.ts:127
Parameters
doc
options
settingsOrConfigFile
CSpellSettings | ICSpellConfigFile
Returns
Promise<DocumentValidator>