@lvce-editor/problems-view 1.26.5 → 1.26.7
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 +89 -16
- package/package.json +1 -1
|
@@ -1674,6 +1674,9 @@ const sendMessagePortToEditorWorker$1 = async (port, rpcId) => {
|
|
|
1674
1674
|
const command = 'HandleMessagePort.handleMessagePort';
|
|
1675
1675
|
await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
|
|
1676
1676
|
};
|
|
1677
|
+
const getFileIcon = async options => {
|
|
1678
|
+
return invoke('IconTheme.getFileIcon', options);
|
|
1679
|
+
};
|
|
1677
1680
|
const writeClipBoardText$1 = async text => {
|
|
1678
1681
|
await invoke('ClipBoard.writeText', /* text */text);
|
|
1679
1682
|
};
|
|
@@ -1729,6 +1732,7 @@ const create = (id, uri, x, y, width, height, workspaceUri) => {
|
|
|
1729
1732
|
activeUri: '',
|
|
1730
1733
|
collapsedUris: [],
|
|
1731
1734
|
deltaY: 0,
|
|
1735
|
+
fileIconCache: {},
|
|
1732
1736
|
filteredProblems: [],
|
|
1733
1737
|
filterValue: '',
|
|
1734
1738
|
finalDeltaY: 0,
|
|
@@ -1779,7 +1783,7 @@ const haveSameCollapsedUris = (oldState, newState) => {
|
|
|
1779
1783
|
return oldCollapsedUris.length === newCollapsedUris.length && oldCollapsedUris.every((uri, index) => uri === newCollapsedUris[index]);
|
|
1780
1784
|
};
|
|
1781
1785
|
const isEqual = (oldState, newState) => {
|
|
1782
|
-
return oldState.activeUri === newState.activeUri && haveSameCollapsedUris(oldState, newState) && oldState.focusedIndex === newState.focusedIndex && oldState.height === newState.height && oldState.maxLineY === newState.maxLineY && oldState.minLineY === newState.minLineY && oldState.problems === newState.problems && oldState.filterValue === newState.filterValue && oldState.message === newState.message && oldState.scrollBarActive === newState.scrollBarActive && oldState.scrollBarHeight === newState.scrollBarHeight && oldState.width === newState.width && oldState.viewMode === newState.viewMode;
|
|
1786
|
+
return oldState.activeUri === newState.activeUri && haveSameCollapsedUris(oldState, newState) && oldState.fileIconCache === newState.fileIconCache && oldState.focusedIndex === newState.focusedIndex && oldState.height === newState.height && oldState.maxLineY === newState.maxLineY && oldState.minLineY === newState.minLineY && oldState.problems === newState.problems && oldState.filterValue === newState.filterValue && oldState.message === newState.message && oldState.scrollBarActive === newState.scrollBarActive && oldState.scrollBarHeight === newState.scrollBarHeight && oldState.width === newState.width && oldState.viewMode === newState.viewMode;
|
|
1783
1787
|
};
|
|
1784
1788
|
|
|
1785
1789
|
const RenderItems = 1;
|
|
@@ -2129,6 +2133,48 @@ const getMenuIds = () => {
|
|
|
2129
2133
|
return [ProblemsFilter$1];
|
|
2130
2134
|
};
|
|
2131
2135
|
|
|
2136
|
+
const getMissingRequests = (problems, fileIconCache) => {
|
|
2137
|
+
const missingRequests = [];
|
|
2138
|
+
const pendingUris = new Set();
|
|
2139
|
+
for (const problem of problems) {
|
|
2140
|
+
const {
|
|
2141
|
+
fileName,
|
|
2142
|
+
uri
|
|
2143
|
+
} = problem;
|
|
2144
|
+
if (!uri || uri in fileIconCache || pendingUris.has(uri)) {
|
|
2145
|
+
continue;
|
|
2146
|
+
}
|
|
2147
|
+
pendingUris.add(uri);
|
|
2148
|
+
missingRequests.push({
|
|
2149
|
+
name: fileName,
|
|
2150
|
+
uri
|
|
2151
|
+
});
|
|
2152
|
+
}
|
|
2153
|
+
return missingRequests;
|
|
2154
|
+
};
|
|
2155
|
+
const requestFileIcon = name => {
|
|
2156
|
+
if (!name) {
|
|
2157
|
+
return Promise.resolve('');
|
|
2158
|
+
}
|
|
2159
|
+
return getFileIcon({
|
|
2160
|
+
name
|
|
2161
|
+
});
|
|
2162
|
+
};
|
|
2163
|
+
const getFileIcons = async (problems, fileIconCache) => {
|
|
2164
|
+
const missingRequests = getMissingRequests(problems, fileIconCache);
|
|
2165
|
+
if (missingRequests.length === 0) {
|
|
2166
|
+
return fileIconCache;
|
|
2167
|
+
}
|
|
2168
|
+
const icons = await Promise.all(missingRequests.map(request => requestFileIcon(request.name)));
|
|
2169
|
+
const newFileIconCache = {
|
|
2170
|
+
...fileIconCache
|
|
2171
|
+
};
|
|
2172
|
+
for (let i = 0; i < missingRequests.length; i++) {
|
|
2173
|
+
newFileIconCache[missingRequests[i].uri] = icons[i];
|
|
2174
|
+
}
|
|
2175
|
+
return newFileIconCache;
|
|
2176
|
+
};
|
|
2177
|
+
|
|
2132
2178
|
const {
|
|
2133
2179
|
getProblems: getProblems$1,
|
|
2134
2180
|
getUri} = EditorWorker;
|
|
@@ -2276,15 +2322,18 @@ const getProblems = async (workspaceUri, activeUri) => {
|
|
|
2276
2322
|
|
|
2277
2323
|
const refreshProblems = async (state, activeUri) => {
|
|
2278
2324
|
const {
|
|
2325
|
+
fileIconCache,
|
|
2279
2326
|
workspaceUri
|
|
2280
2327
|
} = state;
|
|
2281
2328
|
const {
|
|
2282
2329
|
error,
|
|
2283
2330
|
problems
|
|
2284
2331
|
} = await getProblems(workspaceUri, activeUri);
|
|
2332
|
+
const newFileIconCache = await getFileIcons(problems, fileIconCache);
|
|
2285
2333
|
return {
|
|
2286
2334
|
...state,
|
|
2287
2335
|
activeUri,
|
|
2336
|
+
fileIconCache: newFileIconCache,
|
|
2288
2337
|
filteredProblems: problems,
|
|
2289
2338
|
inputSource: Script,
|
|
2290
2339
|
listItems: [],
|
|
@@ -2473,13 +2522,14 @@ const handleFilterInput = (state, value, inputSource = Script) => {
|
|
|
2473
2522
|
};
|
|
2474
2523
|
};
|
|
2475
2524
|
|
|
2476
|
-
const handleIconThemeChange = state => {
|
|
2525
|
+
const handleIconThemeChange = async state => {
|
|
2477
2526
|
const {
|
|
2478
2527
|
problems
|
|
2479
2528
|
} = state;
|
|
2529
|
+
const fileIconCache = await getFileIcons(problems, {});
|
|
2480
2530
|
return {
|
|
2481
2531
|
...state,
|
|
2482
|
-
|
|
2532
|
+
fileIconCache
|
|
2483
2533
|
};
|
|
2484
2534
|
};
|
|
2485
2535
|
|
|
@@ -2626,6 +2676,7 @@ const getSavedViewMode = savedState => {
|
|
|
2626
2676
|
|
|
2627
2677
|
const loadContent = async (state, savedState) => {
|
|
2628
2678
|
const {
|
|
2679
|
+
fileIconCache: oldFileIconCache,
|
|
2629
2680
|
workspaceUri
|
|
2630
2681
|
} = state;
|
|
2631
2682
|
const activeUri = await getActiveUri();
|
|
@@ -2643,6 +2694,7 @@ const loadContent = async (state, savedState) => {
|
|
|
2643
2694
|
};
|
|
2644
2695
|
}
|
|
2645
2696
|
const message = getMessage(problems.length);
|
|
2697
|
+
const fileIconCache = await getFileIcons(problems, oldFileIconCache);
|
|
2646
2698
|
const viewMode = getSavedViewMode(savedState);
|
|
2647
2699
|
const filterValue = getSavedFilterValue(savedState);
|
|
2648
2700
|
const collapsedUris = getSavedCollapsedUris(savedState);
|
|
@@ -2650,6 +2702,7 @@ const loadContent = async (state, savedState) => {
|
|
|
2650
2702
|
...state,
|
|
2651
2703
|
activeUri,
|
|
2652
2704
|
collapsedUris,
|
|
2705
|
+
fileIconCache,
|
|
2653
2706
|
filteredProblems: problems,
|
|
2654
2707
|
filterValue,
|
|
2655
2708
|
inputSource: Script,
|
|
@@ -2688,18 +2741,14 @@ const getUniqueIndents = problems => {
|
|
|
2688
2741
|
return uniqueIndents;
|
|
2689
2742
|
};
|
|
2690
2743
|
|
|
2691
|
-
const
|
|
2692
|
-
return '';
|
|
2693
|
-
};
|
|
2694
|
-
|
|
2695
|
-
const getIcon = uri => {
|
|
2744
|
+
const getIcon = (uri, fileIconCache) => {
|
|
2696
2745
|
if (!uri) {
|
|
2697
2746
|
return '';
|
|
2698
2747
|
}
|
|
2699
|
-
return
|
|
2748
|
+
return fileIconCache[uri] || '';
|
|
2700
2749
|
};
|
|
2701
2750
|
|
|
2702
|
-
const getVisibleProblems = (problems, collapsedUris, focusedIndex, filterValue, minLineY = 0, maxLineY = Infinity, viewMode = List) => {
|
|
2751
|
+
const getVisibleProblems = (problems, fileIconCache, collapsedUris, focusedIndex, filterValue, minLineY = 0, maxLineY = Infinity, viewMode = List) => {
|
|
2703
2752
|
array(problems);
|
|
2704
2753
|
array(collapsedUris);
|
|
2705
2754
|
number(focusedIndex);
|
|
@@ -2714,7 +2763,7 @@ const getVisibleProblems = (problems, collapsedUris, focusedIndex, filterValue,
|
|
|
2714
2763
|
visibleItems.push({
|
|
2715
2764
|
...problem,
|
|
2716
2765
|
filterValueLength,
|
|
2717
|
-
icon: getIcon(problem.uri),
|
|
2766
|
+
icon: getIcon(problem.uri, fileIconCache),
|
|
2718
2767
|
isActive: i === focusedIndex,
|
|
2719
2768
|
isEven: i % 2 === 0
|
|
2720
2769
|
});
|
|
@@ -2726,6 +2775,7 @@ const renderCss = (oldState, newState) => {
|
|
|
2726
2775
|
const {
|
|
2727
2776
|
collapsedUris,
|
|
2728
2777
|
deltaY,
|
|
2778
|
+
fileIconCache,
|
|
2729
2779
|
filterValue,
|
|
2730
2780
|
finalDeltaY,
|
|
2731
2781
|
focusedIndex,
|
|
@@ -2740,7 +2790,7 @@ const renderCss = (oldState, newState) => {
|
|
|
2740
2790
|
viewMode,
|
|
2741
2791
|
width
|
|
2742
2792
|
} = newState;
|
|
2743
|
-
const visibleProblems = getVisibleProblems(problems, collapsedUris, focusedIndex, filterValue, minLineY, maxLineY, viewMode);
|
|
2793
|
+
const visibleProblems = getVisibleProblems(problems, fileIconCache, collapsedUris, focusedIndex, filterValue, minLineY, maxLineY, viewMode);
|
|
2744
2794
|
const uniqueIndents = getUniqueIndents(visibleProblems);
|
|
2745
2795
|
const listHeight = getListHeight(height, width, smallWidthBreakPoint, viewMode);
|
|
2746
2796
|
const scrollBarTop = getScrollBarTop(listHeight, finalDeltaY, deltaY, scrollBarHeight);
|
|
@@ -2850,6 +2900,7 @@ const HandleCollapseAll = 11;
|
|
|
2850
2900
|
const HandleViewAsList = 12;
|
|
2851
2901
|
const HandleViewAsTable = 13;
|
|
2852
2902
|
const HandleClickButton = 14;
|
|
2903
|
+
const HandleFileNameClick = 15;
|
|
2853
2904
|
|
|
2854
2905
|
const getIconVirtualDom = (icon, type = Div) => {
|
|
2855
2906
|
return {
|
|
@@ -3069,7 +3120,8 @@ const getProblemVirtualDom = problem => {
|
|
|
3069
3120
|
rowIndex,
|
|
3070
3121
|
setSize,
|
|
3071
3122
|
source,
|
|
3072
|
-
type
|
|
3123
|
+
type,
|
|
3124
|
+
uri
|
|
3073
3125
|
} = problem;
|
|
3074
3126
|
let className = Problem;
|
|
3075
3127
|
const indent = getProblemIndent(listItemType);
|
|
@@ -3088,7 +3140,11 @@ const getProblemVirtualDom = problem => {
|
|
|
3088
3140
|
className,
|
|
3089
3141
|
role: TreeItem,
|
|
3090
3142
|
type: Div
|
|
3091
|
-
}, listItemType === Collapsed ? getChevronRightVirtualDom() : getChevronDownVirtualDom(), getFileIconVirtualDom(icon),
|
|
3143
|
+
}, listItemType === Collapsed ? getChevronRightVirtualDom() : getChevronDownVirtualDom(), getFileIconVirtualDom(icon), {
|
|
3144
|
+
...labelNode,
|
|
3145
|
+
'data-uri': uri,
|
|
3146
|
+
onClick: HandleFileNameClick
|
|
3147
|
+
}, text(fileName), labelDetailNode, text(relativePath), ...getBadgeVirtualDom(ProblemBadge, problem.count)];
|
|
3092
3148
|
}
|
|
3093
3149
|
const lineColumn = atLineColumn(rowIndex + 1, columnIndex + 1);
|
|
3094
3150
|
const label = {
|
|
@@ -3298,6 +3354,7 @@ const renderItems = (oldState, newState) => {
|
|
|
3298
3354
|
const {
|
|
3299
3355
|
activeUri,
|
|
3300
3356
|
collapsedUris,
|
|
3357
|
+
fileIconCache,
|
|
3301
3358
|
filterValue,
|
|
3302
3359
|
focusedIndex,
|
|
3303
3360
|
inputSource,
|
|
@@ -3312,7 +3369,7 @@ const renderItems = (oldState, newState) => {
|
|
|
3312
3369
|
width
|
|
3313
3370
|
} = newState;
|
|
3314
3371
|
const problemCount = getVisibleProblemCount(problems, collapsedUris, filterValue, viewMode);
|
|
3315
|
-
const visible = getVisibleProblems(problems, collapsedUris, focusedIndex, filterValue, minLineY, maxLineY, viewMode);
|
|
3372
|
+
const visible = getVisibleProblems(problems, fileIconCache, collapsedUris, focusedIndex, filterValue, minLineY, maxLineY, viewMode);
|
|
3316
3373
|
const isSmall = width <= smallWidthBreakPoint;
|
|
3317
3374
|
const dom = getProblemsVirtualDom(activeUri, viewMode, visible, filterValue, inputSource, isSmall, message, scrollBarHeight, scrollBarActive, problemCount);
|
|
3318
3375
|
return ['Viewlet.setDom2', dom];
|
|
@@ -3373,6 +3430,7 @@ const getActionsVirtualDom = actions => {
|
|
|
3373
3430
|
const getActions = state => {
|
|
3374
3431
|
const {
|
|
3375
3432
|
collapsedUris,
|
|
3433
|
+
fileIconCache,
|
|
3376
3434
|
filterValue,
|
|
3377
3435
|
focusedIndex,
|
|
3378
3436
|
inputSource,
|
|
@@ -3381,7 +3439,7 @@ const getActions = state => {
|
|
|
3381
3439
|
viewMode,
|
|
3382
3440
|
width
|
|
3383
3441
|
} = state;
|
|
3384
|
-
const visibleCount = getVisibleProblems(problems, collapsedUris, focusedIndex, filterValue, 0, Infinity, viewMode).length;
|
|
3442
|
+
const visibleCount = getVisibleProblems(problems, fileIconCache, collapsedUris, focusedIndex, filterValue, 0, Infinity, viewMode).length;
|
|
3385
3443
|
const problemsCount = problems.length;
|
|
3386
3444
|
const isSmall = width <= smallWidthBreakPoint;
|
|
3387
3445
|
const actions = [];
|
|
@@ -3446,6 +3504,9 @@ const renderEventListeners = () => {
|
|
|
3446
3504
|
}, {
|
|
3447
3505
|
name: HandlePointerDown,
|
|
3448
3506
|
params: ['handleClickAt', 'event.clientX', 'event.clientY']
|
|
3507
|
+
}, {
|
|
3508
|
+
name: HandleFileNameClick,
|
|
3509
|
+
params: ['toggleFileGroup', 'event.target.dataset.uri']
|
|
3449
3510
|
}, {
|
|
3450
3511
|
name: HandleClickMoreFilters,
|
|
3451
3512
|
params: ['handleClickMoreFilters', ClientX, ClientY]
|
|
@@ -3499,6 +3560,17 @@ const saveState = state => {
|
|
|
3499
3560
|
};
|
|
3500
3561
|
};
|
|
3501
3562
|
|
|
3563
|
+
const toggleFileGroup = (state, uri) => {
|
|
3564
|
+
const {
|
|
3565
|
+
collapsedUris
|
|
3566
|
+
} = state;
|
|
3567
|
+
const newCollapsedUris = collapsedUris.includes(uri) ? collapsedUris.filter(collapsedUri => collapsedUri !== uri) : [...collapsedUris, uri];
|
|
3568
|
+
return {
|
|
3569
|
+
...state,
|
|
3570
|
+
collapsedUris: newCollapsedUris
|
|
3571
|
+
};
|
|
3572
|
+
};
|
|
3573
|
+
|
|
3502
3574
|
const commandMap = {
|
|
3503
3575
|
'Problems.collapseAll': wrapCommand(collapseAll$1),
|
|
3504
3576
|
'Problems.copyMessage': wrapCommand(copyMessage),
|
|
@@ -3532,6 +3604,7 @@ const commandMap = {
|
|
|
3532
3604
|
'Problems.resize': resize,
|
|
3533
3605
|
'Problems.saveState': wrapGetter(saveState),
|
|
3534
3606
|
'Problems.terminate': terminate,
|
|
3607
|
+
'Problems.toggleFileGroup': wrapCommand(toggleFileGroup),
|
|
3535
3608
|
'Problems.viewAsList': wrapCommand(viewAsList),
|
|
3536
3609
|
'Problems.viewAsTable': wrapCommand(viewAsTable)
|
|
3537
3610
|
};
|