cspell-lib 10.3.0 → 10.3.1-alpha.1
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.
|
@@ -60,6 +60,8 @@ const handlers = {
|
|
|
60
60
|
readonly: skip,
|
|
61
61
|
reporters: skip,
|
|
62
62
|
showStatus: copy1,
|
|
63
|
+
softWordBreakDefinitions: copy1,
|
|
64
|
+
softWordBreaks: copy1,
|
|
63
65
|
spellCheckDelayMs: copy1,
|
|
64
66
|
substitutionDefinitions: copy1,
|
|
65
67
|
substitutions: copy1,
|
|
@@ -180,6 +182,8 @@ const LanguageSettingsHandlers = {
|
|
|
180
182
|
name: skip,
|
|
181
183
|
noSuggestDictionaries: copy1,
|
|
182
184
|
patterns: copyPatternsField,
|
|
185
|
+
softWordBreaks: copy1,
|
|
186
|
+
softWordBreakDefinitions: copy1,
|
|
183
187
|
substitutionDefinitions: copy1,
|
|
184
188
|
substitutions: copy1,
|
|
185
189
|
suggestWords: copy1,
|
|
@@ -241,6 +245,8 @@ const OverridesHandlers = {
|
|
|
241
245
|
numSuggestions: copy1,
|
|
242
246
|
patterns: copyPatternsField,
|
|
243
247
|
pnpFiles: skip,
|
|
248
|
+
softWordBreaks: copy1,
|
|
249
|
+
softWordBreakDefinitions: copy1,
|
|
244
250
|
substitutionDefinitions: copy1,
|
|
245
251
|
substitutions: copy1,
|
|
246
252
|
suggestionNumChanges: copy1,
|
package/dist/lib/util/text.js
CHANGED
|
@@ -2,14 +2,10 @@ import { opConcatMap, opMap, pipe } from '@cspell/cspell-pipe/sync';
|
|
|
2
2
|
import { binarySearch } from './search.js';
|
|
3
3
|
import { regExAccents, regExAllLower, regExAllUpper, regExFirstUpper, regExIgnoreCharacters, regExpCamelCaseWordBreaksWithEnglishSuffix, regExWords, regExWordsAndDigits, } from './textRegex.js';
|
|
4
4
|
import { toUri } from './Uri.js';
|
|
5
|
-
import { scanMap } from './util.js';
|
|
6
5
|
export { stringToRegExp } from './textRegex.js';
|
|
7
6
|
// CSpell:ignore ings ning gimuy tsmerge
|
|
8
7
|
export function splitCamelCaseWordWithOffset(wo) {
|
|
9
|
-
return
|
|
10
|
-
text: '',
|
|
11
|
-
offset: wo.offset,
|
|
12
|
-
}));
|
|
8
|
+
return splitWordWithOffset(wo, regExpCamelCaseWordBreaksWithEnglishSuffix);
|
|
13
9
|
}
|
|
14
10
|
/**
|
|
15
11
|
* Split camelCase words into an array of strings.
|
|
@@ -18,10 +14,23 @@ export function splitCamelCaseWord(word) {
|
|
|
18
14
|
return splitWord(word, regExpCamelCaseWordBreaksWithEnglishSuffix);
|
|
19
15
|
}
|
|
20
16
|
export function splitWordWithOffset(wo, regExpWordBreaks) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
const wText = wo.text;
|
|
18
|
+
const absOffset = wo.offset;
|
|
19
|
+
const words = [];
|
|
20
|
+
let lastRelOffset = 0;
|
|
21
|
+
const r = new RegExp(regExpWordBreaks);
|
|
22
|
+
for (const m of wText.matchAll(r)) {
|
|
23
|
+
const text = wText.slice(lastRelOffset, m.index);
|
|
24
|
+
const offset = absOffset + lastRelOffset;
|
|
25
|
+
lastRelOffset = m.index + m[0].length;
|
|
26
|
+
words.push({ text, offset });
|
|
27
|
+
}
|
|
28
|
+
if (lastRelOffset < wText.length) {
|
|
29
|
+
const text = wText.slice(lastRelOffset);
|
|
30
|
+
const offset = absOffset + lastRelOffset;
|
|
31
|
+
words.push({ text, offset });
|
|
32
|
+
}
|
|
33
|
+
return words;
|
|
25
34
|
}
|
|
26
35
|
/**
|
|
27
36
|
* Split camelCase words into an array of strings.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export const regExUpperSOrIng = /([\p{Lu}\p{M}]+(?:\\?['’])?(?:s|ing|ies|es|ings|ed|ning))(?!\p{Ll})/gu;
|
|
3
3
|
export const regExSplitWords = /(\p{Ll}\p{M}?)(\p{Lu})/gu;
|
|
4
4
|
export const regExSplitWords2 = /(\p{Lu}\p{M}?)((\p{Lu}\p{M}?)\p{Ll})/gu;
|
|
5
|
-
export const regExpCamelCaseWordBreaksWithEnglishSuffix = /(?<=\p{Ll}\p{M}?)(?=\p{Lu})|(?<=\p{Lu}\p{M}?)(?=\p{Lu}\p{M}?\p{Ll})(?!\p{Lu}\p{M}?(?:s|ing|ies|es|ings|ed|ning)(?!\p{Ll}))/gu;
|
|
5
|
+
export const regExpCamelCaseWordBreaksWithEnglishSuffix = /(?<=\p{Ll}\p{M}?)(?=\p{Lu})|(?<=\p{Lu}\p{M}?)(?=\p{Lu}\p{M}?\p{Ll})(?!\p{Lu}\p{M}?(?:s|ing|ies|es|ings|ed|ning)(?!\p{Ll}))|\u00AD/gu;
|
|
6
6
|
export const regExpCamelCaseWordBreaks_NOT_USED = /(?<=\p{Ll}\p{M}?)(?=\p{Lu})|(?<=\p{Lu}\p{M}?)(?=\p{Lu}\p{M}?\p{Ll})/gu;
|
|
7
7
|
export const regExpAllPossibleWordBreaks_NOT_USED = /(?<=\p{Ll}\p{M}?)(?=\p{Lu})|(?<=\p{Lu}\p{M}?)(?=\p{Lu}\p{M}?\p{Ll})|(?<=\p{Lu}\p{M}?\p{Lu}\p{M}?)(?=\p{Ll})|(?<=\p{L}\p{M}?)(?=\P{L})|(?<=\P{L})(?=\p{L})/gu;
|
|
8
8
|
export const regExWords = /\p{L}\p{M}?(?:(?:\\?['’])?\p{L}\p{M}?)*/gu;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public",
|
|
5
5
|
"provenance": true
|
|
6
6
|
},
|
|
7
|
-
"version": "10.3.
|
|
7
|
+
"version": "10.3.1-alpha.1",
|
|
8
8
|
"description": "A library of useful functions used across various cspell tools.",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"sideEffects": false,
|
|
@@ -75,22 +75,22 @@
|
|
|
75
75
|
},
|
|
76
76
|
"homepage": "https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-lib#readme",
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@cspell/cspell-bundled-dicts": "10.3.
|
|
79
|
-
"@cspell/cspell-performance-monitor": "10.3.
|
|
80
|
-
"@cspell/cspell-pipe": "10.3.
|
|
81
|
-
"@cspell/cspell-resolver": "10.3.
|
|
82
|
-
"@cspell/cspell-types": "10.3.
|
|
83
|
-
"@cspell/dynamic-import": "10.3.
|
|
84
|
-
"@cspell/filetypes": "10.3.
|
|
85
|
-
"@cspell/rpc": "10.3.
|
|
86
|
-
"@cspell/strong-weak-map": "10.3.
|
|
87
|
-
"@cspell/url": "10.3.
|
|
88
|
-
"cspell-config-lib": "10.3.
|
|
89
|
-
"cspell-dictionary": "10.3.
|
|
90
|
-
"cspell-glob": "10.3.
|
|
91
|
-
"cspell-grammar": "10.3.
|
|
92
|
-
"cspell-io": "10.3.
|
|
93
|
-
"cspell-trie-lib": "10.3.
|
|
78
|
+
"@cspell/cspell-bundled-dicts": "10.3.1-alpha.1",
|
|
79
|
+
"@cspell/cspell-performance-monitor": "10.3.1-alpha.1",
|
|
80
|
+
"@cspell/cspell-pipe": "10.3.1-alpha.1",
|
|
81
|
+
"@cspell/cspell-resolver": "10.3.1-alpha.1",
|
|
82
|
+
"@cspell/cspell-types": "10.3.1-alpha.1",
|
|
83
|
+
"@cspell/dynamic-import": "10.3.1-alpha.1",
|
|
84
|
+
"@cspell/filetypes": "10.3.1-alpha.1",
|
|
85
|
+
"@cspell/rpc": "10.3.1-alpha.1",
|
|
86
|
+
"@cspell/strong-weak-map": "10.3.1-alpha.1",
|
|
87
|
+
"@cspell/url": "10.3.1-alpha.1",
|
|
88
|
+
"cspell-config-lib": "10.3.1-alpha.1",
|
|
89
|
+
"cspell-dictionary": "10.3.1-alpha.1",
|
|
90
|
+
"cspell-glob": "10.3.1-alpha.1",
|
|
91
|
+
"cspell-grammar": "10.3.1-alpha.1",
|
|
92
|
+
"cspell-io": "10.3.1-alpha.1",
|
|
93
|
+
"cspell-trie-lib": "10.3.1-alpha.1",
|
|
94
94
|
"env-paths": "^4.0.0",
|
|
95
95
|
"gensequence": "^8.0.8",
|
|
96
96
|
"import-fresh": "^4.0.0",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"node": ">=22.18.0"
|
|
104
104
|
},
|
|
105
105
|
"devDependencies": {
|
|
106
|
-
"@cspell/cspell-tools": "10.3.
|
|
106
|
+
"@cspell/cspell-tools": "10.3.1-alpha.1",
|
|
107
107
|
"@cspell/dict-cpp": "^7.1.0",
|
|
108
108
|
"@cspell/dict-csharp": "^4.0.8",
|
|
109
109
|
"@cspell/dict-css": "^4.1.2",
|
|
@@ -123,5 +123,5 @@
|
|
|
123
123
|
"lorem-ipsum": "^3.0.0",
|
|
124
124
|
"perf-insight": "^2.0.1"
|
|
125
125
|
},
|
|
126
|
-
"gitHead": "
|
|
126
|
+
"gitHead": "aa0576e5b7e666a7e8645939871bcfe4fa2a7eb5"
|
|
127
127
|
}
|