cspell 5.18.4 → 5.18.5
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/emitters/suggestionsEmitter.js +18 -8
- package/package.json +11 -11
|
@@ -3,22 +3,31 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.emitSuggestionResult = void 0;
|
|
4
4
|
const chalk = require("chalk");
|
|
5
5
|
const util_1 = require("../util/util");
|
|
6
|
+
const regExpRTL = /([\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC י]+)/g;
|
|
7
|
+
function reverseRtlText(s) {
|
|
8
|
+
return s.replace(regExpRTL, (s) => s.split('').reverse().join(''));
|
|
9
|
+
}
|
|
6
10
|
function emitSuggestionResult(result, options) {
|
|
7
11
|
const { word, suggestions } = result;
|
|
8
12
|
const { verbose, output = console } = options;
|
|
9
13
|
const elapsed = verbose && verbose > 1 && result.elapsedTimeMs ? ` ${result.elapsedTimeMs.toFixed(2)} ms` : '';
|
|
10
|
-
|
|
14
|
+
const rWord = reverseRtlText(word);
|
|
15
|
+
const wordEx = rWord !== word ? ` (${chalk.yellow(rWord)})` : '';
|
|
16
|
+
output.log((word ? chalk.yellow(word) + wordEx : chalk.yellow('<empty>')) + ':' + elapsed);
|
|
11
17
|
if (!suggestions.length) {
|
|
12
18
|
console.log(chalk.yellow(' <no suggestions>'));
|
|
13
19
|
return;
|
|
14
20
|
}
|
|
21
|
+
function handleRtl(word) {
|
|
22
|
+
const r = reverseRtlText(word);
|
|
23
|
+
return r === word ? word : `${word} (${r})`;
|
|
24
|
+
}
|
|
15
25
|
if (verbose) {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
for (const sug of
|
|
20
|
-
const {
|
|
21
|
-
const w = compoundWord || word;
|
|
26
|
+
const mappedSugs = suggestions.map((s) => ({ ...s, w: handleRtl(s.compoundWord || s.word) }));
|
|
27
|
+
const sugWidths = mappedSugs.map((s) => (0, util_1.width)(s.w));
|
|
28
|
+
const maxWidth = sugWidths.reduce((max, len) => Math.max(max, len), 0);
|
|
29
|
+
for (const sug of mappedSugs) {
|
|
30
|
+
const { cost, dictionaries, w } = sug;
|
|
22
31
|
const padding = ' '.repeat((0, util_1.padWidth)(w, maxWidth));
|
|
23
32
|
const forbid = sug.forbidden ? chalk.red('X') : ' ';
|
|
24
33
|
const ignore = sug.noSuggest ? chalk.yellow('N') : ' ';
|
|
@@ -28,7 +37,8 @@ function emitSuggestionResult(result, options) {
|
|
|
28
37
|
}
|
|
29
38
|
}
|
|
30
39
|
else {
|
|
31
|
-
|
|
40
|
+
const mappedSugs = suggestions.map((s) => ({ ...s, word: handleRtl(s.word) }));
|
|
41
|
+
for (const r of mappedSugs) {
|
|
32
42
|
output.log(` - ${formatWordSingle(r)}`);
|
|
33
43
|
}
|
|
34
44
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cspell",
|
|
3
|
-
"version": "5.18.
|
|
3
|
+
"version": "5.18.5",
|
|
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,13 +70,13 @@
|
|
|
70
70
|
},
|
|
71
71
|
"homepage": "https://streetsidesoftware.github.io/cspell/",
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@cspell/cspell-pipe": "^5.18.
|
|
73
|
+
"@cspell/cspell-pipe": "^5.18.5",
|
|
74
74
|
"chalk": "^4.1.2",
|
|
75
75
|
"commander": "^9.0.0",
|
|
76
76
|
"comment-json": "^4.2.2",
|
|
77
|
-
"cspell-gitignore": "^5.18.
|
|
78
|
-
"cspell-glob": "^5.18.
|
|
79
|
-
"cspell-lib": "^5.18.
|
|
77
|
+
"cspell-gitignore": "^5.18.5",
|
|
78
|
+
"cspell-glob": "^5.18.5",
|
|
79
|
+
"cspell-lib": "^5.18.5",
|
|
80
80
|
"fast-json-stable-stringify": "^2.1.0",
|
|
81
81
|
"file-entry-cache": "^6.0.1",
|
|
82
82
|
"fs-extra": "^10.0.0",
|
|
@@ -91,8 +91,8 @@
|
|
|
91
91
|
"node": ">=12.13.0"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
|
-
"@cspell/cspell-json-reporter": "^5.18.
|
|
95
|
-
"@cspell/cspell-types": "^5.18.
|
|
94
|
+
"@cspell/cspell-json-reporter": "^5.18.5",
|
|
95
|
+
"@cspell/cspell-types": "^5.18.5",
|
|
96
96
|
"@types/file-entry-cache": "^5.0.2",
|
|
97
97
|
"@types/fs-extra": "^9.0.13",
|
|
98
98
|
"@types/glob": "^7.2.0",
|
|
@@ -100,12 +100,12 @@
|
|
|
100
100
|
"@types/micromatch": "^4.0.2",
|
|
101
101
|
"@types/minimatch": "^3.0.5",
|
|
102
102
|
"@types/semver": "^7.3.9",
|
|
103
|
-
"jest": "^27.5.
|
|
103
|
+
"jest": "^27.5.1",
|
|
104
104
|
"micromatch": "^4.0.4",
|
|
105
|
-
"minimatch": "^
|
|
105
|
+
"minimatch": "^4.1.1",
|
|
106
106
|
"rimraf": "^3.0.2",
|
|
107
|
-
"rollup": "^2.67.
|
|
107
|
+
"rollup": "^2.67.2",
|
|
108
108
|
"rollup-plugin-dts": "^4.1.0"
|
|
109
109
|
},
|
|
110
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "bff6b01340bde5ca7a89860868e179592eaa7520"
|
|
111
111
|
}
|