Allow custom error messages for regex issues

This commit is contained in:
Martin Aeschlimann 2016-01-28 17:25:35 +01:00
parent 5168697dfd
commit 69dfecdbe4
2 changed files with 3 additions and 1 deletions

View file

@ -39,6 +39,8 @@ export interface IJSONSchema {
not?:IJSONSchema;
enum?:any[];
format?: string;
errorMessage?:string; // VS code internal
}
export interface IJSONSchemaMap {

View file

@ -452,7 +452,7 @@ export class StringASTNode extends ASTNode {
if (!regex.test(this.value)) {
validationResult.warnings.push({
location: { start: this.start, end: this.end },
message: nls.localize('patternWarning', 'String does not match the pattern of "{0}"', schema.pattern)
message: schema.errorMessage || nls.localize('patternWarning', 'String does not match the pattern of "{0}"', schema.pattern)
});
}
}