cspell 6.23.0 → 6.24.0

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.
package/README.md CHANGED
@@ -644,7 +644,7 @@ The spell checker includes a set of default dictionaries.
644
644
  ### Miscellaneous Dictionaries
645
645
 
646
646
  - **fonts** - long list of fonts - to assist with _css_
647
- - **filetypes** - list of file typescript
647
+ - **filetypes** - list of file types
648
648
  - **npm** - list of top 500+ package names on npm.
649
649
 
650
650
  ### Dictionary Definition
@@ -188,7 +188,9 @@ function formatIssue(templateStr, issue, maxIssueTextWidth) {
188
188
  function formatSuggestions(issue) {
189
189
  if (issue.suggestionsEx) {
190
190
  return issue.suggestionsEx
191
- .map((sug) => (sug.isPreferred ? chalk_1.default.italic(chalk_1.default.bold(sug.word)) + '*' : sug.word))
191
+ .map((sug) => sug.isPreferred
192
+ ? chalk_1.default.italic(chalk_1.default.bold(sug.wordAdjustedToMatchCase || sug.word)) + '*'
193
+ : sug.wordAdjustedToMatchCase || sug.word)
192
194
  .join(', ');
193
195
  }
194
196
  if (issue.suggestions) {
@@ -26,7 +26,10 @@ function emitSuggestionResult(result, options) {
26
26
  return r === word ? word : `${word} (${r})`;
27
27
  }
28
28
  if (verbose) {
29
- const mappedSugs = suggestions.map((s) => ({ ...s, w: handleRtl(s.compoundWord || s.word) }));
29
+ const mappedSugs = suggestions.map((s) => ({
30
+ ...s,
31
+ w: handleRtl(s.compoundWord || s.wordAdjustedToMatchCase || s.word),
32
+ }));
30
33
  const sugWidths = mappedSugs.map((s) => (0, util_1.width)(s.w));
31
34
  const maxWidth = sugWidths.reduce((max, len) => Math.max(max, len), 0);
32
35
  for (const sug of mappedSugs) {
@@ -46,7 +49,7 @@ function emitSuggestionResult(result, options) {
46
49
  }
47
50
  }
48
51
  else {
49
- const mappedSugs = suggestions.map((s) => ({ ...s, word: handleRtl(s.word) }));
52
+ const mappedSugs = suggestions.map((s) => ({ ...s, word: handleRtl(s.wordAdjustedToMatchCase || s.word) }));
50
53
  for (const r of mappedSugs) {
51
54
  output.log(` - ${formatWordSingle(r)}`);
52
55
  }
@@ -54,7 +57,22 @@ function emitSuggestionResult(result, options) {
54
57
  }
55
58
  exports.emitSuggestionResult = emitSuggestionResult;
56
59
  function formatWord(word, r) {
57
- return r.forbidden || r.noSuggest ? chalk_1.default.gray(chalk_1.default.strikethrough(word)) : word;
60
+ return r.forbidden || r.noSuggest
61
+ ? chalk_1.default.gray(chalk_1.default.strikethrough(word))
62
+ : word === r.wordAdjustedToMatchCase
63
+ ? diff(word, r.word)
64
+ : word;
65
+ }
66
+ function diff(wordA, wordB) {
67
+ const a = [...wordA];
68
+ const b = [...wordB];
69
+ const parts = [];
70
+ for (let idx = 0; idx < a.length; ++idx) {
71
+ const aa = a[idx];
72
+ const bb = b[idx];
73
+ parts.push(aa === bb ? aa : chalk_1.default.yellow(aa));
74
+ }
75
+ return parts.join('');
58
76
  }
59
77
  function formatWordSingle(s) {
60
78
  let word = formatWord(s.word, s);
package/dist/lint/lint.js CHANGED
@@ -93,7 +93,8 @@ async function runLint(cfg) {
93
93
  reporter.info(`Checking: ${filename}, File type: ${doc.languageId ?? 'auto'}, Language: ${doc.locale ?? 'default'}`, cspell_types_1.MessageTypes.Info);
94
94
  try {
95
95
  const { showSuggestions: generateSuggestions, validateDirectives } = cfg.options;
96
- const validateOptions = { generateSuggestions, numSuggestions: 5, validateDirectives };
96
+ const numSuggestions = configInfo.config.numSuggestions ?? 5;
97
+ const validateOptions = { generateSuggestions, numSuggestions, validateDirectives };
97
98
  const r = await cspell.spellCheckDocument(doc, validateOptions, configInfo.config);
98
99
  spellResult = r;
99
100
  result.processed = r.checked;
@@ -162,7 +162,7 @@ class DiskCache {
162
162
  return d;
163
163
  }
164
164
  getFileDep(file) {
165
- (0, assert_1.default)((0, path_1.isAbsolute)(file));
165
+ (0, assert_1.default)((0, path_1.isAbsolute)(file), `Dependency must be absolute "${file}"`);
166
166
  const f = this.toRelFile(file);
167
167
  let h;
168
168
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cspell",
3
- "version": "6.23.0",
3
+ "version": "6.24.0",
4
4
  "description": "A Spelling Checker for Code!",
5
5
  "funding": "https://github.com/streetsidesoftware/cspell?sponsor=1",
6
6
  "main": "dist/index.js",
@@ -76,13 +76,13 @@
76
76
  },
77
77
  "homepage": "https://streetsidesoftware.github.io/cspell/",
78
78
  "dependencies": {
79
- "@cspell/cspell-pipe": "6.23.0",
80
- "@cspell/dynamic-import": "6.23.0",
79
+ "@cspell/cspell-pipe": "6.24.0",
80
+ "@cspell/dynamic-import": "6.24.0",
81
81
  "chalk": "^4.1.2",
82
82
  "commander": "^10.0.0",
83
- "cspell-gitignore": "6.23.0",
84
- "cspell-glob": "6.23.0",
85
- "cspell-lib": "6.23.0",
83
+ "cspell-gitignore": "6.24.0",
84
+ "cspell-glob": "6.24.0",
85
+ "cspell-lib": "6.24.0",
86
86
  "fast-glob": "^3.2.12",
87
87
  "fast-json-stable-stringify": "^2.1.0",
88
88
  "file-entry-cache": "^6.0.1",
@@ -96,18 +96,18 @@
96
96
  "node": ">=14"
97
97
  },
98
98
  "devDependencies": {
99
- "@cspell/cspell-json-reporter": "6.23.0",
100
- "@cspell/cspell-types": "6.23.0",
99
+ "@cspell/cspell-json-reporter": "6.24.0",
100
+ "@cspell/cspell-types": "6.24.0",
101
101
  "@types/file-entry-cache": "^5.0.2",
102
102
  "@types/glob": "^8.0.1",
103
103
  "@types/imurmurhash": "^0.1.1",
104
104
  "@types/micromatch": "^4.0.2",
105
105
  "@types/semver": "^7.3.13",
106
106
  "micromatch": "^4.0.5",
107
- "minimatch": "^6.1.6",
108
- "rollup": "^3.14.0",
107
+ "minimatch": "^6.1.8",
108
+ "rollup": "^3.15.0",
109
109
  "rollup-plugin-dts": "^5.1.1",
110
110
  "vitest": "^0.28.4"
111
111
  },
112
- "gitHead": "a7cfbfa6cf42c9d9746dd8229d9f1317472e5af8"
112
+ "gitHead": "0d1e8bf9426cd0bfb814df4f61da12d8aee57ddd"
113
113
  }