@lvce-editor/problems-view 1.26.4 → 1.26.5
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 +110 -33
- package/package.json +1 -1
|
@@ -244,6 +244,21 @@ const terminate = () => {
|
|
|
244
244
|
globalThis.close();
|
|
245
245
|
};
|
|
246
246
|
|
|
247
|
+
const Item = 0;
|
|
248
|
+
const Expanded = 1;
|
|
249
|
+
const Collapsed = 2;
|
|
250
|
+
|
|
251
|
+
const collapseAll$1 = state => {
|
|
252
|
+
const {
|
|
253
|
+
problems
|
|
254
|
+
} = state;
|
|
255
|
+
const collapsedUris = problems.filter(problem => problem.listItemType !== Item).map(problem => problem.uri);
|
|
256
|
+
return {
|
|
257
|
+
...state,
|
|
258
|
+
collapsedUris: [...new Set(collapsedUris)]
|
|
259
|
+
};
|
|
260
|
+
};
|
|
261
|
+
|
|
247
262
|
const normalizeLine = line => {
|
|
248
263
|
if (line.startsWith('Error: ')) {
|
|
249
264
|
return line.slice('Error: '.length);
|
|
@@ -1596,9 +1611,11 @@ const VirtualDomElements = {
|
|
|
1596
1611
|
Video
|
|
1597
1612
|
};
|
|
1598
1613
|
|
|
1614
|
+
const ClientX = 'event.clientX';
|
|
1599
1615
|
const ClientY = 'event.clientY';
|
|
1600
1616
|
const DeltaMode = 'event.deltaMode';
|
|
1601
1617
|
const DeltaY = 'event.deltaY';
|
|
1618
|
+
const TargetName = 'event.target.name';
|
|
1602
1619
|
|
|
1603
1620
|
const Space = 9;
|
|
1604
1621
|
const PageUp = 10;
|
|
@@ -1808,10 +1825,6 @@ const getScrollBarSize = (size, contentSize, minimumSliderSize) => {
|
|
|
1808
1825
|
return Math.min(Math.max(Math.round(size ** 2 / contentSize), minimumSliderSize), size);
|
|
1809
1826
|
};
|
|
1810
1827
|
|
|
1811
|
-
const Item = 0;
|
|
1812
|
-
const Expanded = 1;
|
|
1813
|
-
const Collapsed = 2;
|
|
1814
|
-
|
|
1815
1828
|
const getListItemType = (listItemType, isCollapsed) => {
|
|
1816
1829
|
if (listItemType === Item) {
|
|
1817
1830
|
return Item;
|
|
@@ -2227,6 +2240,18 @@ const toProblems = (diagnostics, workspaceUri = '') => {
|
|
|
2227
2240
|
return problems;
|
|
2228
2241
|
};
|
|
2229
2242
|
|
|
2243
|
+
const getDiagnosticKey = diagnostic => JSON.stringify([diagnostic.uri, diagnostic.rowIndex, diagnostic.columnIndex, diagnostic.message, diagnostic.source, diagnostic.type, diagnostic.code]);
|
|
2244
|
+
const getUniqueDiagnostics = diagnostics => {
|
|
2245
|
+
const keys = new Set();
|
|
2246
|
+
return diagnostics.filter(diagnostic => {
|
|
2247
|
+
const key = getDiagnosticKey(diagnostic);
|
|
2248
|
+
if (keys.has(key)) {
|
|
2249
|
+
return false;
|
|
2250
|
+
}
|
|
2251
|
+
keys.add(key);
|
|
2252
|
+
return true;
|
|
2253
|
+
});
|
|
2254
|
+
};
|
|
2230
2255
|
const getProblems = async (workspaceUri, activeUri) => {
|
|
2231
2256
|
if (!activeUri) {
|
|
2232
2257
|
return {
|
|
@@ -2235,10 +2260,8 @@ const getProblems = async (workspaceUri, activeUri) => {
|
|
|
2235
2260
|
};
|
|
2236
2261
|
}
|
|
2237
2262
|
try {
|
|
2238
|
-
const diagnostics = await getProblems$1();
|
|
2239
|
-
const
|
|
2240
|
-
// @ts-ignore
|
|
2241
|
-
const problems = toProblems(activeDiagnostics, workspaceUri);
|
|
2263
|
+
const diagnostics = getUniqueDiagnostics(await getProblems$1());
|
|
2264
|
+
const problems = toProblems(diagnostics, workspaceUri);
|
|
2242
2265
|
return {
|
|
2243
2266
|
error: '',
|
|
2244
2267
|
problems
|
|
@@ -2389,10 +2412,6 @@ const handleClickAt = (state, eventX, eventY) => {
|
|
|
2389
2412
|
};
|
|
2390
2413
|
};
|
|
2391
2414
|
|
|
2392
|
-
const handleClickButton = async (state, name) => {
|
|
2393
|
-
return state;
|
|
2394
|
-
};
|
|
2395
|
-
|
|
2396
2415
|
const show2 = async (uid, menuId, x, y, args) => {
|
|
2397
2416
|
await showContextMenu2(uid, menuId, x, y, args);
|
|
2398
2417
|
};
|
|
@@ -2407,6 +2426,35 @@ const handleClickMoreFilters = async (state, eventX, eventY) => {
|
|
|
2407
2426
|
return state;
|
|
2408
2427
|
};
|
|
2409
2428
|
|
|
2429
|
+
const viewAsList = state => {
|
|
2430
|
+
return {
|
|
2431
|
+
...state,
|
|
2432
|
+
viewMode: List
|
|
2433
|
+
};
|
|
2434
|
+
};
|
|
2435
|
+
|
|
2436
|
+
const viewAsTable = state => {
|
|
2437
|
+
return {
|
|
2438
|
+
...state,
|
|
2439
|
+
viewMode: Table
|
|
2440
|
+
};
|
|
2441
|
+
};
|
|
2442
|
+
|
|
2443
|
+
const handleClickButton = async (state, name, eventX = 0, eventY = 0) => {
|
|
2444
|
+
switch (name) {
|
|
2445
|
+
case 'collapseAll':
|
|
2446
|
+
return collapseAll$1(state);
|
|
2447
|
+
case 'more filters':
|
|
2448
|
+
return handleClickMoreFilters(state, eventX, eventY);
|
|
2449
|
+
case 'viewAsList':
|
|
2450
|
+
return viewAsList(state);
|
|
2451
|
+
case 'viewAsTable':
|
|
2452
|
+
return viewAsTable(state);
|
|
2453
|
+
default:
|
|
2454
|
+
return state;
|
|
2455
|
+
}
|
|
2456
|
+
};
|
|
2457
|
+
|
|
2410
2458
|
const handleContextMenu = async (state, eventX, eventY) => {
|
|
2411
2459
|
const {
|
|
2412
2460
|
uid
|
|
@@ -2738,8 +2786,15 @@ const renderCss = (oldState, newState) => {
|
|
|
2738
2786
|
|
|
2739
2787
|
const Filter$2 = 'filter';
|
|
2740
2788
|
|
|
2789
|
+
const getFilterInputName = (inputSource, filterValue) => {
|
|
2790
|
+
if (inputSource === Script && filterValue) {
|
|
2791
|
+
return `${Filter$2}-${encodeURIComponent(filterValue)}`;
|
|
2792
|
+
}
|
|
2793
|
+
return Filter$2;
|
|
2794
|
+
};
|
|
2795
|
+
|
|
2741
2796
|
const renderFilterValue = (oldState, newState) => {
|
|
2742
|
-
return ['Viewlet.setValueByName',
|
|
2797
|
+
return ['Viewlet.setValueByName', getFilterInputName(newState.inputSource, newState.filterValue), newState.filterValue];
|
|
2743
2798
|
};
|
|
2744
2799
|
|
|
2745
2800
|
const Button = 1;
|
|
@@ -2791,6 +2846,10 @@ const HandleWheel = 7;
|
|
|
2791
2846
|
const HandleScrollBarMove = 8;
|
|
2792
2847
|
const HandleScrollBarPointerCaptureLost = 9;
|
|
2793
2848
|
const HandleScrollBarPointerDown = 10;
|
|
2849
|
+
const HandleCollapseAll = 11;
|
|
2850
|
+
const HandleViewAsList = 12;
|
|
2851
|
+
const HandleViewAsTable = 13;
|
|
2852
|
+
const HandleClickButton = 14;
|
|
2794
2853
|
|
|
2795
2854
|
const getIconVirtualDom = (icon, type = Div) => {
|
|
2796
2855
|
return {
|
|
@@ -2801,6 +2860,20 @@ const getIconVirtualDom = (icon, type = Div) => {
|
|
|
2801
2860
|
};
|
|
2802
2861
|
};
|
|
2803
2862
|
|
|
2863
|
+
const getOnClick = command => {
|
|
2864
|
+
switch (command) {
|
|
2865
|
+
case 'collapseAll':
|
|
2866
|
+
return HandleCollapseAll;
|
|
2867
|
+
case 'more filters':
|
|
2868
|
+
return HandleClickMoreFilters;
|
|
2869
|
+
case 'viewAsList':
|
|
2870
|
+
return HandleViewAsList;
|
|
2871
|
+
case 'viewAsTable':
|
|
2872
|
+
return HandleViewAsTable;
|
|
2873
|
+
default:
|
|
2874
|
+
return HandleClickButton;
|
|
2875
|
+
}
|
|
2876
|
+
};
|
|
2804
2877
|
const getActionButtonVirtualDom = action => {
|
|
2805
2878
|
const {
|
|
2806
2879
|
command,
|
|
@@ -2810,7 +2883,8 @@ const getActionButtonVirtualDom = action => {
|
|
|
2810
2883
|
return [{
|
|
2811
2884
|
childCount: 1,
|
|
2812
2885
|
className: IconButton,
|
|
2813
|
-
|
|
2886
|
+
name: command,
|
|
2887
|
+
onClick: getOnClick(command),
|
|
2814
2888
|
title: id,
|
|
2815
2889
|
type: Button$1
|
|
2816
2890
|
}, getIconVirtualDom(icon)];
|
|
@@ -2865,10 +2939,11 @@ const getProblemsFilterVirtualDom = action => {
|
|
|
2865
2939
|
childCount: getChildCount(action.badgeText),
|
|
2866
2940
|
className: Filter$1,
|
|
2867
2941
|
type: Div
|
|
2868
|
-
}, getInputBoxVirtualDom(Filter$2, action.command, action.placeholder || '', action.value), ...getFilterBadgeDom(action.badgeText), ...getActionButtonVirtualDom({
|
|
2942
|
+
}, getInputBoxVirtualDom(action.name || Filter$2, action.command, action.placeholder || '', action.value), ...getFilterBadgeDom(action.badgeText), ...getActionButtonVirtualDom({
|
|
2869
2943
|
command: 'more filters',
|
|
2870
2944
|
icon: Filter,
|
|
2871
|
-
id: 'more filters'
|
|
2945
|
+
id: 'more filters' // TODO use i18n string
|
|
2946
|
+
})];
|
|
2872
2947
|
};
|
|
2873
2948
|
|
|
2874
2949
|
const messageNode$2 = {
|
|
@@ -3189,7 +3264,7 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarActive) => {
|
|
|
3189
3264
|
|
|
3190
3265
|
const Focusable = 0;
|
|
3191
3266
|
|
|
3192
|
-
const getProblemsVirtualDom = (activeUri, viewMode, problems, filterValue, isSmall, message, scrollBarHeight = 0, scrollBarActive = false, problemCount = problems.length) => {
|
|
3267
|
+
const getProblemsVirtualDom = (activeUri, viewMode, problems, filterValue, inputSource, isSmall, message, scrollBarHeight = 0, scrollBarActive = false, problemCount = problems.length) => {
|
|
3193
3268
|
const baseDom = {
|
|
3194
3269
|
childCount: isSmall ? 2 : 1,
|
|
3195
3270
|
className: mergeClassNames(Viewlet, Problems),
|
|
@@ -3204,6 +3279,7 @@ const getProblemsVirtualDom = (activeUri, viewMode, problems, filterValue, isSma
|
|
|
3204
3279
|
const filterDom = isSmall ? getProblemsFilterVirtualDom({
|
|
3205
3280
|
badgeText: '',
|
|
3206
3281
|
command: HandleFilterInput,
|
|
3282
|
+
name: getFilterInputName(inputSource, filterValue),
|
|
3207
3283
|
placeholder: filter(),
|
|
3208
3284
|
value: filterValue
|
|
3209
3285
|
}) : [];
|
|
@@ -3224,6 +3300,7 @@ const renderItems = (oldState, newState) => {
|
|
|
3224
3300
|
collapsedUris,
|
|
3225
3301
|
filterValue,
|
|
3226
3302
|
focusedIndex,
|
|
3303
|
+
inputSource,
|
|
3227
3304
|
maxLineY,
|
|
3228
3305
|
message,
|
|
3229
3306
|
minLineY,
|
|
@@ -3237,7 +3314,7 @@ const renderItems = (oldState, newState) => {
|
|
|
3237
3314
|
const problemCount = getVisibleProblemCount(problems, collapsedUris, filterValue, viewMode);
|
|
3238
3315
|
const visible = getVisibleProblems(problems, collapsedUris, focusedIndex, filterValue, minLineY, maxLineY, viewMode);
|
|
3239
3316
|
const isSmall = width <= smallWidthBreakPoint;
|
|
3240
|
-
const dom = getProblemsVirtualDom(activeUri, viewMode, visible, filterValue, isSmall, message, scrollBarHeight, scrollBarActive, problemCount);
|
|
3317
|
+
const dom = getProblemsVirtualDom(activeUri, viewMode, visible, filterValue, inputSource, isSmall, message, scrollBarHeight, scrollBarActive, problemCount);
|
|
3241
3318
|
return ['Viewlet.setDom2', dom];
|
|
3242
3319
|
};
|
|
3243
3320
|
|
|
@@ -3313,6 +3390,7 @@ const getActions = state => {
|
|
|
3313
3390
|
badgeText: visibleCount === problemsCount ? '' : showingOf(visibleCount, problemsCount),
|
|
3314
3391
|
command: HandleFilterInput,
|
|
3315
3392
|
id: 'Filter',
|
|
3393
|
+
name: getFilterInputName(inputSource, filterValue),
|
|
3316
3394
|
placeholder: filter(),
|
|
3317
3395
|
type: ProblemsFilter,
|
|
3318
3396
|
value: inputSource === Script ? filterValue : ''
|
|
@@ -3370,7 +3448,19 @@ const renderEventListeners = () => {
|
|
|
3370
3448
|
params: ['handleClickAt', 'event.clientX', 'event.clientY']
|
|
3371
3449
|
}, {
|
|
3372
3450
|
name: HandleClickMoreFilters,
|
|
3373
|
-
params: ['handleClickMoreFilters']
|
|
3451
|
+
params: ['handleClickMoreFilters', ClientX, ClientY]
|
|
3452
|
+
}, {
|
|
3453
|
+
name: HandleClickButton,
|
|
3454
|
+
params: ['handleClickButton', TargetName, ClientX, ClientY]
|
|
3455
|
+
}, {
|
|
3456
|
+
name: HandleCollapseAll,
|
|
3457
|
+
params: ['collapseAll']
|
|
3458
|
+
}, {
|
|
3459
|
+
name: HandleViewAsList,
|
|
3460
|
+
params: ['viewAsList']
|
|
3461
|
+
}, {
|
|
3462
|
+
name: HandleViewAsTable,
|
|
3463
|
+
params: ['viewAsTable']
|
|
3374
3464
|
}, {
|
|
3375
3465
|
name: HandleWheel,
|
|
3376
3466
|
params: ['handleWheel', DeltaMode, DeltaY],
|
|
@@ -3409,21 +3499,8 @@ const saveState = state => {
|
|
|
3409
3499
|
};
|
|
3410
3500
|
};
|
|
3411
3501
|
|
|
3412
|
-
const viewAsList = state => {
|
|
3413
|
-
return {
|
|
3414
|
-
...state,
|
|
3415
|
-
viewMode: List
|
|
3416
|
-
};
|
|
3417
|
-
};
|
|
3418
|
-
|
|
3419
|
-
const viewAsTable = state => {
|
|
3420
|
-
return {
|
|
3421
|
-
...state,
|
|
3422
|
-
viewMode: Table
|
|
3423
|
-
};
|
|
3424
|
-
};
|
|
3425
|
-
|
|
3426
3502
|
const commandMap = {
|
|
3503
|
+
'Problems.collapseAll': wrapCommand(collapseAll$1),
|
|
3427
3504
|
'Problems.copyMessage': wrapCommand(copyMessage),
|
|
3428
3505
|
'Problems.create': create,
|
|
3429
3506
|
'Problems.diff2': diff2,
|