@lvce-editor/editor-worker 3.16.0 → 3.18.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/editorWorkerMain.js +26 -25
- package/package.json +3 -53
package/dist/editorWorkerMain.js
CHANGED
|
@@ -595,14 +595,10 @@ const getSelectionPairs = (selections, i) => {
|
|
|
595
595
|
return [first, second, third, fourth, 0];
|
|
596
596
|
};
|
|
597
597
|
|
|
598
|
-
const
|
|
599
|
-
const
|
|
600
|
-
const EmptyString = '';
|
|
601
|
-
const Space = ' ';
|
|
598
|
+
const EmptyString$1 = '';
|
|
599
|
+
const Space$1 = ' ';
|
|
602
600
|
const Tab = '\t';
|
|
603
|
-
const Underline = '_';
|
|
604
601
|
const DoubleQuote$1 = '"';
|
|
605
|
-
const T = 't';
|
|
606
602
|
|
|
607
603
|
const getTabCount = string => {
|
|
608
604
|
let count = 0;
|
|
@@ -675,7 +671,7 @@ const measureTextWidth = (text, fontWeight, fontSize, fontFamily, letterSpacing,
|
|
|
675
671
|
|
|
676
672
|
const normalizeText = (text, normalize, tabSize) => {
|
|
677
673
|
if (normalize) {
|
|
678
|
-
return text.replaceAll(Tab, Space.repeat(tabSize));
|
|
674
|
+
return text.replaceAll(Tab, Space$1.repeat(tabSize));
|
|
679
675
|
}
|
|
680
676
|
return text;
|
|
681
677
|
};
|
|
@@ -2828,7 +2824,7 @@ const characterRight = (line, columnIndex) => {
|
|
|
2828
2824
|
return next.segment.length;
|
|
2829
2825
|
};
|
|
2830
2826
|
const isWhitespace = char => {
|
|
2831
|
-
return char === Space || char === Tab;
|
|
2827
|
+
return char === Space$1 || char === Tab;
|
|
2832
2828
|
};
|
|
2833
2829
|
const lineCharacterStart = (line, columnIndex) => {
|
|
2834
2830
|
if (line.length === 0) {
|
|
@@ -3345,7 +3341,7 @@ const getWordAt$1 = (line, columnIndex) => {
|
|
|
3345
3341
|
const matchBefore = before.match(RE_WORD_END$1);
|
|
3346
3342
|
const after = line.slice(columnIndex);
|
|
3347
3343
|
const matchAfter = after.match(RE_WORD_START$1);
|
|
3348
|
-
let word = EmptyString;
|
|
3344
|
+
let word = EmptyString$1;
|
|
3349
3345
|
if (matchBefore) {
|
|
3350
3346
|
word += matchBefore[0];
|
|
3351
3347
|
}
|
|
@@ -3362,7 +3358,7 @@ const getWordBefore$1 = (line, columnIndex) => {
|
|
|
3362
3358
|
if (matchBefore) {
|
|
3363
3359
|
return matchBefore[0];
|
|
3364
3360
|
}
|
|
3365
|
-
return EmptyString;
|
|
3361
|
+
return EmptyString$1;
|
|
3366
3362
|
};
|
|
3367
3363
|
|
|
3368
3364
|
const getWordAt = (editor, rowIndex, columnIndex) => {
|
|
@@ -4685,8 +4681,6 @@ const resolveCompletion = async (editor, name, completionItem) => {
|
|
|
4685
4681
|
|
|
4686
4682
|
const None$1 = 1;
|
|
4687
4683
|
|
|
4688
|
-
const EmptyMatches = [];
|
|
4689
|
-
|
|
4690
4684
|
const Diagonal = 1;
|
|
4691
4685
|
const Left = 2;
|
|
4692
4686
|
|
|
@@ -4700,11 +4694,16 @@ const createTable = size => {
|
|
|
4700
4694
|
}
|
|
4701
4695
|
return table;
|
|
4702
4696
|
};
|
|
4703
|
-
|
|
4697
|
+
const EmptyMatches$1 = [];
|
|
4698
|
+
const Dash = '-';
|
|
4699
|
+
const Dot = '.';
|
|
4700
|
+
const EmptyString = '';
|
|
4701
|
+
const Space = ' ';
|
|
4702
|
+
const Underline = '_';
|
|
4703
|
+
const T = 't';
|
|
4704
4704
|
const isLowerCase = char => {
|
|
4705
4705
|
return char === char.toLowerCase();
|
|
4706
4706
|
};
|
|
4707
|
-
|
|
4708
4707
|
const isUpperCase = char => {
|
|
4709
4708
|
return char === char.toUpperCase();
|
|
4710
4709
|
};
|
|
@@ -4727,7 +4726,7 @@ const isGap = (columnCharBefore, columnChar) => {
|
|
|
4727
4726
|
};
|
|
4728
4727
|
|
|
4729
4728
|
// based on https://github.com/microsoft/vscode/blob/3059063b805ed0ac10a6d9539e213386bfcfb852/src/vs/base/common/filters.ts by Microsoft (License MIT)
|
|
4730
|
-
const getScore = (rowCharLow, rowChar, columnCharBefore, columnCharLow, columnChar,
|
|
4729
|
+
const getScore = (rowCharLow, rowChar, columnCharBefore, columnCharLow, columnChar, isDiagonalMatch) => {
|
|
4731
4730
|
if (rowCharLow !== columnCharLow) {
|
|
4732
4731
|
return -1;
|
|
4733
4732
|
}
|
|
@@ -4794,13 +4793,13 @@ const traceHighlights = (table, arrows, patternLength, wordLength) => {
|
|
|
4794
4793
|
const gridSize = 128;
|
|
4795
4794
|
const table = createTable(gridSize);
|
|
4796
4795
|
const arrows = createTable(gridSize);
|
|
4797
|
-
const
|
|
4796
|
+
const fuzzySearch = (pattern, word) => {
|
|
4798
4797
|
const patternLength = Math.min(pattern.length, gridSize - 1);
|
|
4799
4798
|
const wordLength = Math.min(word.length, gridSize - 1);
|
|
4800
4799
|
const patternLower = pattern.toLowerCase();
|
|
4801
4800
|
const wordLower = word.toLowerCase();
|
|
4802
4801
|
if (!isPatternInWord(patternLower, 0, patternLength, wordLower, 0, wordLength)) {
|
|
4803
|
-
return EmptyMatches;
|
|
4802
|
+
return EmptyMatches$1;
|
|
4804
4803
|
}
|
|
4805
4804
|
let strongMatch = false;
|
|
4806
4805
|
for (let row = 1; row < patternLength + 1; row++) {
|
|
@@ -4811,7 +4810,7 @@ const filterCompletionItem = (pattern, word) => {
|
|
|
4811
4810
|
const columnCharLow = wordLower[column - 1];
|
|
4812
4811
|
const columnCharBefore = word[column - 2] || '';
|
|
4813
4812
|
const isDiagonalMatch = arrows[row - 1][column - 1] === Diagonal;
|
|
4814
|
-
const score = getScore(rowCharLow, rowChar, columnCharBefore, columnCharLow, columnChar,
|
|
4813
|
+
const score = getScore(rowCharLow, rowChar, columnCharBefore, columnCharLow, columnChar, isDiagonalMatch);
|
|
4815
4814
|
if (row === 1 && score > 5) {
|
|
4816
4815
|
strongMatch = true;
|
|
4817
4816
|
}
|
|
@@ -4830,7 +4829,7 @@ const filterCompletionItem = (pattern, word) => {
|
|
|
4830
4829
|
}
|
|
4831
4830
|
}
|
|
4832
4831
|
if (!strongMatch) {
|
|
4833
|
-
return EmptyMatches;
|
|
4832
|
+
return EmptyMatches$1;
|
|
4834
4833
|
}
|
|
4835
4834
|
const highlights = traceHighlights(table, arrows, patternLength, wordLength);
|
|
4836
4835
|
return highlights;
|
|
@@ -4838,6 +4837,8 @@ const filterCompletionItem = (pattern, word) => {
|
|
|
4838
4837
|
|
|
4839
4838
|
const Deprecated = 1 << 0;
|
|
4840
4839
|
|
|
4840
|
+
const EmptyMatches = [];
|
|
4841
|
+
|
|
4841
4842
|
const addEmptyMatch = item => {
|
|
4842
4843
|
return {
|
|
4843
4844
|
...item,
|
|
@@ -4845,7 +4846,7 @@ const addEmptyMatch = item => {
|
|
|
4845
4846
|
};
|
|
4846
4847
|
};
|
|
4847
4848
|
const filterCompletionItems = (completionItems, word) => {
|
|
4848
|
-
if (word === EmptyString) {
|
|
4849
|
+
if (word === EmptyString$1) {
|
|
4849
4850
|
return completionItems.map(addEmptyMatch);
|
|
4850
4851
|
}
|
|
4851
4852
|
const filteredCompletions = [];
|
|
@@ -4855,8 +4856,8 @@ const filterCompletionItems = (completionItems, word) => {
|
|
|
4855
4856
|
label,
|
|
4856
4857
|
flags
|
|
4857
4858
|
} = completionItem;
|
|
4858
|
-
const result =
|
|
4859
|
-
if (result
|
|
4859
|
+
const result = fuzzySearch(word, label);
|
|
4860
|
+
if (result.length > 0) {
|
|
4860
4861
|
if (flags & Deprecated) {
|
|
4861
4862
|
// TODO avoid mutation
|
|
4862
4863
|
completionItem.matches = EmptyMatches;
|
|
@@ -9130,11 +9131,11 @@ const getSymbolName = kind => {
|
|
|
9130
9131
|
const getCompletionFileIcon = kind => {
|
|
9131
9132
|
switch (kind) {
|
|
9132
9133
|
case File:
|
|
9133
|
-
return EmptyString;
|
|
9134
|
+
return EmptyString$1;
|
|
9134
9135
|
case Folder:
|
|
9135
|
-
return EmptyString;
|
|
9136
|
+
return EmptyString$1;
|
|
9136
9137
|
default:
|
|
9137
|
-
return EmptyString;
|
|
9138
|
+
return EmptyString$1;
|
|
9138
9139
|
}
|
|
9139
9140
|
};
|
|
9140
9141
|
|
package/package.json
CHANGED
|
@@ -1,60 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/editor-worker",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.18.0",
|
|
4
4
|
"description": "",
|
|
5
|
-
"main": "dist/
|
|
5
|
+
"main": "dist/editorWorkerMain.js",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"directories": {
|
|
8
|
-
"test": "test"
|
|
9
|
-
},
|
|
10
7
|
"keywords": [],
|
|
11
8
|
"author": "",
|
|
12
|
-
"license": "MIT"
|
|
13
|
-
"xo": {
|
|
14
|
-
"rules": {
|
|
15
|
-
"unicorn/filename-case": "off",
|
|
16
|
-
"indent": "off",
|
|
17
|
-
"semi": "off",
|
|
18
|
-
"no-unused-vars": "off",
|
|
19
|
-
"unicorn/numeric-separators-style": "off",
|
|
20
|
-
"no-extra-semi": "off",
|
|
21
|
-
"arrow-body-style": "off",
|
|
22
|
-
"padded-blocks": "off",
|
|
23
|
-
"capitalized-comments": "off",
|
|
24
|
-
"padding-line-between-statements": "off",
|
|
25
|
-
"arrow-parens": "off",
|
|
26
|
-
"no-warning-comments": "off",
|
|
27
|
-
"array-bracket-spacing": "off",
|
|
28
|
-
"comma-spacing": "off",
|
|
29
|
-
"unicorn/no-array-callback-reference": "off",
|
|
30
|
-
"comma-dangle": "off",
|
|
31
|
-
"operator-linebreak": "off",
|
|
32
|
-
"no-case-declarations": "off",
|
|
33
|
-
"no-undef": "off",
|
|
34
|
-
"object-curly-spacing": "off",
|
|
35
|
-
"object-shorthand": "off",
|
|
36
|
-
"complexity": "off",
|
|
37
|
-
"no-labels": "off",
|
|
38
|
-
"no-multi-assign": "off",
|
|
39
|
-
"max-params": "off",
|
|
40
|
-
"no-bitwise": "off",
|
|
41
|
-
"unicorn/prefer-math-trunc": "off",
|
|
42
|
-
"no-await-in-loop": "off",
|
|
43
|
-
"unicorn/prefer-add-event-listener": "off",
|
|
44
|
-
"no-unused-expressions": "off",
|
|
45
|
-
"unicorn/better-regex": "off",
|
|
46
|
-
"unicorn/no-array-push-push": "off",
|
|
47
|
-
"unicorn/prevent-abbreviations": "off"
|
|
48
|
-
},
|
|
49
|
-
"ignores": [
|
|
50
|
-
"distmin"
|
|
51
|
-
]
|
|
52
|
-
},
|
|
53
|
-
"nodemonConfig": {
|
|
54
|
-
"watch": [
|
|
55
|
-
"src"
|
|
56
|
-
],
|
|
57
|
-
"ext": "ts,js",
|
|
58
|
-
"exec": "node scripts/build.js"
|
|
59
|
-
}
|
|
9
|
+
"license": "MIT"
|
|
60
10
|
}
|