import { TextDocument } from 'vscode-languageserver-textdocument'; import { Diagnostic, DiagnosticSeverity } from 'vscode-languageserver/node'; import { IndexMapping } from './IndexMapping'; import { TextRange } from './TextRange'; export declare const enum ErrorCode { BlockStateSortKeys = 0, CommandReplaceitem = 1, IdentityCompleteDefaultNamespace = 2, IdentityOmitDefaultNamespace = 3, IdentityUnknown = 4, JsonBlock = 5, JsonItem = 6, NbtByteToLiteral = 7, NbtByteToNumber = 8, NbtCompoundSortKeys = 9, NbtStringAttributeDatafix = 10, NbtTypeToByte = 11, NbtTypeToByteArray = 12, NbtTypeToShort = 13, NbtTypeToInt = 14, NbtTypeToIntArray = 15, NbtTypeToList = 16, NbtTypeToLong = 17, NbtTypeToLongArray = 18, NbtTypeToFloat = 19, NbtTypeToDouble = 20, NbtUuidDatafixCompound = 21, NbtUuidDatafixString = 22, NbtUuidDatafixUnknownKey = 23, SelectorSortKeys = 24, StringSingleQuote = 25, StringDoubleQuote = 26, StringUnquote = 27, VectorCenterCorrect = 28 } /** * Represent an error occured while parsing. */ export declare class ParsingError { /** * Range of the error. */ range: TextRange; /** * Human-readable error message. */ message: string; /** * Whether the error doesn't affect the process of parsing. * Default to `true` */ tolerable: boolean; /** * The severity of the error. */ severity: DiagnosticSeverity; /** * The code of the error. */ code?: ErrorCode | undefined; constructor( /** * Range of the error. */ range: TextRange, /** * Human-readable error message. */ message: string, /** * Whether the error doesn't affect the process of parsing. * Default to `true` */ tolerable?: boolean, /** * The severity of the error. */ severity?: DiagnosticSeverity, /** * The code of the error. */ code?: ErrorCode | undefined); /** * Get the diagnostic form of the parsing error. */ toDiagnostic(document: TextDocument): Diagnostic; } /** * Downgrade specific errors to tolerable ones. * @param errors Input errors. */ export declare function downgradeParsingError(errors: ParsingError[]): ParsingError[]; /** * Remap specific errors according to the mapping. * @param errors Input errors. */ export declare function remapParsingErrors(errors: ParsingError[], mapping: IndexMapping): void;