@lvce-editor/output-view 1.11.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 +138 -38
- 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);
|
|
@@ -1106,7 +1106,8 @@ const {
|
|
|
1106
1106
|
get: get$1,
|
|
1107
1107
|
set: set$4,
|
|
1108
1108
|
wrapCommand,
|
|
1109
|
-
wrapGetter
|
|
1109
|
+
wrapGetter,
|
|
1110
|
+
getKeys
|
|
1110
1111
|
} = create$2();
|
|
1111
1112
|
|
|
1112
1113
|
const create$1 = (id, uri, x, y, width, height, platform, parentId) => {
|
|
@@ -1136,7 +1137,8 @@ const create$1 = (id, uri, x, y, width, height, platform, parentId) => {
|
|
|
1136
1137
|
errorCode: 0,
|
|
1137
1138
|
buttons: [],
|
|
1138
1139
|
filteredItems: [],
|
|
1139
|
-
platform
|
|
1140
|
+
platform,
|
|
1141
|
+
watchId: 0
|
|
1140
1142
|
};
|
|
1141
1143
|
set$4(id, state, state);
|
|
1142
1144
|
};
|
|
@@ -1331,9 +1333,59 @@ const create = rpcId => {
|
|
|
1331
1333
|
}
|
|
1332
1334
|
};
|
|
1333
1335
|
};
|
|
1336
|
+
const DebugWorker$1 = 55;
|
|
1337
|
+
const EditorWorker$1 = 99;
|
|
1334
1338
|
const ExtensionHostWorker = 44;
|
|
1339
|
+
const MainProcess$1 = -5;
|
|
1335
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;
|
|
1336
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
|
+
};
|
|
1337
1389
|
const {
|
|
1338
1390
|
invoke: invoke$9,
|
|
1339
1391
|
set: set$9} = create(ExtensionHostWorker);
|
|
@@ -1439,6 +1491,7 @@ const activateByEvent$1 = event => {
|
|
|
1439
1491
|
const RendererWorker = {
|
|
1440
1492
|
__proto__: null,
|
|
1441
1493
|
activateByEvent: activateByEvent$1,
|
|
1494
|
+
invoke: invoke$3,
|
|
1442
1495
|
sendMessagePortToExtensionHostWorker: sendMessagePortToExtensionHostWorker$1,
|
|
1443
1496
|
sendMessagePortToFileSystemWorker: sendMessagePortToFileSystemWorker$2,
|
|
1444
1497
|
set: set$3};
|
|
@@ -1563,6 +1616,49 @@ const handleFilterInput = async (state, value) => {
|
|
|
1563
1616
|
};
|
|
1564
1617
|
};
|
|
1565
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
|
+
|
|
1643
|
+
const watchCallbacks = Object.create(null);
|
|
1644
|
+
const registerWatchCallback = (id, fn) => {
|
|
1645
|
+
watchCallbacks[id] = fn;
|
|
1646
|
+
};
|
|
1647
|
+
const executeWatchCallBack = id => {
|
|
1648
|
+
watchCallbacks[id](id);
|
|
1649
|
+
};
|
|
1650
|
+
|
|
1651
|
+
const setupChangeListener = async (watchId, uri) => {
|
|
1652
|
+
try {
|
|
1653
|
+
const rpcId = RpcId.OutputWorker;
|
|
1654
|
+
registerWatchCallback(watchId, handleFileChange);
|
|
1655
|
+
// @ts-ignore
|
|
1656
|
+
await FileSystemWorker.invoke(/* OutputChannel.open */'FileSystem.watchFile', watchId, /* path */uri, rpcId);
|
|
1657
|
+
} catch {
|
|
1658
|
+
// ignore
|
|
1659
|
+
}
|
|
1660
|
+
};
|
|
1661
|
+
|
|
1566
1662
|
const selectChannel = async (state, id) => {
|
|
1567
1663
|
const {
|
|
1568
1664
|
options,
|
|
@@ -1578,6 +1674,10 @@ const selectChannel = async (state, id) => {
|
|
|
1578
1674
|
error,
|
|
1579
1675
|
code
|
|
1580
1676
|
} = await loadLines(matchingOption.uri);
|
|
1677
|
+
|
|
1678
|
+
// TODO memory leak and race condition, need to dispose file watcher of previous uri
|
|
1679
|
+
const watchId = createWatchId();
|
|
1680
|
+
await setupChangeListener(watchId, matchingOption.uri);
|
|
1581
1681
|
const filteredItems = filterItems(lines, filterValue);
|
|
1582
1682
|
return {
|
|
1583
1683
|
...state,
|
|
@@ -1585,7 +1685,8 @@ const selectChannel = async (state, id) => {
|
|
|
1585
1685
|
errorCode: code,
|
|
1586
1686
|
listItems: lines,
|
|
1587
1687
|
filteredItems,
|
|
1588
|
-
selectedOption: id
|
|
1688
|
+
selectedOption: id,
|
|
1689
|
+
watchId
|
|
1589
1690
|
};
|
|
1590
1691
|
};
|
|
1591
1692
|
|
|
@@ -1593,13 +1694,6 @@ const handleSelect = async (state, id) => {
|
|
|
1593
1694
|
return selectChannel(state, id);
|
|
1594
1695
|
};
|
|
1595
1696
|
|
|
1596
|
-
const {
|
|
1597
|
-
sendMessagePortToExtensionHostWorker,
|
|
1598
|
-
sendMessagePortToFileSystemWorker: sendMessagePortToFileSystemWorker$1,
|
|
1599
|
-
set: set$1,
|
|
1600
|
-
activateByEvent
|
|
1601
|
-
} = RendererWorker;
|
|
1602
|
-
|
|
1603
1697
|
const sendMessagePortToExtensionHostWorker2 = async port => {
|
|
1604
1698
|
await sendMessagePortToExtensionHostWorker(port);
|
|
1605
1699
|
};
|
|
@@ -1626,7 +1720,7 @@ const initializeExtensionHost = async () => {
|
|
|
1626
1720
|
};
|
|
1627
1721
|
|
|
1628
1722
|
const sendMessagePortToFileSystemWorker = async port => {
|
|
1629
|
-
await sendMessagePortToFileSystemWorker$1(port,
|
|
1723
|
+
await sendMessagePortToFileSystemWorker$1(port, RpcId.OutputWorker);
|
|
1630
1724
|
};
|
|
1631
1725
|
|
|
1632
1726
|
const createFileSystemWorkerRpc = async () => {
|
|
@@ -1710,28 +1804,6 @@ const loadOptions = async platform => {
|
|
|
1710
1804
|
}, ...extensionOptions];
|
|
1711
1805
|
};
|
|
1712
1806
|
|
|
1713
|
-
const watchCallbacks = Object.create(null);
|
|
1714
|
-
const registerWatchCallback = (id, fn) => {
|
|
1715
|
-
watchCallbacks[id] = fn;
|
|
1716
|
-
};
|
|
1717
|
-
const executeWatchCallBack = id => {
|
|
1718
|
-
watchCallbacks[id]();
|
|
1719
|
-
};
|
|
1720
|
-
|
|
1721
|
-
const setupChangeListener = async uri => {
|
|
1722
|
-
try {
|
|
1723
|
-
const watchId = Math.random();
|
|
1724
|
-
registerWatchCallback(watchId, () => {
|
|
1725
|
-
// TODO
|
|
1726
|
-
// console.log('channel changed')
|
|
1727
|
-
});
|
|
1728
|
-
// @ts-ignore
|
|
1729
|
-
await FileSystemWorker.invoke(/* OutputChannel.open */'FileSystem.watchFile', watchId, /* path */uri);
|
|
1730
|
-
} catch {
|
|
1731
|
-
// ignore
|
|
1732
|
-
}
|
|
1733
|
-
};
|
|
1734
|
-
|
|
1735
1807
|
const isString = value => {
|
|
1736
1808
|
return typeof value === 'string';
|
|
1737
1809
|
};
|
|
@@ -1763,7 +1835,8 @@ const loadContent = async (state, savedState) => {
|
|
|
1763
1835
|
error,
|
|
1764
1836
|
code
|
|
1765
1837
|
} = await loadLines(uri);
|
|
1766
|
-
|
|
1838
|
+
const watchId = createWatchId();
|
|
1839
|
+
await setupChangeListener(watchId, uri);
|
|
1767
1840
|
const buttons = loadButtons();
|
|
1768
1841
|
return {
|
|
1769
1842
|
...state,
|
|
@@ -1775,7 +1848,8 @@ const loadContent = async (state, savedState) => {
|
|
|
1775
1848
|
filteredItems: lines,
|
|
1776
1849
|
options,
|
|
1777
1850
|
selectedOption: selectedId,
|
|
1778
|
-
buttons
|
|
1851
|
+
buttons,
|
|
1852
|
+
watchId
|
|
1779
1853
|
};
|
|
1780
1854
|
};
|
|
1781
1855
|
|
|
@@ -1855,6 +1929,31 @@ const getActions = state => {
|
|
|
1855
1929
|
}];
|
|
1856
1930
|
};
|
|
1857
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
|
+
|
|
1858
1957
|
const renderFilterValue = (oldState, newState) => {
|
|
1859
1958
|
return ['Viewlet.setValueByName', Filter, newState.filterValue];
|
|
1860
1959
|
};
|
|
@@ -2135,7 +2234,8 @@ const commandMap = {
|
|
|
2135
2234
|
'Output.resize': resize,
|
|
2136
2235
|
'Output.saveState': saveState,
|
|
2137
2236
|
'Output.setOutputChannel': wrapCommand(setOutputChannel),
|
|
2138
|
-
'Output.terminate': terminate
|
|
2237
|
+
'Output.terminate': terminate,
|
|
2238
|
+
'Output.refresh': wrapCommand(refresh)
|
|
2139
2239
|
};
|
|
2140
2240
|
|
|
2141
2241
|
const listen = async () => {
|