Skip to content

Commit

Permalink
Update definition to make json-schema easier to use.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason3S committed Nov 2, 2019
1 parent c89cc37 commit f810a4d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 22 deletions.
30 changes: 20 additions & 10 deletions cspell.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@
"description": "Is the spell checker enabled",
"type": "boolean"
},
"flagWords": {
"description": "list of words to always be considered incorrect.",
"items": {
"type": "string"
},
"type": "array"
},
"id": {
"description": "Optional identifier",
"type": "string"
Expand Down Expand Up @@ -148,6 +155,13 @@
"$ref": "#/definitions/RegExpPatternDefinition"
},
"type": "array"
},
"words": {
"description": "list of words to be always considered correct",
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
Expand Down Expand Up @@ -345,15 +359,8 @@
]
},
"PatternId": {
"anyOf": [
{
"type": "string"
},
{
"$ref": "#/definitions/PreDefinedPatterns"
}
],
"description": "This matches the name in a pattern definition"
"description": "This matches the name in a pattern definition",
"type": "string"
},
"PatternRef": {
"anyOf": [
Expand All @@ -362,6 +369,9 @@
},
{
"$ref": "#/definitions/PatternId"
},
{
"$ref": "#/definitions/PreDefinedPatterns"
}
],
"description": "A PatternRef is a Pattern or PatternId."
Expand Down Expand Up @@ -404,7 +414,7 @@
"description": "Pattern name, used as an identifier in ignoreRegExpList and includeRegExpList\nIt is possible to redefine one of the predefined patterns to override its value."
},
"pattern": {
"$ref": "#/definitions/PatternRef",
"$ref": "#/definitions/Pattern",
"description": "RegExp pattern"
}
},
Expand Down
18 changes: 9 additions & 9 deletions packages/cspell-lib/src/Settings/CSpellSettingsDef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,12 @@ export interface Settings extends BaseSetting {
*/
language?: LocalId;

/** list of words to be always considered correct */
words?: string[];

/** list of words to be ignored */
ignoreWords?: string[];

/** Glob file patterns to be ignored */
ignorePaths?: Glob[];

/** list of words to always be considered incorrect. */
flagWords?: string[];

/** languageIds for the files to spell check. */
enabledLanguageIds?: LanguageId[];

Expand Down Expand Up @@ -141,6 +135,12 @@ export interface BaseSetting {
*/
enabled?: boolean;

/** list of words to be always considered correct */
words?: string[];

/** list of words to always be considered incorrect. */
flagWords?: string[];

/**
* True to enable compound word checking.
* @default false
Expand Down Expand Up @@ -215,7 +215,7 @@ export interface LanguageSettingFilterFields {
export type RegExpList = PatternRef[];

/** A PatternRef is a Pattern or PatternId. */
export type PatternRef = Pattern | PatternId;
export type PatternRef = Pattern | PatternId | PreDefinedPatterns;

export type Pattern = string | RegExp;

Expand All @@ -237,7 +237,7 @@ export type PreDefinedPatterns =
'Everything';

/** This matches the name in a pattern definition */
export type PatternId = string | PreDefinedPatterns;
export type PatternId = string;

/** This matches the name in a dictionary definition */
export type DictionaryId = string;
Expand All @@ -260,7 +260,7 @@ export interface RegExpPatternDefinition {
/**
* RegExp pattern
*/
pattern: PatternRef;
pattern: Pattern;
/**
* Description of the pattern.
*/
Expand Down
7 changes: 4 additions & 3 deletions packages/cspell/samples/cspell-includes.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
{
"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/master/cspell.schema.json",
"id": "include-regex-example",
"languageSettings": [
// This one works with python
{
"description": "This one works with python",
"languageId": "python",
"includeRegExpList": [
// Python Comments
"/#.*|(?:('''|\"\"\")[^\\1]+?\\1)/g"
]
},
// this one works with javascript, C, typescript, etc,
{
"description": "this one works with javascript, C, typescript, etc.",
"languageId": "javascript",
"includeRegExpList": [
// Javascript Comments
"/(?:\\/\\/.*)|(?:\\/\\*[\\s\\S]+?\\*\\/)/g"
]
}
]
}
}

0 comments on commit f810a4d

Please sign in to comment.