@lvce-editor/problems-view 1.26.7 → 1.28.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 +129 -73
- package/package.json +1 -1
|
@@ -1683,10 +1683,29 @@ const writeClipBoardText$1 = async text => {
|
|
|
1683
1683
|
const getActiveEditorId$1 = () => {
|
|
1684
1684
|
return invoke('GetActiveEditor.getActiveEditorId');
|
|
1685
1685
|
};
|
|
1686
|
+
const getWorkspacePath$1 = () => {
|
|
1687
|
+
return invoke('Workspace.getPath');
|
|
1688
|
+
};
|
|
1689
|
+
const openUri$1 = async (uri, focus, options) => {
|
|
1690
|
+
await invoke('Main.openUri', {
|
|
1691
|
+
...options,
|
|
1692
|
+
focus,
|
|
1693
|
+
uri
|
|
1694
|
+
});
|
|
1695
|
+
};
|
|
1686
1696
|
|
|
1687
1697
|
const getActiveEditorId = () => {
|
|
1688
1698
|
return getActiveEditorId$1();
|
|
1689
1699
|
};
|
|
1700
|
+
const focusEditor = async () => {
|
|
1701
|
+
await invoke('Main.focus');
|
|
1702
|
+
};
|
|
1703
|
+
const openUri = (uri, focus) => {
|
|
1704
|
+
return openUri$1(uri, focus);
|
|
1705
|
+
};
|
|
1706
|
+
const setEditorCursor = async (rowIndex, columnIndex) => {
|
|
1707
|
+
await invoke('Editor.cursorSet', rowIndex, columnIndex);
|
|
1708
|
+
};
|
|
1690
1709
|
const sendMessagePortToEditorWorker = (port, rpcId) => {
|
|
1691
1710
|
return sendMessagePortToEditorWorker$1(port, rpcId);
|
|
1692
1711
|
};
|
|
@@ -2424,43 +2443,6 @@ const handleBlur = state => {
|
|
|
2424
2443
|
};
|
|
2425
2444
|
};
|
|
2426
2445
|
|
|
2427
|
-
const getListIndex = (eventX, eventY, x, y, deltaY, itemHeight) => {
|
|
2428
|
-
const relativeY = eventY - y + deltaY;
|
|
2429
|
-
const index = Math.floor(relativeY / itemHeight);
|
|
2430
|
-
return index;
|
|
2431
|
-
};
|
|
2432
|
-
|
|
2433
|
-
const handleClickAt = (state, eventX, eventY) => {
|
|
2434
|
-
const {
|
|
2435
|
-
collapsedUris,
|
|
2436
|
-
deltaY,
|
|
2437
|
-
filterValue,
|
|
2438
|
-
itemHeight,
|
|
2439
|
-
problems,
|
|
2440
|
-
smallWidthBreakPoint,
|
|
2441
|
-
viewMode,
|
|
2442
|
-
width,
|
|
2443
|
-
x,
|
|
2444
|
-
y
|
|
2445
|
-
} = state;
|
|
2446
|
-
|
|
2447
|
-
// TODO use functional focus rendering
|
|
2448
|
-
// Focus.setFocus(FocusKey.Problems)
|
|
2449
|
-
const problemCount = getVisibleProblemCount(problems, collapsedUris, filterValue, viewMode);
|
|
2450
|
-
if (problemCount === 0) {
|
|
2451
|
-
return focusIndex(state, -1);
|
|
2452
|
-
}
|
|
2453
|
-
const listTopOffset = getListTopOffset(width, smallWidthBreakPoint, viewMode);
|
|
2454
|
-
const index = getListIndex(eventX, eventY, x, y + listTopOffset, deltaY, itemHeight);
|
|
2455
|
-
if (index < 0 || index >= problemCount) {
|
|
2456
|
-
return focusIndex(state, -1);
|
|
2457
|
-
}
|
|
2458
|
-
return {
|
|
2459
|
-
...state,
|
|
2460
|
-
focusedIndex: index
|
|
2461
|
-
};
|
|
2462
|
-
};
|
|
2463
|
-
|
|
2464
2446
|
const show2 = async (uid, menuId, x, y, args) => {
|
|
2465
2447
|
await showContextMenu2(uid, menuId, x, y, args);
|
|
2466
2448
|
};
|
|
@@ -2533,6 +2515,104 @@ const handleIconThemeChange = async state => {
|
|
|
2533
2515
|
};
|
|
2534
2516
|
};
|
|
2535
2517
|
|
|
2518
|
+
const getIcon = (uri, fileIconCache) => {
|
|
2519
|
+
if (!uri) {
|
|
2520
|
+
return '';
|
|
2521
|
+
}
|
|
2522
|
+
return fileIconCache[uri] || '';
|
|
2523
|
+
};
|
|
2524
|
+
|
|
2525
|
+
const getVisibleProblems = (problems, fileIconCache, collapsedUris, focusedIndex, filterValue, minLineY = 0, maxLineY = Infinity, viewMode = List) => {
|
|
2526
|
+
array(problems);
|
|
2527
|
+
array(collapsedUris);
|
|
2528
|
+
number(focusedIndex);
|
|
2529
|
+
string(filterValue);
|
|
2530
|
+
const visibleItems = [];
|
|
2531
|
+
const filterValueLength = filterValue.length;
|
|
2532
|
+
const filtered = filterProblems(problems, collapsedUris, filterValue);
|
|
2533
|
+
const displayProblems = viewMode === Table ? filtered.filter(problem => problem.message) : filtered;
|
|
2534
|
+
const finalLineY = Math.min(maxLineY, displayProblems.length);
|
|
2535
|
+
for (let i = minLineY; i < finalLineY; i++) {
|
|
2536
|
+
const problem = displayProblems[i];
|
|
2537
|
+
visibleItems.push({
|
|
2538
|
+
...problem,
|
|
2539
|
+
filterValueLength,
|
|
2540
|
+
icon: getIcon(problem.uri, fileIconCache),
|
|
2541
|
+
isActive: i === focusedIndex,
|
|
2542
|
+
isEven: i % 2 === 0
|
|
2543
|
+
});
|
|
2544
|
+
}
|
|
2545
|
+
return visibleItems;
|
|
2546
|
+
};
|
|
2547
|
+
|
|
2548
|
+
const getListIndex = (eventX, eventY, x, y, deltaY, itemHeight) => {
|
|
2549
|
+
const relativeY = eventY - y + deltaY;
|
|
2550
|
+
const index = Math.floor(relativeY / itemHeight);
|
|
2551
|
+
return index;
|
|
2552
|
+
};
|
|
2553
|
+
|
|
2554
|
+
const handleClickAt = (state, eventX, eventY) => {
|
|
2555
|
+
const {
|
|
2556
|
+
collapsedUris,
|
|
2557
|
+
deltaY,
|
|
2558
|
+
filterValue,
|
|
2559
|
+
itemHeight,
|
|
2560
|
+
problems,
|
|
2561
|
+
smallWidthBreakPoint,
|
|
2562
|
+
viewMode,
|
|
2563
|
+
width,
|
|
2564
|
+
x,
|
|
2565
|
+
y
|
|
2566
|
+
} = state;
|
|
2567
|
+
|
|
2568
|
+
// TODO use functional focus rendering
|
|
2569
|
+
// Focus.setFocus(FocusKey.Problems)
|
|
2570
|
+
const problemCount = getVisibleProblemCount(problems, collapsedUris, filterValue, viewMode);
|
|
2571
|
+
if (problemCount === 0) {
|
|
2572
|
+
return focusIndex(state, -1);
|
|
2573
|
+
}
|
|
2574
|
+
const listTopOffset = getListTopOffset(width, smallWidthBreakPoint, viewMode);
|
|
2575
|
+
const index = getListIndex(eventX, eventY, x, y + listTopOffset, deltaY, itemHeight);
|
|
2576
|
+
if (index < 0 || index >= problemCount) {
|
|
2577
|
+
return focusIndex(state, -1);
|
|
2578
|
+
}
|
|
2579
|
+
return {
|
|
2580
|
+
...state,
|
|
2581
|
+
focusedIndex: index
|
|
2582
|
+
};
|
|
2583
|
+
};
|
|
2584
|
+
|
|
2585
|
+
const handleProblemClick = async (state, eventX, eventY) => {
|
|
2586
|
+
const newState = handleClickAt(state, eventX, eventY);
|
|
2587
|
+
const {
|
|
2588
|
+
focusedIndex
|
|
2589
|
+
} = newState;
|
|
2590
|
+
if (focusedIndex < 0) {
|
|
2591
|
+
return newState;
|
|
2592
|
+
}
|
|
2593
|
+
const {
|
|
2594
|
+
collapsedUris,
|
|
2595
|
+
fileIconCache,
|
|
2596
|
+
filterValue,
|
|
2597
|
+
problems,
|
|
2598
|
+
viewMode
|
|
2599
|
+
} = newState;
|
|
2600
|
+
const visibleProblems = getVisibleProblems(problems, fileIconCache, collapsedUris, focusedIndex, filterValue, focusedIndex, focusedIndex + 1, viewMode);
|
|
2601
|
+
const problem = visibleProblems[0];
|
|
2602
|
+
if (!problem || problem.listItemType !== Item) {
|
|
2603
|
+
return newState;
|
|
2604
|
+
}
|
|
2605
|
+
const {
|
|
2606
|
+
columnIndex,
|
|
2607
|
+
rowIndex,
|
|
2608
|
+
uri
|
|
2609
|
+
} = problem;
|
|
2610
|
+
await openUri(uri, true);
|
|
2611
|
+
await focusEditor();
|
|
2612
|
+
await setEditorCursor(rowIndex, columnIndex);
|
|
2613
|
+
return newState;
|
|
2614
|
+
};
|
|
2615
|
+
|
|
2536
2616
|
const handleScrollBarCaptureLost = state => {
|
|
2537
2617
|
return {
|
|
2538
2618
|
...state,
|
|
@@ -2674,12 +2754,15 @@ const getSavedViewMode = savedState => {
|
|
|
2674
2754
|
return List;
|
|
2675
2755
|
};
|
|
2676
2756
|
|
|
2757
|
+
const getWorkspacePath = () => {
|
|
2758
|
+
return getWorkspacePath$1();
|
|
2759
|
+
};
|
|
2760
|
+
|
|
2677
2761
|
const loadContent = async (state, savedState) => {
|
|
2678
2762
|
const {
|
|
2679
|
-
fileIconCache: oldFileIconCache
|
|
2680
|
-
workspaceUri
|
|
2763
|
+
fileIconCache: oldFileIconCache
|
|
2681
2764
|
} = state;
|
|
2682
|
-
const activeUri = await getActiveUri();
|
|
2765
|
+
const [activeUri, workspaceUri] = await Promise.all([getActiveUri(), getWorkspacePath()]);
|
|
2683
2766
|
const {
|
|
2684
2767
|
error,
|
|
2685
2768
|
problems
|
|
@@ -2690,7 +2773,8 @@ const loadContent = async (state, savedState) => {
|
|
|
2690
2773
|
activeUri,
|
|
2691
2774
|
filteredProblems: [],
|
|
2692
2775
|
message: error,
|
|
2693
|
-
problems: []
|
|
2776
|
+
problems: [],
|
|
2777
|
+
workspaceUri
|
|
2694
2778
|
};
|
|
2695
2779
|
}
|
|
2696
2780
|
const message = getMessage(problems.length);
|
|
@@ -2709,7 +2793,8 @@ const loadContent = async (state, savedState) => {
|
|
|
2709
2793
|
listItems: [],
|
|
2710
2794
|
message,
|
|
2711
2795
|
problems,
|
|
2712
|
-
viewMode
|
|
2796
|
+
viewMode,
|
|
2797
|
+
workspaceUri
|
|
2713
2798
|
};
|
|
2714
2799
|
};
|
|
2715
2800
|
|
|
@@ -2741,36 +2826,6 @@ const getUniqueIndents = problems => {
|
|
|
2741
2826
|
return uniqueIndents;
|
|
2742
2827
|
};
|
|
2743
2828
|
|
|
2744
|
-
const getIcon = (uri, fileIconCache) => {
|
|
2745
|
-
if (!uri) {
|
|
2746
|
-
return '';
|
|
2747
|
-
}
|
|
2748
|
-
return fileIconCache[uri] || '';
|
|
2749
|
-
};
|
|
2750
|
-
|
|
2751
|
-
const getVisibleProblems = (problems, fileIconCache, collapsedUris, focusedIndex, filterValue, minLineY = 0, maxLineY = Infinity, viewMode = List) => {
|
|
2752
|
-
array(problems);
|
|
2753
|
-
array(collapsedUris);
|
|
2754
|
-
number(focusedIndex);
|
|
2755
|
-
string(filterValue);
|
|
2756
|
-
const visibleItems = [];
|
|
2757
|
-
const filterValueLength = filterValue.length;
|
|
2758
|
-
const filtered = filterProblems(problems, collapsedUris, filterValue);
|
|
2759
|
-
const displayProblems = viewMode === Table ? filtered.filter(problem => problem.message) : filtered;
|
|
2760
|
-
const finalLineY = Math.min(maxLineY, displayProblems.length);
|
|
2761
|
-
for (let i = minLineY; i < finalLineY; i++) {
|
|
2762
|
-
const problem = displayProblems[i];
|
|
2763
|
-
visibleItems.push({
|
|
2764
|
-
...problem,
|
|
2765
|
-
filterValueLength,
|
|
2766
|
-
icon: getIcon(problem.uri, fileIconCache),
|
|
2767
|
-
isActive: i === focusedIndex,
|
|
2768
|
-
isEven: i % 2 === 0
|
|
2769
|
-
});
|
|
2770
|
-
}
|
|
2771
|
-
return visibleItems;
|
|
2772
|
-
};
|
|
2773
|
-
|
|
2774
2829
|
const renderCss = (oldState, newState) => {
|
|
2775
2830
|
const {
|
|
2776
2831
|
collapsedUris,
|
|
@@ -3530,6 +3585,7 @@ const renderEventListeners = () => {
|
|
|
3530
3585
|
name: HandleScrollBarPointerDown,
|
|
3531
3586
|
params: ['handleScrollBarClick', ClientY],
|
|
3532
3587
|
preventDefault: true,
|
|
3588
|
+
stopPropagation: true,
|
|
3533
3589
|
trackPointerEvents: [HandleScrollBarMove, HandleScrollBarPointerCaptureLost]
|
|
3534
3590
|
}, {
|
|
3535
3591
|
name: HandleScrollBarMove,
|
|
@@ -3585,7 +3641,7 @@ const commandMap = {
|
|
|
3585
3641
|
'Problems.handleArrowLeft': wrapCommand(handleArrowLeft),
|
|
3586
3642
|
'Problems.handleArrowRight': wrapCommand(handleArrowRight),
|
|
3587
3643
|
'Problems.handleBlur': wrapCommand(handleBlur),
|
|
3588
|
-
'Problems.handleClickAt': wrapCommand(
|
|
3644
|
+
'Problems.handleClickAt': wrapCommand(handleProblemClick),
|
|
3589
3645
|
'Problems.handleClickButton': wrapCommand(handleClickButton),
|
|
3590
3646
|
'Problems.handleClickMoreFilters': wrapCommand(handleClickMoreFilters),
|
|
3591
3647
|
'Problems.handleContextMenu': wrapCommand(handleContextMenu),
|