Skip to content

Commit

Permalink
fix: Move suggestionEditCosts into dictionaryInformation (#2296)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason3S committed Jan 21, 2022
1 parent 717f03f commit 021e781
Show file tree
Hide file tree
Showing 5 changed files with 511 additions and 34 deletions.
174 changes: 162 additions & 12 deletions cspell.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@
{
"$ref": "#/definitions/DictionaryDefinitionCustom"
},
{
"$ref": "#/definitions/DictionaryDefinitionAugmented"
},
{
"$ref": "#/definitions/DictionaryDefinitionAlternate"
}
Expand Down Expand Up @@ -187,10 +190,6 @@
"$ref": "#/definitions/ReplaceMap",
"description": "Replacement pairs."
},
"suggestionEditCosts": {
"$ref": "#/definitions/SuggestionCostsDefs",
"description": "Used in making suggestions. The lower the value, the more likely the suggestion will be near the top of the suggestion list.\n\nAdded with `v5.16.0`."
},
"type": {
"$ref": "#/definitions/DictionaryFileTypes",
"default": "S",
Expand All @@ -207,6 +206,49 @@
],
"type": "object"
},
"DictionaryDefinitionAugmented": {
"additionalProperties": false,
"description": "Used to provide extra data related to the dictionary",
"properties": {
"description": {
"description": "Optional description.",
"type": "string"
},
"dictionaryInformation": {
"$ref": "#/definitions/DictionaryInformation"
},
"name": {
"$ref": "#/definitions/DictionaryId",
"description": "This is the name of a dictionary.\n\nName Format:\n- Must contain at least 1 number or letter.\n- Spaces are allowed.\n- Leading and trailing space will be removed.\n- Names ARE case-sensitive.\n- Must not contain `*`, `!`, `;`, `,`, `{`, `}`, `[`, `]`, `~`."
},
"noSuggest": {
"description": "Indicate that suggestions should not come from this dictionary. Words in this dictionary are considered correct, but will not be used when making spell correction suggestions.\n\nNote: if a word is suggested by another dictionary, but found in this dictionary, it will be removed from the set of possible suggestions.",
"type": "boolean"
},
"path": {
"$ref": "#/definitions/DictionaryPath",
"description": "Path to the file."
},
"repMap": {
"$ref": "#/definitions/ReplaceMap",
"description": "Replacement pairs."
},
"type": {
"$ref": "#/definitions/DictionaryFileTypes",
"default": "S",
"description": "Type of file: S - single word per line, W - each line can contain one or more words separated by space, C - each line is treated like code (Camel Case is allowed). Default is S. C is the slowest to load due to the need to split each line based upon code splitting rules."
},
"useCompounds": {
"description": "Use Compounds.",
"type": "boolean"
}
},
"required": [
"name",
"path"
],
"type": "object"
},
"DictionaryDefinitionCustom": {
"additionalProperties": false,
"description": "For Defining Custom dictionaries. They are generally scoped to a `user`, `workspace`, or `folder`. When `addWords` is true, indicates that the spell checker can add words to the file. Note: only plain text files with one word per line are supported at this moment.",
Expand Down Expand Up @@ -249,10 +291,6 @@
],
"description": "Defines the scope for when words will be added to the dictionary. Scope values: `user`, `workspace`, `folder`."
},
"suggestionEditCosts": {
"$ref": "#/definitions/SuggestionCostsDefs",
"description": "Used in making suggestions. The lower the value, the more likely the suggestion will be near the top of the suggestion list.\n\nAdded with `v5.16.0`."
},
"type": {
"$ref": "#/definitions/DictionaryFileTypes",
"default": "S",
Expand Down Expand Up @@ -293,10 +331,6 @@
"$ref": "#/definitions/ReplaceMap",
"description": "Replacement pairs."
},
"suggestionEditCosts": {
"$ref": "#/definitions/SuggestionCostsDefs",
"description": "Used in making suggestions. The lower the value, the more likely the suggestion will be near the top of the suggestion list.\n\nAdded with `v5.16.0`."
},
"type": {
"$ref": "#/definitions/DictionaryFileTypes",
"default": "S",
Expand Down Expand Up @@ -327,6 +361,21 @@
"pattern": "^(?=[^!*,;{}[\\]~\\n]+$)(?=(.*\\w)).+$",
"type": "string"
},
"DictionaryInformation": {
"additionalProperties": false,
"description": "Use by dictionary authors to help improve the quality of suggestions given from the dictionary.\n\nAdded with `v5.16.0`.",
"properties": {
"hunspellInformation": {
"$ref": "#/definitions/HunspellInformation",
"description": "Used by dictionary authors"
},
"suggestionEditCosts": {
"$ref": "#/definitions/SuggestionCostsDefs",
"description": "Used in making suggestions. The lower the value, the more likely the suggestion will be near the top of the suggestion list."
}
},
"type": "object"
},
"DictionaryNegRef": {
"description": "This a negative reference to a named dictionary.\n\nIt is used to exclude or include a dictionary by name.\n\nThe reference starts with 1 or more `!`.\n- `!<dictionary_name>` - Used to exclude the dictionary matching `<dictionary_name>`.\n- `!!<dictionary_name>` - Used to re-include a dictionary matching `<dictionary_name>`. Overrides `!<dictionary_name>`.\n- `!!!<dictionary_name>` - Used to exclude a dictionary matching `<dictionary_name>`. Overrides `!!<dictionary_name>`.",
"pattern": "^(?=!+[^!*,;{}[\\]~\\n]+$)(?=(.*\\w)).+$",
Expand Down Expand Up @@ -378,6 +427,107 @@
"$ref": "#/definitions/SimpleGlob",
"description": "These are glob expressions."
},
"HunspellInformation": {
"additionalProperties": false,
"properties": {
"costs": {
"additionalProperties": false,
"description": "The costs to apply when using the hunspell settings",
"properties": {
"ioConvertCost": {
"default": 30,
"description": "The cost to convert between convert pairs.\n\nThe value should be slightly higher than the mapCost.",
"type": "number"
},
"keyboardCost": {
"default": 94,
"description": "The cost of replacing or swapping any adjacent keyboard characters.\n\nThis should be slightly cheaper than `tryCharCost`.",
"type": "number"
},
"mapCost": {
"default": 25,
"description": "mapSet replacement cost is the cost to substitute one character with another from the same set.\n\nMap characters are considered very similar to each other and are often the cause of simple mistakes.",
"type": "number"
},
"replaceCosts": {
"default": 75,
"description": "The cost to substitute pairs found in the replace settings.",
"type": "number"
},
"tryCharCost": {
"default": 95,
"description": "The cost of inserting / deleting / or swapping any `tryChars`",
"type": "number"
}
},
"type": "object"
},
"inConvert": {
"anyOf": [
{
"type": "string"
},
{
"items": {
"type": "string"
},
"type": "array"
}
]
},
"keyboard": {
"description": "This represents the layout of a common keyboard. Used for adjacency mistakes.\n\nHunspell: ```hunspell KEY qwertyuiop|asdfghjkl|zxcvbnm ``` Use: ```yaml keyboard: qwertyuiop|asdfghjkl|zxcvbnm ``` <!--- cspell:ignore asdfghjkl qwertyuiop zxcvbnm -->",
"type": "string"
},
"mapSets": {
"anyOf": [
{
"type": "string"
},
{
"items": {
"type": "string"
},
"type": "array"
}
],
"description": "This defines characters that are good substitutes for each other.\n- A `()` is need for multi character sequences like letters with multiple accents.\n- Separate unrelated characters with `|` or `\\n`\n\nExample:\n- Hunspell: ```hunspell MAP aàâäAÀÂÄ MAP eéèêëEÉÈÊË MAP iîïyIÎÏY MAP oôöOÔÖ MAP (IJ)(IJ) ```\n- Use: `yaml` ```yaml mapSets: | aàâäAÀÂÄ|eéèêëEÉÈÊË` eéèêëEÉÈÊË|iîïyIÎÏY oôöOÔÖ|(IJ)(IJ) ``` <!--- cspell:ignore aàâä eéèêë iîïy -->"
},
"outConvert": {
"anyOf": [
{
"type": "string"
},
{
"items": {
"type": "string"
},
"type": "array"
}
],
"description": "Output Conversions"
},
"replace": {
"anyOf": [
{
"type": "string"
},
{
"items": {
"type": "string"
},
"type": "array"
}
],
"description": "Common Substitutions. Special characters:\n- `^` - matches the beginning of a word.\n- `$` - matches the end of a word.\n\nHunspell: ```hunspell REP c ss REP e ij REP é ee REP g ch REP ï ii REP t d\t# gebiest=>gebiesd REP u ij ```\n\nUse: ```yaml replace: | c ss e ij é ee g ch ï ii t d u ij ```\n\n<!--- cspell:ignore gebiesd gebiest -->"
},
"tryChars": {
"description": "This is generally the alphabet used in the dictionary. It stands for the characters to try using for substitutions when looking for a suggestions.\n\nExample:\n- Hunspell: ```hunspell TRY aeistlunkodmrvpgjhäõbüoöfcwzxðqþ` ```\n- Use: yaml ```yaml tryChars: \"aeistlunkodmrvpgjhäõbüoöfcwzxðqþ\" ``` <!--- cspell:ignore aeistlunkodmrvpgjhäõbüoöfcwzxðqþ --",
"type": "string"
}
},
"type": "object"
},
"LanguageId": {
"anyOf": [
{
Expand Down
Loading

0 comments on commit 021e781

Please sign in to comment.