@lvce-editor/problems-view 1.29.1 → 1.31.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/problemsViewWorkerMain.js +140 -70
- package/package.json +1 -1
|
@@ -1390,7 +1390,7 @@ const createMockRpc = ({
|
|
|
1390
1390
|
};
|
|
1391
1391
|
|
|
1392
1392
|
const rpcs = Object.create(null);
|
|
1393
|
-
const set$
|
|
1393
|
+
const set$6 = (id, rpc) => {
|
|
1394
1394
|
rpcs[id] = rpc;
|
|
1395
1395
|
};
|
|
1396
1396
|
const get$1 = id => {
|
|
@@ -1423,7 +1423,7 @@ const create$1 = rpcId => {
|
|
|
1423
1423
|
const mockRpc = createMockRpc({
|
|
1424
1424
|
commandMap
|
|
1425
1425
|
});
|
|
1426
|
-
set$
|
|
1426
|
+
set$6(rpcId, mockRpc);
|
|
1427
1427
|
// @ts-ignore
|
|
1428
1428
|
mockRpc[Symbol.dispose] = () => {
|
|
1429
1429
|
remove(rpcId);
|
|
@@ -1432,7 +1432,7 @@ const create$1 = rpcId => {
|
|
|
1432
1432
|
return mockRpc;
|
|
1433
1433
|
},
|
|
1434
1434
|
set(rpc) {
|
|
1435
|
-
set$
|
|
1435
|
+
set$6(rpcId, rpc);
|
|
1436
1436
|
}
|
|
1437
1437
|
};
|
|
1438
1438
|
};
|
|
@@ -1633,61 +1633,68 @@ const Checked = 2;
|
|
|
1633
1633
|
const Unchecked = 3;
|
|
1634
1634
|
|
|
1635
1635
|
const EditorWorker$1 = 99;
|
|
1636
|
+
const RendererProcess = 1670;
|
|
1636
1637
|
const RendererWorker = 1;
|
|
1637
1638
|
|
|
1638
1639
|
const SetCss = 'Viewlet.setCss';
|
|
1640
|
+
const SetFocusContext = 'Viewlet.setFocusContext';
|
|
1639
1641
|
|
|
1640
1642
|
const {
|
|
1641
|
-
invoke: invoke$
|
|
1642
|
-
set: set$
|
|
1643
|
+
invoke: invoke$3,
|
|
1644
|
+
set: set$5
|
|
1643
1645
|
} = create$1(EditorWorker$1);
|
|
1644
1646
|
const getUri$1 = async editorUid => {
|
|
1645
1647
|
// @ts-ignore
|
|
1646
|
-
return invoke$
|
|
1648
|
+
return invoke$3('Editor.getUri', editorUid);
|
|
1647
1649
|
};
|
|
1648
1650
|
const getProblems$2 = async () => {
|
|
1649
1651
|
// @ts-ignore
|
|
1650
|
-
return invoke$
|
|
1652
|
+
return invoke$3('Editor.getProblems');
|
|
1651
1653
|
};
|
|
1652
1654
|
|
|
1653
1655
|
const EditorWorker = {
|
|
1654
1656
|
__proto__: null,
|
|
1655
1657
|
getProblems: getProblems$2,
|
|
1656
1658
|
getUri: getUri$1,
|
|
1657
|
-
invoke: invoke$
|
|
1658
|
-
set: set$
|
|
1659
|
+
invoke: invoke$3,
|
|
1660
|
+
set: set$5
|
|
1659
1661
|
};
|
|
1660
1662
|
|
|
1661
1663
|
const {
|
|
1662
|
-
invoke,
|
|
1664
|
+
invoke: invoke$2,
|
|
1665
|
+
set: set$4
|
|
1666
|
+
} = create$1(RendererProcess);
|
|
1667
|
+
|
|
1668
|
+
const {
|
|
1669
|
+
invoke: invoke$1,
|
|
1663
1670
|
invokeAndTransfer,
|
|
1664
|
-
set: set$
|
|
1671
|
+
set: set$3
|
|
1665
1672
|
} = create$1(RendererWorker);
|
|
1666
1673
|
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1667
1674
|
number(uid);
|
|
1668
1675
|
number(menuId);
|
|
1669
1676
|
number(x);
|
|
1670
1677
|
number(y);
|
|
1671
|
-
await invoke('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1678
|
+
await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1672
1679
|
};
|
|
1673
1680
|
const sendMessagePortToEditorWorker$1 = async (port, rpcId) => {
|
|
1674
1681
|
const command = 'HandleMessagePort.handleMessagePort';
|
|
1675
1682
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
|
|
1676
1683
|
};
|
|
1677
1684
|
const getFileIcon = async options => {
|
|
1678
|
-
return invoke('IconTheme.getFileIcon', options);
|
|
1685
|
+
return invoke$1('IconTheme.getFileIcon', options);
|
|
1679
1686
|
};
|
|
1680
1687
|
const writeClipBoardText$1 = async text => {
|
|
1681
|
-
await invoke('ClipBoard.writeText', /* text */text);
|
|
1688
|
+
await invoke$1('ClipBoard.writeText', /* text */text);
|
|
1682
1689
|
};
|
|
1683
1690
|
const getActiveEditorId$1 = () => {
|
|
1684
|
-
return invoke('GetActiveEditor.getActiveEditorId');
|
|
1691
|
+
return invoke$1('GetActiveEditor.getActiveEditorId');
|
|
1685
1692
|
};
|
|
1686
1693
|
const getWorkspacePath$1 = () => {
|
|
1687
|
-
return invoke('Workspace.getPath');
|
|
1694
|
+
return invoke$1('Workspace.getPath');
|
|
1688
1695
|
};
|
|
1689
1696
|
const openUri$1 = async (uri, focus, options) => {
|
|
1690
|
-
await invoke('Main.openUri', {
|
|
1697
|
+
await invoke$1('Main.openUri', {
|
|
1691
1698
|
...options,
|
|
1692
1699
|
focus,
|
|
1693
1700
|
uri
|
|
@@ -1698,19 +1705,19 @@ const getActiveEditorId = () => {
|
|
|
1698
1705
|
return getActiveEditorId$1();
|
|
1699
1706
|
};
|
|
1700
1707
|
const focusEditor = async () => {
|
|
1701
|
-
await invoke('Main.focus');
|
|
1708
|
+
await invoke$1('Main.focus');
|
|
1702
1709
|
};
|
|
1703
1710
|
const openUri = (uri, focus) => {
|
|
1704
1711
|
return openUri$1(uri, focus);
|
|
1705
1712
|
};
|
|
1706
1713
|
const setEditorCursor = async (rowIndex, columnIndex) => {
|
|
1707
|
-
await invoke('Editor.cursorSet', rowIndex, columnIndex);
|
|
1714
|
+
await invoke$1('Editor.cursorSet', rowIndex, columnIndex);
|
|
1708
1715
|
};
|
|
1709
1716
|
const sendMessagePortToEditorWorker = (port, rpcId) => {
|
|
1710
1717
|
return sendMessagePortToEditorWorker$1(port, rpcId);
|
|
1711
1718
|
};
|
|
1712
|
-
const set$
|
|
1713
|
-
set$
|
|
1719
|
+
const set$2 = rpc => {
|
|
1720
|
+
set$3(rpc);
|
|
1714
1721
|
};
|
|
1715
1722
|
const writeClipBoardText = text => {
|
|
1716
1723
|
return writeClipBoardText$1(text);
|
|
@@ -1737,7 +1744,7 @@ const {
|
|
|
1737
1744
|
get,
|
|
1738
1745
|
getCommandIds,
|
|
1739
1746
|
registerCommands,
|
|
1740
|
-
set,
|
|
1747
|
+
set: set$1,
|
|
1741
1748
|
wrapCommand,
|
|
1742
1749
|
wrapGetter
|
|
1743
1750
|
} = create$a();
|
|
@@ -1779,7 +1786,7 @@ const create = (id, uri, x, y, width, height, workspaceUri) => {
|
|
|
1779
1786
|
x,
|
|
1780
1787
|
y
|
|
1781
1788
|
};
|
|
1782
|
-
set(id, state, state);
|
|
1789
|
+
set$1(id, state, state);
|
|
1783
1790
|
};
|
|
1784
1791
|
|
|
1785
1792
|
const isEqual$2 = (oldState, newState) => {
|
|
@@ -1970,7 +1977,7 @@ const diff2 = uid => {
|
|
|
1970
1977
|
oldState
|
|
1971
1978
|
} = get(uid);
|
|
1972
1979
|
const updatedState = updateVirtualList(newState);
|
|
1973
|
-
set(uid, oldState, updatedState);
|
|
1980
|
+
set$1(uid, oldState, updatedState);
|
|
1974
1981
|
const diffResult = diff(oldState, updatedState);
|
|
1975
1982
|
return diffResult;
|
|
1976
1983
|
};
|
|
@@ -2177,51 +2184,12 @@ const getMenuIds = () => {
|
|
|
2177
2184
|
return [ProblemsFilter$1];
|
|
2178
2185
|
};
|
|
2179
2186
|
|
|
2180
|
-
const getMissingRequests = (problems, fileIconCache) => {
|
|
2181
|
-
const missingRequests = [];
|
|
2182
|
-
const pendingUris = new Set();
|
|
2183
|
-
for (const problem of problems) {
|
|
2184
|
-
const {
|
|
2185
|
-
fileName,
|
|
2186
|
-
uri
|
|
2187
|
-
} = problem;
|
|
2188
|
-
if (!uri || uri in fileIconCache || pendingUris.has(uri)) {
|
|
2189
|
-
continue;
|
|
2190
|
-
}
|
|
2191
|
-
pendingUris.add(uri);
|
|
2192
|
-
missingRequests.push({
|
|
2193
|
-
name: fileName,
|
|
2194
|
-
uri
|
|
2195
|
-
});
|
|
2196
|
-
}
|
|
2197
|
-
return missingRequests;
|
|
2198
|
-
};
|
|
2199
|
-
const requestFileIcon = name => {
|
|
2200
|
-
if (!name) {
|
|
2201
|
-
return Promise.resolve('');
|
|
2202
|
-
}
|
|
2203
|
-
return getFileIcon({
|
|
2204
|
-
name
|
|
2205
|
-
});
|
|
2206
|
-
};
|
|
2207
|
-
const getFileIcons = async (problems, fileIconCache) => {
|
|
2208
|
-
const missingRequests = getMissingRequests(problems, fileIconCache);
|
|
2209
|
-
if (missingRequests.length === 0) {
|
|
2210
|
-
return fileIconCache;
|
|
2211
|
-
}
|
|
2212
|
-
const icons = await Promise.all(missingRequests.map(request => requestFileIcon(request.name)));
|
|
2213
|
-
const newFileIconCache = {
|
|
2214
|
-
...fileIconCache
|
|
2215
|
-
};
|
|
2216
|
-
for (let i = 0; i < missingRequests.length; i++) {
|
|
2217
|
-
newFileIconCache[missingRequests[i].uri] = icons[i];
|
|
2218
|
-
}
|
|
2219
|
-
return newFileIconCache;
|
|
2220
|
-
};
|
|
2221
|
-
|
|
2222
2187
|
const {
|
|
2223
2188
|
getProblems: getProblems$1,
|
|
2224
2189
|
getUri} = EditorWorker;
|
|
2190
|
+
const getDiagnostics = editorId => {
|
|
2191
|
+
return invoke$3('Editor.getDiagnostics', editorId);
|
|
2192
|
+
};
|
|
2225
2193
|
|
|
2226
2194
|
const leadingSlashesRegex = /^\/+/;
|
|
2227
2195
|
const trailingSlashRegex = /\/$/;
|
|
@@ -2364,6 +2332,72 @@ const getProblems = async (workspaceUri, activeUri) => {
|
|
|
2364
2332
|
}
|
|
2365
2333
|
};
|
|
2366
2334
|
|
|
2335
|
+
const countByType = (diagnostics, type) => {
|
|
2336
|
+
return diagnostics.filter(diagnostic => diagnostic.type === type).length;
|
|
2337
|
+
};
|
|
2338
|
+
const getProblemsSummary = async () => {
|
|
2339
|
+
const editorId = await getActiveEditorId();
|
|
2340
|
+
if (editorId === -1) {
|
|
2341
|
+
return {
|
|
2342
|
+
errorCount: 0,
|
|
2343
|
+
hasEditor: false,
|
|
2344
|
+
problemCount: 0,
|
|
2345
|
+
warningCount: 0
|
|
2346
|
+
};
|
|
2347
|
+
}
|
|
2348
|
+
const [allDiagnostics, activeDiagnostics] = await Promise.all([getProblems$1(), getDiagnostics(editorId)]);
|
|
2349
|
+
const uniqueDiagnostics = getUniqueDiagnostics(allDiagnostics);
|
|
2350
|
+
const uniqueActiveDiagnostics = getUniqueDiagnostics(activeDiagnostics);
|
|
2351
|
+
return {
|
|
2352
|
+
errorCount: countByType(uniqueActiveDiagnostics, Error$1),
|
|
2353
|
+
hasEditor: true,
|
|
2354
|
+
problemCount: uniqueDiagnostics.length,
|
|
2355
|
+
warningCount: countByType(uniqueActiveDiagnostics, Warning)
|
|
2356
|
+
};
|
|
2357
|
+
};
|
|
2358
|
+
|
|
2359
|
+
const getMissingRequests = (problems, fileIconCache) => {
|
|
2360
|
+
const missingRequests = [];
|
|
2361
|
+
const pendingUris = new Set();
|
|
2362
|
+
for (const problem of problems) {
|
|
2363
|
+
const {
|
|
2364
|
+
fileName,
|
|
2365
|
+
uri
|
|
2366
|
+
} = problem;
|
|
2367
|
+
if (!uri || uri in fileIconCache || pendingUris.has(uri)) {
|
|
2368
|
+
continue;
|
|
2369
|
+
}
|
|
2370
|
+
pendingUris.add(uri);
|
|
2371
|
+
missingRequests.push({
|
|
2372
|
+
name: fileName,
|
|
2373
|
+
uri
|
|
2374
|
+
});
|
|
2375
|
+
}
|
|
2376
|
+
return missingRequests;
|
|
2377
|
+
};
|
|
2378
|
+
const requestFileIcon = name => {
|
|
2379
|
+
if (!name) {
|
|
2380
|
+
return Promise.resolve('');
|
|
2381
|
+
}
|
|
2382
|
+
return getFileIcon({
|
|
2383
|
+
name
|
|
2384
|
+
});
|
|
2385
|
+
};
|
|
2386
|
+
const getFileIcons = async (problems, fileIconCache) => {
|
|
2387
|
+
const missingRequests = getMissingRequests(problems, fileIconCache);
|
|
2388
|
+
if (missingRequests.length === 0) {
|
|
2389
|
+
return fileIconCache;
|
|
2390
|
+
}
|
|
2391
|
+
const icons = await Promise.all(missingRequests.map(request => requestFileIcon(request.name)));
|
|
2392
|
+
const newFileIconCache = {
|
|
2393
|
+
...fileIconCache
|
|
2394
|
+
};
|
|
2395
|
+
for (let i = 0; i < missingRequests.length; i++) {
|
|
2396
|
+
newFileIconCache[missingRequests[i].uri] = icons[i];
|
|
2397
|
+
}
|
|
2398
|
+
return newFileIconCache;
|
|
2399
|
+
};
|
|
2400
|
+
|
|
2367
2401
|
const refreshProblems = async (state, activeUri) => {
|
|
2368
2402
|
const {
|
|
2369
2403
|
fileIconCache,
|
|
@@ -2540,6 +2574,31 @@ const handleIconThemeChange = async state => {
|
|
|
2540
2574
|
};
|
|
2541
2575
|
};
|
|
2542
2576
|
|
|
2577
|
+
const state = {
|
|
2578
|
+
connected: false
|
|
2579
|
+
};
|
|
2580
|
+
const isConnected = () => {
|
|
2581
|
+
const {
|
|
2582
|
+
connected
|
|
2583
|
+
} = state;
|
|
2584
|
+
return connected;
|
|
2585
|
+
};
|
|
2586
|
+
const invoke = (method, ...params) => {
|
|
2587
|
+
return invoke$2(method, ...params);
|
|
2588
|
+
};
|
|
2589
|
+
const set = rpc => {
|
|
2590
|
+
set$4(rpc);
|
|
2591
|
+
state.connected = true;
|
|
2592
|
+
};
|
|
2593
|
+
|
|
2594
|
+
const handleMessagePort = async port => {
|
|
2595
|
+
const rpc = await create$5({
|
|
2596
|
+
commandMap: {},
|
|
2597
|
+
messagePort: port
|
|
2598
|
+
});
|
|
2599
|
+
set(rpc);
|
|
2600
|
+
};
|
|
2601
|
+
|
|
2543
2602
|
const getIcon = (uri, fileIconCache) => {
|
|
2544
2603
|
if (!uri) {
|
|
2545
2604
|
return '';
|
|
@@ -3487,14 +3546,23 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
|
3487
3546
|
return commands;
|
|
3488
3547
|
};
|
|
3489
3548
|
|
|
3549
|
+
const renderDirect = async (uid, commands) => {
|
|
3550
|
+
const rendererWorkerCommands = commands.filter(command => command[0] === SetFocusContext);
|
|
3551
|
+
const rendererProcessCommands = commands.filter(command => command[0] !== SetFocusContext);
|
|
3552
|
+
const transactionId = await invoke('Viewlet.queueCommands', uid, rendererProcessCommands);
|
|
3553
|
+
return [...rendererWorkerCommands, ['Viewlet.commitPending', uid, transactionId]];
|
|
3554
|
+
};
|
|
3490
3555
|
const render2 = (uid, diffResult) => {
|
|
3491
3556
|
const {
|
|
3492
3557
|
newState,
|
|
3493
3558
|
oldState
|
|
3494
3559
|
} = get(uid);
|
|
3495
|
-
set(uid, newState, newState);
|
|
3560
|
+
set$1(uid, newState, newState);
|
|
3496
3561
|
const commands = applyRender(oldState, newState, diffResult);
|
|
3497
|
-
|
|
3562
|
+
if (!isConnected()) {
|
|
3563
|
+
return commands;
|
|
3564
|
+
}
|
|
3565
|
+
return renderDirect(uid, commands);
|
|
3498
3566
|
};
|
|
3499
3567
|
|
|
3500
3568
|
const getActionVirtualDom = action => {
|
|
@@ -3705,6 +3773,7 @@ const commandMap = {
|
|
|
3705
3773
|
'Problems.getKeyBindings': getKeyBindings,
|
|
3706
3774
|
'Problems.getMenuEntries2': wrapGetter(getMenuEntries2),
|
|
3707
3775
|
'Problems.getMenuIds': getMenuIds,
|
|
3776
|
+
'Problems.getProblemsSummary': getProblemsSummary,
|
|
3708
3777
|
'Problems.handleActiveEditorChange': wrapCommand(handleActiveEditorChange),
|
|
3709
3778
|
'Problems.handleArrowLeft': wrapCommand(handleArrowLeft),
|
|
3710
3779
|
'Problems.handleArrowRight': wrapCommand(handleArrowRight),
|
|
@@ -3716,6 +3785,7 @@ const commandMap = {
|
|
|
3716
3785
|
'Problems.handleDiagnosticsChange': wrapCommand(handleDiagnosticsChange),
|
|
3717
3786
|
'Problems.handleFilterInput': wrapCommand(handleFilterInput),
|
|
3718
3787
|
'Problems.handleIconThemeChange': wrapCommand(handleIconThemeChange),
|
|
3788
|
+
'Problems.handleMessagePort': handleMessagePort,
|
|
3719
3789
|
'Problems.handleScrollBarCaptureLost': wrapCommand(handleScrollBarCaptureLost),
|
|
3720
3790
|
'Problems.handleScrollBarClick': wrapCommand(handleScrollBarClick),
|
|
3721
3791
|
'Problems.handleScrollBarMove': wrapCommand(handleScrollBarMove),
|
|
@@ -3747,7 +3817,7 @@ const initializeEditorWorkerRpc = async () => {
|
|
|
3747
3817
|
commandMap: {},
|
|
3748
3818
|
send
|
|
3749
3819
|
});
|
|
3750
|
-
set$
|
|
3820
|
+
set$5(rpc);
|
|
3751
3821
|
return rpc;
|
|
3752
3822
|
} catch (error) {
|
|
3753
3823
|
throw new VError(error, `Failed to create editor worker rpc`);
|
|
@@ -3758,7 +3828,7 @@ const initializeRendererWorker = async () => {
|
|
|
3758
3828
|
const rpc = await create$2({
|
|
3759
3829
|
commandMap: commandMapRef
|
|
3760
3830
|
});
|
|
3761
|
-
set$
|
|
3831
|
+
set$2(rpc);
|
|
3762
3832
|
};
|
|
3763
3833
|
|
|
3764
3834
|
const listen = async () => {
|