@lvce-editor/completion-worker 1.8.0 → 1.9.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/completionWorkerMain.js +14 -2
- package/package.json +1 -1
|
@@ -1298,6 +1298,16 @@ const resolveCompletion = async (editorUid, name, completionItem) => {
|
|
|
1298
1298
|
}
|
|
1299
1299
|
};
|
|
1300
1300
|
|
|
1301
|
+
const getLines = async editorUid => {
|
|
1302
|
+
const lines = await invoke$1('Editor.getLines2', editorUid);
|
|
1303
|
+
return lines;
|
|
1304
|
+
};
|
|
1305
|
+
|
|
1306
|
+
const getSelections = async editorUid => {
|
|
1307
|
+
const selections = await invoke$1('Editor.getSelections2', editorUid);
|
|
1308
|
+
return selections;
|
|
1309
|
+
};
|
|
1310
|
+
|
|
1301
1311
|
const getSelectionPairs = (selections, i) => {
|
|
1302
1312
|
const first = selections[i];
|
|
1303
1313
|
const second = selections[i + 1];
|
|
@@ -1354,8 +1364,8 @@ const getEdits = async (editorUid, leadingWord, completionItem) => {
|
|
|
1354
1364
|
const word = completionItem.label;
|
|
1355
1365
|
const resolvedItem = await resolveCompletion(editorUid, word, completionItem);
|
|
1356
1366
|
const inserted = resolvedItem ? resolvedItem.snippet : word;
|
|
1357
|
-
const lines = await
|
|
1358
|
-
const selections = await
|
|
1367
|
+
const lines = await getLines(editorUid);
|
|
1368
|
+
const selections = await getSelections(editorUid);
|
|
1359
1369
|
const [startRowIndex, startColumnIndex] = selections;
|
|
1360
1370
|
const leadingWordLength = leadingWord.length;
|
|
1361
1371
|
const replaceRange$1 = new Uint32Array([startRowIndex, startColumnIndex - leadingWordLength, startRowIndex, startColumnIndex]);
|
|
@@ -1630,10 +1640,12 @@ const filterCompletionItems = (completionItems, word) => {
|
|
|
1630
1640
|
if (result.length > 0) {
|
|
1631
1641
|
if (flags & Deprecated) {
|
|
1632
1642
|
// TODO avoid mutation
|
|
1643
|
+
// @ts-ignore
|
|
1633
1644
|
completionItem.matches = EmptyMatches;
|
|
1634
1645
|
deprecated.push(completionItem);
|
|
1635
1646
|
} else {
|
|
1636
1647
|
// TODO avoid mutation
|
|
1648
|
+
// @ts-ignore
|
|
1637
1649
|
completionItem.matches = result;
|
|
1638
1650
|
filteredCompletions.push(completionItem);
|
|
1639
1651
|
}
|