@lvce-editor/completion-worker 1.19.0 → 1.20.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/README.md +15 -2
- package/dist/completionWorkerMain.js +51 -45
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Completion Worker
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> A Web Worker for the completion functionality in Lvce Editor.
|
|
4
|
+
|
|
5
|
+
## Contributing
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
git clone git@github.com:lvce-editor/completion-worker.git &&
|
|
9
|
+
cd completion-worker &&
|
|
10
|
+
npm ci &&
|
|
11
|
+
npm completion
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Gitpod
|
|
15
|
+
|
|
16
|
+
[](https://gitpod.io/#https://github.com/lvce-editor/completion-worker)
|
|
@@ -1001,7 +1001,7 @@ const WebWorkerRpcClient = {
|
|
|
1001
1001
|
};
|
|
1002
1002
|
|
|
1003
1003
|
const rpcs = Object.create(null);
|
|
1004
|
-
const set$
|
|
1004
|
+
const set$f = (id, rpc) => {
|
|
1005
1005
|
rpcs[id] = rpc;
|
|
1006
1006
|
};
|
|
1007
1007
|
const get$1 = id => {
|
|
@@ -1025,7 +1025,7 @@ const create$2 = rpcId => {
|
|
|
1025
1025
|
return rpc.invokeAndTransfer(method, ...params);
|
|
1026
1026
|
},
|
|
1027
1027
|
set(rpc) {
|
|
1028
|
-
set$
|
|
1028
|
+
set$f(rpcId, rpc);
|
|
1029
1029
|
},
|
|
1030
1030
|
async dispose() {
|
|
1031
1031
|
const rpc = get$1(rpcId);
|
|
@@ -1036,31 +1036,28 @@ const create$2 = rpcId => {
|
|
|
1036
1036
|
const EditorWorker$1 = 99;
|
|
1037
1037
|
const ExtensionHostWorker = 44;
|
|
1038
1038
|
const {
|
|
1039
|
-
invoke: invoke$
|
|
1040
|
-
invokeAndTransfer: invokeAndTransfer$
|
|
1041
|
-
set: set$
|
|
1042
|
-
} = create$2(EditorWorker$1);
|
|
1039
|
+
invoke: invoke$c,
|
|
1040
|
+
invokeAndTransfer: invokeAndTransfer$c,
|
|
1041
|
+
set: set$c} = create$2(EditorWorker$1);
|
|
1043
1042
|
const EditorWorker = {
|
|
1044
1043
|
__proto__: null,
|
|
1045
|
-
invoke: invoke$
|
|
1046
|
-
invokeAndTransfer: invokeAndTransfer$
|
|
1047
|
-
set: set$
|
|
1044
|
+
invoke: invoke$c,
|
|
1045
|
+
invokeAndTransfer: invokeAndTransfer$c,
|
|
1046
|
+
set: set$c
|
|
1048
1047
|
};
|
|
1049
1048
|
const {
|
|
1050
|
-
invoke: invoke$
|
|
1051
|
-
set: set$
|
|
1052
|
-
} = create$2(ExtensionHostWorker);
|
|
1049
|
+
invoke: invoke$9,
|
|
1050
|
+
set: set$9} = create$2(ExtensionHostWorker);
|
|
1053
1051
|
const ExtensionHost = {
|
|
1054
1052
|
__proto__: null,
|
|
1055
|
-
invoke: invoke$
|
|
1056
|
-
set: set$
|
|
1053
|
+
invoke: invoke$9,
|
|
1054
|
+
set: set$9
|
|
1057
1055
|
};
|
|
1058
1056
|
|
|
1059
1057
|
const {
|
|
1060
1058
|
invoke: invoke$1,
|
|
1061
1059
|
set: set$2,
|
|
1062
|
-
invokeAndTransfer
|
|
1063
|
-
} = EditorWorker;
|
|
1060
|
+
invokeAndTransfer} = EditorWorker;
|
|
1064
1061
|
|
|
1065
1062
|
const FocusEditorCompletions = 9;
|
|
1066
1063
|
const FocusEditorRename = 11;
|
|
@@ -1293,7 +1290,6 @@ const getSelectionText = (lines, range) => {
|
|
|
1293
1290
|
return selectedLines;
|
|
1294
1291
|
};
|
|
1295
1292
|
|
|
1296
|
-
// TODO add more exact types
|
|
1297
1293
|
const replaceRange = (lines, ranges, replacement, origin) => {
|
|
1298
1294
|
const changes = [];
|
|
1299
1295
|
const rangesLength = ranges.length;
|
|
@@ -1335,8 +1331,7 @@ const activateByEvent = async event => {
|
|
|
1335
1331
|
|
|
1336
1332
|
const {
|
|
1337
1333
|
invoke,
|
|
1338
|
-
set
|
|
1339
|
-
} = ExtensionHost;
|
|
1334
|
+
set} = ExtensionHost;
|
|
1340
1335
|
|
|
1341
1336
|
const execute = async ({
|
|
1342
1337
|
editorLanguageId,
|
|
@@ -1449,8 +1444,37 @@ const End = 255;
|
|
|
1449
1444
|
const Home = 12;
|
|
1450
1445
|
const UpArrow = 14;
|
|
1451
1446
|
const DownArrow = 16;
|
|
1452
|
-
|
|
1447
|
+
const KeyCode = {
|
|
1448
|
+
__proto__: null,
|
|
1449
|
+
DownArrow,
|
|
1450
|
+
End,
|
|
1451
|
+
Enter,
|
|
1452
|
+
Escape,
|
|
1453
|
+
Home,
|
|
1454
|
+
Space: Space$1,
|
|
1455
|
+
UpArrow
|
|
1456
|
+
};
|
|
1453
1457
|
const CtrlCmd = 1 << 11 >>> 0;
|
|
1458
|
+
const KeyModifier = {
|
|
1459
|
+
__proto__: null,
|
|
1460
|
+
CtrlCmd};
|
|
1461
|
+
const mergeClassNames = (...classNames) => {
|
|
1462
|
+
return classNames.filter(Boolean).join(' ');
|
|
1463
|
+
};
|
|
1464
|
+
const px = value => {
|
|
1465
|
+
return `${value}px`;
|
|
1466
|
+
};
|
|
1467
|
+
const position = (x, y) => {
|
|
1468
|
+
return `${x}px ${y}px`;
|
|
1469
|
+
};
|
|
1470
|
+
const Text = 12;
|
|
1471
|
+
const text = data => {
|
|
1472
|
+
return {
|
|
1473
|
+
type: Text,
|
|
1474
|
+
text: data,
|
|
1475
|
+
childCount: 0
|
|
1476
|
+
};
|
|
1477
|
+
};
|
|
1454
1478
|
|
|
1455
1479
|
const getCommand = shortId => {
|
|
1456
1480
|
return {
|
|
@@ -1460,31 +1484,31 @@ const getCommand = shortId => {
|
|
|
1460
1484
|
};
|
|
1461
1485
|
const getKeyBindings = () => {
|
|
1462
1486
|
return [{
|
|
1463
|
-
key: DownArrow,
|
|
1487
|
+
key: KeyCode.DownArrow,
|
|
1464
1488
|
...getCommand('focusNext'),
|
|
1465
1489
|
when: FocusEditorCompletions
|
|
1466
1490
|
}, {
|
|
1467
|
-
key: UpArrow,
|
|
1491
|
+
key: KeyCode.UpArrow,
|
|
1468
1492
|
...getCommand('focusPrevious'),
|
|
1469
1493
|
when: FocusEditorCompletions
|
|
1470
1494
|
}, {
|
|
1471
|
-
key: Enter,
|
|
1495
|
+
key: KeyCode.Enter,
|
|
1472
1496
|
...getCommand('selectCurrent'),
|
|
1473
1497
|
when: FocusEditorCompletions
|
|
1474
1498
|
}, {
|
|
1475
|
-
key: End,
|
|
1499
|
+
key: KeyCode.End,
|
|
1476
1500
|
...getCommand('focusLast'),
|
|
1477
1501
|
when: FocusEditorCompletions
|
|
1478
1502
|
}, {
|
|
1479
|
-
key: Home,
|
|
1503
|
+
key: KeyCode.Home,
|
|
1480
1504
|
...getCommand('focusFirst'),
|
|
1481
1505
|
when: FocusEditorCompletions
|
|
1482
1506
|
}, {
|
|
1483
|
-
key: CtrlCmd | Space
|
|
1507
|
+
key: KeyModifier.CtrlCmd | KeyCode.Space,
|
|
1484
1508
|
...getCommand('toggleDetails'),
|
|
1485
1509
|
when: FocusEditorCompletions
|
|
1486
1510
|
}, {
|
|
1487
|
-
key: Escape,
|
|
1511
|
+
key: KeyCode.Escape,
|
|
1488
1512
|
...getCommand('close'),
|
|
1489
1513
|
when: FocusEditorCompletions
|
|
1490
1514
|
}];
|
|
@@ -2066,24 +2090,6 @@ const getIconDom = (fileIcon, symbolName) => {
|
|
|
2066
2090
|
};
|
|
2067
2091
|
};
|
|
2068
2092
|
|
|
2069
|
-
const mergeClassNames = (...classNames) => {
|
|
2070
|
-
return classNames.filter(Boolean).join(' ');
|
|
2071
|
-
};
|
|
2072
|
-
const Text = 12;
|
|
2073
|
-
const text = data => {
|
|
2074
|
-
return {
|
|
2075
|
-
type: Text,
|
|
2076
|
-
text: data,
|
|
2077
|
-
childCount: 0
|
|
2078
|
-
};
|
|
2079
|
-
};
|
|
2080
|
-
const px = value => {
|
|
2081
|
-
return `${value}px`;
|
|
2082
|
-
};
|
|
2083
|
-
const position = (x, y) => {
|
|
2084
|
-
return `${x}px ${y}px`;
|
|
2085
|
-
};
|
|
2086
|
-
|
|
2087
2093
|
const label1 = {
|
|
2088
2094
|
type: Div,
|
|
2089
2095
|
className: Label,
|