cspell 6.15.1 → 6.17.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.
@@ -163,7 +163,7 @@ function formatIssue(templateStr, issue, maxIssueTextWidth) {
163
163
  const rowText = row.toString();
164
164
  const colText = col.toString();
165
165
  const padRowCol = ' '.repeat(Math.max(1, 8 - (rowText.length + colText.length)));
166
- const suggestions = issue.suggestions?.join(', ') || '';
166
+ const suggestions = formatSuggestions(issue);
167
167
  const msg = issue.message || (issue.isFlagged ? 'Forbidden word' : 'Unknown word');
168
168
  const message = issue.isFlagged ? `{yellow ${msg}}` : msg;
169
169
  const substitutions = {
@@ -182,6 +182,17 @@ function formatIssue(templateStr, issue, maxIssueTextWidth) {
182
182
  const t = template(templateStr.replace(/\$message/g, message));
183
183
  return substitute(chalk(t), substitutions);
184
184
  }
185
+ function formatSuggestions(issue) {
186
+ if (issue.suggestionsEx) {
187
+ return issue.suggestionsEx
188
+ .map((sug) => (sug.isPreferred ? chalk.italic(chalk.bold(sug.word)) + '*' : sug.word))
189
+ .join(', ');
190
+ }
191
+ if (issue.suggestions) {
192
+ return issue.suggestions.join(', ');
193
+ }
194
+ return '';
195
+ }
185
196
  class TS extends Array {
186
197
  constructor(s) {
187
198
  super(s);
@@ -29,7 +29,13 @@ function emitSuggestionResult(result, options) {
29
29
  for (const sug of mappedSugs) {
30
30
  const { cost, dictionaries, w } = sug;
31
31
  const padding = ' '.repeat((0, util_1.padWidth)(w, maxWidth));
32
- const forbid = sug.forbidden ? chalk.red('X') : ' ';
32
+ const forbid = sug.forbidden && sug.isPreferred
33
+ ? chalk.red('*')
34
+ : sug.forbidden
35
+ ? chalk.red('X')
36
+ : sug.isPreferred
37
+ ? chalk.yellow('*')
38
+ : ' ';
33
39
  const ignore = sug.noSuggest ? chalk.yellow('N') : ' ';
34
40
  const strCost = (0, util_1.padLeft)(cost.toString(10), 4);
35
41
  const dicts = dictionaries.map((n) => chalk.gray(n)).join(', ');
@@ -51,6 +57,7 @@ function formatWordSingle(s) {
51
57
  let word = formatWord(s.word, s);
52
58
  word = s.forbidden ? word + chalk.red(' X') : word;
53
59
  word = s.noSuggest ? word + chalk.yellow(' Not suggested.') : word;
60
+ word = s.isPreferred ? chalk.yellow(word + ' *') : word;
54
61
  return word;
55
62
  }
56
63
  //# sourceMappingURL=suggestionsEmitter.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cspell",
3
- "version": "6.15.1",
3
+ "version": "6.17.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",
@@ -70,12 +70,12 @@
70
70
  },
71
71
  "homepage": "https://streetsidesoftware.github.io/cspell/",
72
72
  "dependencies": {
73
- "@cspell/cspell-pipe": "6.15.1",
73
+ "@cspell/cspell-pipe": "6.17.0",
74
74
  "chalk": "^4.1.2",
75
75
  "commander": "^9.4.1",
76
- "cspell-gitignore": "6.15.1",
77
- "cspell-glob": "6.15.1",
78
- "cspell-lib": "6.15.1",
76
+ "cspell-gitignore": "6.17.0",
77
+ "cspell-glob": "6.17.0",
78
+ "cspell-lib": "6.17.0",
79
79
  "fast-json-stable-stringify": "^2.1.0",
80
80
  "file-entry-cache": "^6.0.1",
81
81
  "fs-extra": "^10.1.0",
@@ -90,8 +90,8 @@
90
90
  "node": ">=14"
91
91
  },
92
92
  "devDependencies": {
93
- "@cspell/cspell-json-reporter": "6.15.1",
94
- "@cspell/cspell-types": "6.15.1",
93
+ "@cspell/cspell-json-reporter": "6.17.0",
94
+ "@cspell/cspell-types": "6.17.0",
95
95
  "@types/file-entry-cache": "^5.0.2",
96
96
  "@types/fs-extra": "^9.0.13",
97
97
  "@types/glob": "^8.0.0",
@@ -103,8 +103,8 @@
103
103
  "micromatch": "^4.0.5",
104
104
  "minimatch": "^5.1.1",
105
105
  "rimraf": "^3.0.2",
106
- "rollup": "^3.5.0",
106
+ "rollup": "^3.5.1",
107
107
  "rollup-plugin-dts": "^5.0.0"
108
108
  },
109
- "gitHead": "9668bef6beeec53e1e473efc97e309baa0338de2"
109
+ "gitHead": "a9917563690588777a16e844eaa9c112f44b2d21"
110
110
  }