@lvce-editor/problems-view 1.27.0 → 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 +116 -68
- package/package.json +1 -1
|
@@ -1686,10 +1686,26 @@ const getActiveEditorId$1 = () => {
|
|
|
1686
1686
|
const getWorkspacePath$1 = () => {
|
|
1687
1687
|
return invoke('Workspace.getPath');
|
|
1688
1688
|
};
|
|
1689
|
+
const openUri$1 = async (uri, focus, options) => {
|
|
1690
|
+
await invoke('Main.openUri', {
|
|
1691
|
+
...options,
|
|
1692
|
+
focus,
|
|
1693
|
+
uri
|
|
1694
|
+
});
|
|
1695
|
+
};
|
|
1689
1696
|
|
|
1690
1697
|
const getActiveEditorId = () => {
|
|
1691
1698
|
return getActiveEditorId$1();
|
|
1692
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
|
+
};
|
|
1693
1709
|
const sendMessagePortToEditorWorker = (port, rpcId) => {
|
|
1694
1710
|
return sendMessagePortToEditorWorker$1(port, rpcId);
|
|
1695
1711
|
};
|
|
@@ -2427,43 +2443,6 @@ const handleBlur = state => {
|
|
|
2427
2443
|
};
|
|
2428
2444
|
};
|
|
2429
2445
|
|
|
2430
|
-
const getListIndex = (eventX, eventY, x, y, deltaY, itemHeight) => {
|
|
2431
|
-
const relativeY = eventY - y + deltaY;
|
|
2432
|
-
const index = Math.floor(relativeY / itemHeight);
|
|
2433
|
-
return index;
|
|
2434
|
-
};
|
|
2435
|
-
|
|
2436
|
-
const handleClickAt = (state, eventX, eventY) => {
|
|
2437
|
-
const {
|
|
2438
|
-
collapsedUris,
|
|
2439
|
-
deltaY,
|
|
2440
|
-
filterValue,
|
|
2441
|
-
itemHeight,
|
|
2442
|
-
problems,
|
|
2443
|
-
smallWidthBreakPoint,
|
|
2444
|
-
viewMode,
|
|
2445
|
-
width,
|
|
2446
|
-
x,
|
|
2447
|
-
y
|
|
2448
|
-
} = state;
|
|
2449
|
-
|
|
2450
|
-
// TODO use functional focus rendering
|
|
2451
|
-
// Focus.setFocus(FocusKey.Problems)
|
|
2452
|
-
const problemCount = getVisibleProblemCount(problems, collapsedUris, filterValue, viewMode);
|
|
2453
|
-
if (problemCount === 0) {
|
|
2454
|
-
return focusIndex(state, -1);
|
|
2455
|
-
}
|
|
2456
|
-
const listTopOffset = getListTopOffset(width, smallWidthBreakPoint, viewMode);
|
|
2457
|
-
const index = getListIndex(eventX, eventY, x, y + listTopOffset, deltaY, itemHeight);
|
|
2458
|
-
if (index < 0 || index >= problemCount) {
|
|
2459
|
-
return focusIndex(state, -1);
|
|
2460
|
-
}
|
|
2461
|
-
return {
|
|
2462
|
-
...state,
|
|
2463
|
-
focusedIndex: index
|
|
2464
|
-
};
|
|
2465
|
-
};
|
|
2466
|
-
|
|
2467
2446
|
const show2 = async (uid, menuId, x, y, args) => {
|
|
2468
2447
|
await showContextMenu2(uid, menuId, x, y, args);
|
|
2469
2448
|
};
|
|
@@ -2536,6 +2515,104 @@ const handleIconThemeChange = async state => {
|
|
|
2536
2515
|
};
|
|
2537
2516
|
};
|
|
2538
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
|
+
|
|
2539
2616
|
const handleScrollBarCaptureLost = state => {
|
|
2540
2617
|
return {
|
|
2541
2618
|
...state,
|
|
@@ -2749,36 +2826,6 @@ const getUniqueIndents = problems => {
|
|
|
2749
2826
|
return uniqueIndents;
|
|
2750
2827
|
};
|
|
2751
2828
|
|
|
2752
|
-
const getIcon = (uri, fileIconCache) => {
|
|
2753
|
-
if (!uri) {
|
|
2754
|
-
return '';
|
|
2755
|
-
}
|
|
2756
|
-
return fileIconCache[uri] || '';
|
|
2757
|
-
};
|
|
2758
|
-
|
|
2759
|
-
const getVisibleProblems = (problems, fileIconCache, collapsedUris, focusedIndex, filterValue, minLineY = 0, maxLineY = Infinity, viewMode = List) => {
|
|
2760
|
-
array(problems);
|
|
2761
|
-
array(collapsedUris);
|
|
2762
|
-
number(focusedIndex);
|
|
2763
|
-
string(filterValue);
|
|
2764
|
-
const visibleItems = [];
|
|
2765
|
-
const filterValueLength = filterValue.length;
|
|
2766
|
-
const filtered = filterProblems(problems, collapsedUris, filterValue);
|
|
2767
|
-
const displayProblems = viewMode === Table ? filtered.filter(problem => problem.message) : filtered;
|
|
2768
|
-
const finalLineY = Math.min(maxLineY, displayProblems.length);
|
|
2769
|
-
for (let i = minLineY; i < finalLineY; i++) {
|
|
2770
|
-
const problem = displayProblems[i];
|
|
2771
|
-
visibleItems.push({
|
|
2772
|
-
...problem,
|
|
2773
|
-
filterValueLength,
|
|
2774
|
-
icon: getIcon(problem.uri, fileIconCache),
|
|
2775
|
-
isActive: i === focusedIndex,
|
|
2776
|
-
isEven: i % 2 === 0
|
|
2777
|
-
});
|
|
2778
|
-
}
|
|
2779
|
-
return visibleItems;
|
|
2780
|
-
};
|
|
2781
|
-
|
|
2782
2829
|
const renderCss = (oldState, newState) => {
|
|
2783
2830
|
const {
|
|
2784
2831
|
collapsedUris,
|
|
@@ -3538,6 +3585,7 @@ const renderEventListeners = () => {
|
|
|
3538
3585
|
name: HandleScrollBarPointerDown,
|
|
3539
3586
|
params: ['handleScrollBarClick', ClientY],
|
|
3540
3587
|
preventDefault: true,
|
|
3588
|
+
stopPropagation: true,
|
|
3541
3589
|
trackPointerEvents: [HandleScrollBarMove, HandleScrollBarPointerCaptureLost]
|
|
3542
3590
|
}, {
|
|
3543
3591
|
name: HandleScrollBarMove,
|
|
@@ -3593,7 +3641,7 @@ const commandMap = {
|
|
|
3593
3641
|
'Problems.handleArrowLeft': wrapCommand(handleArrowLeft),
|
|
3594
3642
|
'Problems.handleArrowRight': wrapCommand(handleArrowRight),
|
|
3595
3643
|
'Problems.handleBlur': wrapCommand(handleBlur),
|
|
3596
|
-
'Problems.handleClickAt': wrapCommand(
|
|
3644
|
+
'Problems.handleClickAt': wrapCommand(handleProblemClick),
|
|
3597
3645
|
'Problems.handleClickButton': wrapCommand(handleClickButton),
|
|
3598
3646
|
'Problems.handleClickMoreFilters': wrapCommand(handleClickMoreFilters),
|
|
3599
3647
|
'Problems.handleContextMenu': wrapCommand(handleContextMenu),
|