@lvce-editor/output-view 1.12.0 → 1.13.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/outputViewWorkerMain.js +117 -26
- package/package.json +1 -1
|
@@ -879,7 +879,7 @@ const send = (transport, method, ...params) => {
|
|
|
879
879
|
const message = create$4$1(method, params);
|
|
880
880
|
transport.send(message);
|
|
881
881
|
};
|
|
882
|
-
const invoke$
|
|
882
|
+
const invoke$2 = (ipc, method, ...params) => {
|
|
883
883
|
return invokeHelper(ipc, method, params, false);
|
|
884
884
|
};
|
|
885
885
|
const invokeAndTransfer = (ipc, method, ...params) => {
|
|
@@ -918,7 +918,7 @@ const createRpc = ipc => {
|
|
|
918
918
|
send(ipc, method, ...params);
|
|
919
919
|
},
|
|
920
920
|
invoke(method, ...params) {
|
|
921
|
-
return invoke$
|
|
921
|
+
return invoke$2(ipc, method, ...params);
|
|
922
922
|
},
|
|
923
923
|
invokeAndTransfer(method, ...params) {
|
|
924
924
|
return invokeAndTransfer(ipc, method, ...params);
|
|
@@ -1333,9 +1333,59 @@ const create = rpcId => {
|
|
|
1333
1333
|
}
|
|
1334
1334
|
};
|
|
1335
1335
|
};
|
|
1336
|
+
const DebugWorker$1 = 55;
|
|
1337
|
+
const EditorWorker$1 = 99;
|
|
1336
1338
|
const ExtensionHostWorker = 44;
|
|
1339
|
+
const MainProcess$1 = -5;
|
|
1337
1340
|
const RendererWorker$1 = 1;
|
|
1341
|
+
const RendererProcess$1 = 1670;
|
|
1342
|
+
const SearchProcess$1 = 77;
|
|
1343
|
+
const SearchProcessElectron = 2;
|
|
1344
|
+
const SharedProcess$1 = 1;
|
|
1345
|
+
const SourceControlWorker = 66;
|
|
1346
|
+
const EmbedsProcess$1 = 207;
|
|
1347
|
+
const EmbedsWorker = 208;
|
|
1338
1348
|
const FileSystemWorker$1 = 209;
|
|
1349
|
+
const FileSystemProcess$1 = 210;
|
|
1350
|
+
const MarkdownWorker$1 = 300;
|
|
1351
|
+
const CompletionWorker = 301;
|
|
1352
|
+
const ColorPickerWorker = 302;
|
|
1353
|
+
const SourceActionWorker = 303;
|
|
1354
|
+
const ErrorWorker$1 = 3308;
|
|
1355
|
+
const SyntaxHighlightingWorker$1 = 3309;
|
|
1356
|
+
const ClipBoardWorker$1 = 3400;
|
|
1357
|
+
const ClipBoardProcess$1 = 3401;
|
|
1358
|
+
const ExtensionDetailWorker = 3402;
|
|
1359
|
+
const ProblemsWorker = 3403;
|
|
1360
|
+
const OutputWorker = 7001;
|
|
1361
|
+
const RpcId = {
|
|
1362
|
+
__proto__: null,
|
|
1363
|
+
ClipBoardProcess: ClipBoardProcess$1,
|
|
1364
|
+
ClipBoardWorker: ClipBoardWorker$1,
|
|
1365
|
+
ColorPickerWorker,
|
|
1366
|
+
CompletionWorker,
|
|
1367
|
+
DebugWorker: DebugWorker$1,
|
|
1368
|
+
EditorWorker: EditorWorker$1,
|
|
1369
|
+
EmbedsProcess: EmbedsProcess$1,
|
|
1370
|
+
EmbedsWorker,
|
|
1371
|
+
ErrorWorker: ErrorWorker$1,
|
|
1372
|
+
ExtensionDetailWorker,
|
|
1373
|
+
ExtensionHostWorker,
|
|
1374
|
+
FileSystemProcess: FileSystemProcess$1,
|
|
1375
|
+
FileSystemWorker: FileSystemWorker$1,
|
|
1376
|
+
MainProcess: MainProcess$1,
|
|
1377
|
+
MarkdownWorker: MarkdownWorker$1,
|
|
1378
|
+
OutputWorker,
|
|
1379
|
+
ProblemsWorker,
|
|
1380
|
+
RendererProcess: RendererProcess$1,
|
|
1381
|
+
RendererWorker: RendererWorker$1,
|
|
1382
|
+
SearchProcess: SearchProcess$1,
|
|
1383
|
+
SearchProcessElectron,
|
|
1384
|
+
SharedProcess: SharedProcess$1,
|
|
1385
|
+
SourceActionWorker,
|
|
1386
|
+
SourceControlWorker,
|
|
1387
|
+
SyntaxHighlightingWorker: SyntaxHighlightingWorker$1
|
|
1388
|
+
};
|
|
1339
1389
|
const {
|
|
1340
1390
|
invoke: invoke$9,
|
|
1341
1391
|
set: set$9} = create(ExtensionHostWorker);
|
|
@@ -1441,6 +1491,7 @@ const activateByEvent$1 = event => {
|
|
|
1441
1491
|
const RendererWorker = {
|
|
1442
1492
|
__proto__: null,
|
|
1443
1493
|
activateByEvent: activateByEvent$1,
|
|
1494
|
+
invoke: invoke$3,
|
|
1444
1495
|
sendMessagePortToExtensionHostWorker: sendMessagePortToExtensionHostWorker$1,
|
|
1445
1496
|
sendMessagePortToFileSystemWorker: sendMessagePortToFileSystemWorker$2,
|
|
1446
1497
|
set: set$3};
|
|
@@ -1565,25 +1616,42 @@ const handleFilterInput = async (state, value) => {
|
|
|
1565
1616
|
};
|
|
1566
1617
|
};
|
|
1567
1618
|
|
|
1619
|
+
const createWatchId = () => {
|
|
1620
|
+
const watchId = Math.random();
|
|
1621
|
+
return watchId;
|
|
1622
|
+
};
|
|
1623
|
+
|
|
1624
|
+
const {
|
|
1625
|
+
invoke: invoke$1,
|
|
1626
|
+
sendMessagePortToExtensionHostWorker,
|
|
1627
|
+
sendMessagePortToFileSystemWorker: sendMessagePortToFileSystemWorker$1,
|
|
1628
|
+
set: set$1,
|
|
1629
|
+
activateByEvent
|
|
1630
|
+
} = RendererWorker;
|
|
1631
|
+
|
|
1632
|
+
const handleFileChange = async watchId => {
|
|
1633
|
+
const keys = getKeys();
|
|
1634
|
+
for (const key of keys) {
|
|
1635
|
+
const instance = get$1(key);
|
|
1636
|
+
if (instance.newState.watchId === watchId) {
|
|
1637
|
+
// @ts-ignore
|
|
1638
|
+
await invoke$1('Output.refresh');
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
};
|
|
1642
|
+
|
|
1568
1643
|
const watchCallbacks = Object.create(null);
|
|
1569
1644
|
const registerWatchCallback = (id, fn) => {
|
|
1570
1645
|
watchCallbacks[id] = fn;
|
|
1571
1646
|
};
|
|
1572
1647
|
const executeWatchCallBack = id => {
|
|
1573
|
-
watchCallbacks[id]();
|
|
1648
|
+
watchCallbacks[id](id);
|
|
1574
1649
|
};
|
|
1575
1650
|
|
|
1576
|
-
const
|
|
1577
|
-
// console.log('channel changed', watchId)
|
|
1578
|
-
const keys = getKeys();
|
|
1579
|
-
for (const key of keys) {
|
|
1580
|
-
}
|
|
1581
|
-
};
|
|
1582
|
-
const setupChangeListener = async uri => {
|
|
1651
|
+
const setupChangeListener = async (watchId, uri) => {
|
|
1583
1652
|
try {
|
|
1584
|
-
const
|
|
1585
|
-
|
|
1586
|
-
registerWatchCallback(watchId, handleChange);
|
|
1653
|
+
const rpcId = RpcId.OutputWorker;
|
|
1654
|
+
registerWatchCallback(watchId, handleFileChange);
|
|
1587
1655
|
// @ts-ignore
|
|
1588
1656
|
await FileSystemWorker.invoke(/* OutputChannel.open */'FileSystem.watchFile', watchId, /* path */uri, rpcId);
|
|
1589
1657
|
} catch {
|
|
@@ -1608,7 +1676,8 @@ const selectChannel = async (state, id) => {
|
|
|
1608
1676
|
} = await loadLines(matchingOption.uri);
|
|
1609
1677
|
|
|
1610
1678
|
// TODO memory leak and race condition, need to dispose file watcher of previous uri
|
|
1611
|
-
|
|
1679
|
+
const watchId = createWatchId();
|
|
1680
|
+
await setupChangeListener(watchId, matchingOption.uri);
|
|
1612
1681
|
const filteredItems = filterItems(lines, filterValue);
|
|
1613
1682
|
return {
|
|
1614
1683
|
...state,
|
|
@@ -1616,7 +1685,8 @@ const selectChannel = async (state, id) => {
|
|
|
1616
1685
|
errorCode: code,
|
|
1617
1686
|
listItems: lines,
|
|
1618
1687
|
filteredItems,
|
|
1619
|
-
selectedOption: id
|
|
1688
|
+
selectedOption: id,
|
|
1689
|
+
watchId
|
|
1620
1690
|
};
|
|
1621
1691
|
};
|
|
1622
1692
|
|
|
@@ -1624,13 +1694,6 @@ const handleSelect = async (state, id) => {
|
|
|
1624
1694
|
return selectChannel(state, id);
|
|
1625
1695
|
};
|
|
1626
1696
|
|
|
1627
|
-
const {
|
|
1628
|
-
sendMessagePortToExtensionHostWorker,
|
|
1629
|
-
sendMessagePortToFileSystemWorker: sendMessagePortToFileSystemWorker$1,
|
|
1630
|
-
set: set$1,
|
|
1631
|
-
activateByEvent
|
|
1632
|
-
} = RendererWorker;
|
|
1633
|
-
|
|
1634
1697
|
const sendMessagePortToExtensionHostWorker2 = async port => {
|
|
1635
1698
|
await sendMessagePortToExtensionHostWorker(port);
|
|
1636
1699
|
};
|
|
@@ -1657,7 +1720,7 @@ const initializeExtensionHost = async () => {
|
|
|
1657
1720
|
};
|
|
1658
1721
|
|
|
1659
1722
|
const sendMessagePortToFileSystemWorker = async port => {
|
|
1660
|
-
await sendMessagePortToFileSystemWorker$1(port,
|
|
1723
|
+
await sendMessagePortToFileSystemWorker$1(port, RpcId.OutputWorker);
|
|
1661
1724
|
};
|
|
1662
1725
|
|
|
1663
1726
|
const createFileSystemWorkerRpc = async () => {
|
|
@@ -1772,7 +1835,8 @@ const loadContent = async (state, savedState) => {
|
|
|
1772
1835
|
error,
|
|
1773
1836
|
code
|
|
1774
1837
|
} = await loadLines(uri);
|
|
1775
|
-
|
|
1838
|
+
const watchId = createWatchId();
|
|
1839
|
+
await setupChangeListener(watchId, uri);
|
|
1776
1840
|
const buttons = loadButtons();
|
|
1777
1841
|
return {
|
|
1778
1842
|
...state,
|
|
@@ -1784,7 +1848,8 @@ const loadContent = async (state, savedState) => {
|
|
|
1784
1848
|
filteredItems: lines,
|
|
1785
1849
|
options,
|
|
1786
1850
|
selectedOption: selectedId,
|
|
1787
|
-
buttons
|
|
1851
|
+
buttons,
|
|
1852
|
+
watchId
|
|
1788
1853
|
};
|
|
1789
1854
|
};
|
|
1790
1855
|
|
|
@@ -1864,6 +1929,31 @@ const getActions = state => {
|
|
|
1864
1929
|
}];
|
|
1865
1930
|
};
|
|
1866
1931
|
|
|
1932
|
+
const refresh = async state => {
|
|
1933
|
+
const {
|
|
1934
|
+
filterValue,
|
|
1935
|
+
options,
|
|
1936
|
+
selectedOption
|
|
1937
|
+
} = state;
|
|
1938
|
+
const matchingOption = options.find(option => option.id === selectedOption);
|
|
1939
|
+
if (!matchingOption) {
|
|
1940
|
+
return state;
|
|
1941
|
+
}
|
|
1942
|
+
const {
|
|
1943
|
+
lines,
|
|
1944
|
+
error,
|
|
1945
|
+
code
|
|
1946
|
+
} = await loadLines(matchingOption.uri);
|
|
1947
|
+
const filteredItems = filterItems(lines, filterValue);
|
|
1948
|
+
return {
|
|
1949
|
+
...state,
|
|
1950
|
+
listItems: lines,
|
|
1951
|
+
filteredItems,
|
|
1952
|
+
error,
|
|
1953
|
+
errorCode: code
|
|
1954
|
+
};
|
|
1955
|
+
};
|
|
1956
|
+
|
|
1867
1957
|
const renderFilterValue = (oldState, newState) => {
|
|
1868
1958
|
return ['Viewlet.setValueByName', Filter, newState.filterValue];
|
|
1869
1959
|
};
|
|
@@ -2144,7 +2234,8 @@ const commandMap = {
|
|
|
2144
2234
|
'Output.resize': resize,
|
|
2145
2235
|
'Output.saveState': saveState,
|
|
2146
2236
|
'Output.setOutputChannel': wrapCommand(setOutputChannel),
|
|
2147
|
-
'Output.terminate': terminate
|
|
2237
|
+
'Output.terminate': terminate,
|
|
2238
|
+
'Output.refresh': wrapCommand(refresh)
|
|
2148
2239
|
};
|
|
2149
2240
|
|
|
2150
2241
|
const listen = async () => {
|