cspell 6.23.1 → 6.25.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/dist/cli-reporter.js +3 -1
- package/dist/emitters/suggestionsEmitter.js +21 -3
- package/dist/lint/lint.js +2 -1
- package/package.json +12 -12
package/dist/cli-reporter.js
CHANGED
|
@@ -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) =>
|
|
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) => ({
|
|
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
|
|
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
|
|
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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cspell",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.25.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.
|
|
80
|
-
"@cspell/dynamic-import": "6.
|
|
79
|
+
"@cspell/cspell-pipe": "6.25.0",
|
|
80
|
+
"@cspell/dynamic-import": "6.25.0",
|
|
81
81
|
"chalk": "^4.1.2",
|
|
82
82
|
"commander": "^10.0.0",
|
|
83
|
-
"cspell-gitignore": "6.
|
|
84
|
-
"cspell-glob": "6.
|
|
85
|
-
"cspell-lib": "6.
|
|
83
|
+
"cspell-gitignore": "6.25.0",
|
|
84
|
+
"cspell-glob": "6.25.0",
|
|
85
|
+
"cspell-lib": "6.25.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.
|
|
100
|
-
"@cspell/cspell-types": "6.
|
|
99
|
+
"@cspell/cspell-json-reporter": "6.25.0",
|
|
100
|
+
"@cspell/cspell-types": "6.25.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.
|
|
107
|
+
"minimatch": "^6.2.0",
|
|
108
108
|
"rollup": "^3.15.0",
|
|
109
|
-
"rollup-plugin-dts": "^5.
|
|
110
|
-
"vitest": "^0.28.
|
|
109
|
+
"rollup-plugin-dts": "^5.2.0",
|
|
110
|
+
"vitest": "^0.28.5"
|
|
111
111
|
},
|
|
112
|
-
"gitHead": "
|
|
112
|
+
"gitHead": "fd7541605e07c43887191097d58ab58d87fac8fd"
|
|
113
113
|
}
|