cspell-lib 5.12.3 → 5.12.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -95,6 +95,7 @@ exports.languageExtensionDefinitions = [
95
95
  { id: 'typescript', extensions: ['.ts'] },
96
96
  { id: 'typescriptreact', extensions: ['.tsx'] },
97
97
  { id: 'vb', extensions: ['.vb', '.brs', '.vbs', '.bas'] },
98
+ { id: 'vue', extensions: ['.vue'] },
98
99
  {
99
100
  id: 'xml',
100
101
  extensions: [
@@ -25,7 +25,7 @@ const Text = __importStar(require("../util/text"));
25
25
  const CSpellSettingsServer_1 = require("./CSpellSettingsServer");
26
26
  // cspell:ignore gimuy
27
27
  const regExMatchRegEx = /\/.*\/[gimuy]*/;
28
- const regExInFileSettings = [/(?:spell-?checker|cSpell)::?\s*(.*)/gi, /(LocalWords:?\s+.*)/g];
28
+ const regExInFileSettings = [/(?:spell-?checker|c?spell)::?(.*)/gi, /(LocalWords:?.*)/g];
29
29
  function getInDocumentSettings(text) {
30
30
  const settings = getPossibleInDocSettings(text)
31
31
  .concatMap((a) => parseSettingMatch(a))
@@ -36,17 +36,18 @@ function getInDocumentSettings(text) {
36
36
  }
37
37
  exports.getInDocumentSettings = getInDocumentSettings;
38
38
  function parseSettingMatch(matchArray) {
39
- const [, possibleSetting = ''] = matchArray;
39
+ const [, match = ''] = matchArray;
40
+ const possibleSetting = match.trim();
40
41
  const settingParsers = [
41
42
  [/^(?:enable|disable)(?:allow)?CompoundWords/i, parseCompoundWords],
42
43
  [/^words?\s/i, parseWords],
43
44
  [/^ignore(?:words?)?\s/i, parseIgnoreWords],
44
45
  [/^ignore_?Reg_?Exp\s+.+$/i, parseIgnoreRegExp],
45
46
  [/^include_?Reg_?Exp\s+.+$/i, parseIncludeRegExp],
46
- [/^locale?\s/i, parseLocal],
47
- [/^language\s/i, parseLocal],
47
+ [/^locale?\s/i, parseLocale],
48
+ [/^language\s/i, parseLocale],
48
49
  [/^dictionaries\s/i, parseDictionaries],
49
- [/^LocalWords:/, parseWords],
50
+ [/^LocalWords:/, (w) => parseWords(w.replace(/LocalWords:?/gi, ' '))],
50
51
  ];
51
52
  return settingParsers
52
53
  .filter(([regex]) => regex.test(possibleSetting))
@@ -61,9 +62,9 @@ function parseWords(match) {
61
62
  const words = match.split(/[,\s]+/g).slice(1);
62
63
  return { id: 'in-doc-words', words };
63
64
  }
64
- function parseLocal(match) {
65
- const parts = match.trim().split(/\s+/);
66
- const language = parts.slice(1).join(' ');
65
+ function parseLocale(match) {
66
+ const parts = match.trim().split(/[\s,]+/);
67
+ const language = parts.slice(1).join(',');
67
68
  return language ? { id: 'in-doc-local', language } : {};
68
69
  }
69
70
  function parseIgnoreWords(match) {
@@ -27,13 +27,19 @@ function getDefaultLanguageSettings() {
27
27
  return defaultLanguageSettings;
28
28
  }
29
29
  exports.getDefaultLanguageSettings = getDefaultLanguageSettings;
30
+ function localesToList(locales) {
31
+ locales = typeof locales !== 'string' ? locales.join(',') : locales;
32
+ return stringToList(locales.replace(/\s+/g, ','));
33
+ }
30
34
  function stringToList(sList) {
31
- if (typeof sList === 'string') {
32
- sList = sList
33
- .replace(/[|;]/g, ',')
34
- .split(',')
35
- .map((s) => s.trim());
35
+ if (typeof sList !== 'string') {
36
+ sList = sList.join(',');
36
37
  }
38
+ sList = sList
39
+ .replace(/[|;]/g, ',')
40
+ .split(',')
41
+ .map((s) => s.trim())
42
+ .filter((s) => !!s);
37
43
  return sList;
38
44
  }
39
45
  function normalizeLanguageId(langId) {
@@ -45,7 +51,7 @@ function normalizeLanguageIdToString(langId) {
45
51
  return [...normalizeLanguageId(langId)].join(',');
46
52
  }
47
53
  function normalizeLocale(locale) {
48
- locale = stringToList(locale);
54
+ locale = localesToList(locale);
49
55
  return new Set(locale.map((locale) => locale.toLowerCase().replace(/[^a-z]/g, '')));
50
56
  }
51
57
  exports.normalizeLocale = normalizeLocale;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cspell-lib",
3
- "version": "5.12.3",
3
+ "version": "5.12.4",
4
4
  "description": "A library of useful functions used across various cspell tools.",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -47,15 +47,15 @@
47
47
  },
48
48
  "homepage": "https://github.com/streetsidesoftware/cspell#readme",
49
49
  "dependencies": {
50
- "@cspell/cspell-bundled-dicts": "^5.12.3",
51
- "@cspell/cspell-types": "^5.12.3",
50
+ "@cspell/cspell-bundled-dicts": "^5.12.4",
51
+ "@cspell/cspell-types": "^5.12.4",
52
52
  "clear-module": "^4.1.1",
53
53
  "comment-json": "^4.1.1",
54
54
  "configstore": "^5.0.1",
55
55
  "cosmiconfig": "^7.0.1",
56
- "cspell-glob": "^5.12.3",
57
- "cspell-io": "^5.12.3",
58
- "cspell-trie-lib": "^5.12.3",
56
+ "cspell-glob": "^5.12.4",
57
+ "cspell-io": "^5.12.4",
58
+ "cspell-trie-lib": "^5.12.4",
59
59
  "find-up": "^5.0.0",
60
60
  "fs-extra": "^10.0.0",
61
61
  "gensequence": "^3.1.1",
@@ -72,19 +72,19 @@
72
72
  "@cspell/dict-csharp": "^1.0.11",
73
73
  "@cspell/dict-css": "^1.0.12",
74
74
  "@cspell/dict-fa-ir": "^1.0.17",
75
- "@cspell/dict-fr-fr": "^1.2.21",
75
+ "@cspell/dict-fr-fr": "^2.0.1",
76
76
  "@cspell/dict-html": "^1.1.9",
77
77
  "@cspell/dict-nl-nl": "^2.0.1",
78
- "@cspell/dict-python": "^2.0.3",
78
+ "@cspell/dict-python": "^2.0.4",
79
79
  "@types/configstore": "^5.0.1",
80
80
  "@types/fs-extra": "^9.0.13",
81
81
  "@types/jest": "^27.0.2",
82
- "@types/node": "^16.10.3",
82
+ "@types/node": "^16.11.6",
83
83
  "cspell-dict-nl-nl": "^1.1.2",
84
- "jest": "^27.2.5",
84
+ "jest": "^27.3.1",
85
85
  "lorem-ipsum": "^2.0.4",
86
86
  "rimraf": "^3.0.2",
87
- "ts-jest": "^27.0.5"
87
+ "ts-jest": "^27.0.7"
88
88
  },
89
- "gitHead": "6c424aed933adb8d983ab09dd45042d63d7a5cd8"
89
+ "gitHead": "3e9973c39725f65141683b373ed839562f28bd94"
90
90
  }