@lvce-editor/problems-view 1.28.0 → 1.29.1

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.
@@ -1783,7 +1783,7 @@ const create = (id, uri, x, y, width, height, workspaceUri) => {
1783
1783
  };
1784
1784
 
1785
1785
  const isEqual$2 = (oldState, newState) => {
1786
- return oldState.collapsedUris === newState.collapsedUris && oldState.deltaY === newState.deltaY && oldState.filterValue === newState.filterValue && oldState.finalDeltaY === newState.finalDeltaY && oldState.height === newState.height && oldState.itemHeight === newState.itemHeight && oldState.maxLineY === newState.maxLineY && oldState.minLineY === newState.minLineY && oldState.problems === newState.problems && oldState.scrollBarHeight === newState.scrollBarHeight && oldState.viewMode === newState.viewMode && oldState.width === newState.width;
1786
+ return oldState.collapsedUris === newState.collapsedUris && oldState.deltaY === newState.deltaY && oldState.filterValue === newState.filterValue && oldState.finalDeltaY === newState.finalDeltaY && oldState.height === newState.height && oldState.itemHeight === newState.itemHeight && oldState.maxLineY === newState.maxLineY && oldState.minLineY === newState.minLineY && oldState.problems === newState.problems && oldState.showErrors === newState.showErrors && oldState.showInfos === newState.showInfos && oldState.showWarnings === newState.showWarnings && oldState.scrollBarHeight === newState.scrollBarHeight && oldState.viewMode === newState.viewMode && oldState.width === newState.width;
1787
1787
  };
1788
1788
 
1789
1789
  const isEqual$1 = (oldState, newState) => {
@@ -1802,7 +1802,7 @@ const haveSameCollapsedUris = (oldState, newState) => {
1802
1802
  return oldCollapsedUris.length === newCollapsedUris.length && oldCollapsedUris.every((uri, index) => uri === newCollapsedUris[index]);
1803
1803
  };
1804
1804
  const isEqual = (oldState, newState) => {
1805
- 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;
1805
+ 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.showErrors === newState.showErrors && oldState.showInfos === newState.showInfos && oldState.showWarnings === newState.showWarnings && oldState.filterValue === newState.filterValue && oldState.message === newState.message && oldState.scrollBarActive === newState.scrollBarActive && oldState.scrollBarHeight === newState.scrollBarHeight && oldState.width === newState.width && oldState.viewMode === newState.viewMode;
1806
1806
  };
1807
1807
 
1808
1808
  const RenderItems = 1;
@@ -1848,6 +1848,9 @@ const getScrollBarSize = (size, contentSize, minimumSliderSize) => {
1848
1848
  return Math.min(Math.max(Math.round(size ** 2 / contentSize), minimumSliderSize), size);
1849
1849
  };
1850
1850
 
1851
+ const Error$1 = 'error';
1852
+ const Warning = 'warning';
1853
+
1851
1854
  const getListItemType = (listItemType, isCollapsed) => {
1852
1855
  if (listItemType === Item) {
1853
1856
  return Item;
@@ -1865,11 +1868,30 @@ const matchesFilterValue = (string, filterValueLower) => {
1865
1868
  return 0;
1866
1869
  };
1867
1870
 
1868
- const filterProblems = (problems, collapsedUris, filterValue) => {
1871
+ const matchesSeverity = (problem, showErrors, showWarnings, showInfos) => {
1872
+ switch (problem.type) {
1873
+ case Error$1:
1874
+ return showErrors;
1875
+ case Warning:
1876
+ return showWarnings;
1877
+ default:
1878
+ return showInfos;
1879
+ }
1880
+ };
1881
+ const filterProblems = (problems, collapsedUris, filterValue, showErrors = true, showWarnings = true, showInfos = true) => {
1869
1882
  const filterValueLower = filterValue.toLowerCase();
1870
1883
  const collapsedUriSet = new Set(collapsedUris);
1884
+ const hasSeverityFilter = !showErrors || !showWarnings || !showInfos;
1885
+ const visibleUris = new Set(problems.filter(problem => problem.listItemType === Item && matchesSeverity(problem, showErrors, showWarnings, showInfos)).map(problem => problem.uri));
1871
1886
  const filtered = [];
1872
1887
  for (const problem of problems) {
1888
+ if (problem.listItemType === Item) {
1889
+ if (!matchesSeverity(problem, showErrors, showWarnings, showInfos)) {
1890
+ continue;
1891
+ }
1892
+ } else if (hasSeverityFilter && !visibleUris.has(problem.uri)) {
1893
+ continue;
1894
+ }
1873
1895
  const uriMatchIndex = matchesFilterValue(problem.uri, filterValueLower);
1874
1896
  const sourceMatchIndex = matchesFilterValue(problem.source, filterValueLower);
1875
1897
  const messageMatchIndex = matchesFilterValue(problem.message, filterValueLower);
@@ -1892,8 +1914,8 @@ const filterProblems = (problems, collapsedUris, filterValue) => {
1892
1914
  return filtered;
1893
1915
  };
1894
1916
 
1895
- const getVisibleProblemCount = (problems, collapsedUris, filterValue, viewMode) => {
1896
- const filtered = filterProblems(problems, collapsedUris, filterValue);
1917
+ const getVisibleProblemCount = (problems, collapsedUris, filterValue, viewMode, showErrors = true, showWarnings = true, showInfos = true) => {
1918
+ const filtered = filterProblems(problems, collapsedUris, filterValue, showErrors, showWarnings, showInfos);
1897
1919
  if (viewMode !== Table) {
1898
1920
  return filtered.length;
1899
1921
  }
@@ -1915,11 +1937,14 @@ const updateVirtualList = (state, newDeltaY) => {
1915
1937
  itemHeight,
1916
1938
  minimumSliderSize,
1917
1939
  problems,
1940
+ showErrors,
1941
+ showInfos,
1942
+ showWarnings,
1918
1943
  smallWidthBreakPoint,
1919
1944
  viewMode,
1920
1945
  width
1921
1946
  } = state;
1922
- const itemCount = getVisibleProblemCount(problems, collapsedUris, filterValue, viewMode);
1947
+ const itemCount = getVisibleProblemCount(problems, collapsedUris, filterValue, viewMode, showErrors, showWarnings, showInfos);
1923
1948
  const listHeight = getListHeight(height, width, smallWidthBreakPoint, viewMode);
1924
1949
  const contentHeight = itemCount * itemHeight;
1925
1950
  const finalDeltaY = Math.max(contentHeight - listHeight, 0);
@@ -2119,17 +2144,17 @@ const getMenuEntriesFilter = state => {
2119
2144
  showWarnings: showWarnings$1
2120
2145
  } = state;
2121
2146
  return [{
2122
- command: '-1',
2147
+ command: 'Problems.toggleShowErrors',
2123
2148
  flags: showErrors$1 ? Checked : Unchecked,
2124
2149
  id: 'show-errors',
2125
2150
  label: showErrors()
2126
2151
  }, {
2127
- command: '-1',
2152
+ command: 'Problems.toggleShowWarnings',
2128
2153
  flags: showWarnings$1 ? Checked : Unchecked,
2129
2154
  id: 'show-warnings',
2130
2155
  label: showWarnings()
2131
2156
  }, {
2132
- command: '-1',
2157
+ command: 'Problems.toggleShowInfos',
2133
2158
  flags: showInfos$1 ? Checked : Unchecked,
2134
2159
  id: 'show-infos',
2135
2160
  label: showInfos()
@@ -2522,14 +2547,14 @@ const getIcon = (uri, fileIconCache) => {
2522
2547
  return fileIconCache[uri] || '';
2523
2548
  };
2524
2549
 
2525
- const getVisibleProblems = (problems, fileIconCache, collapsedUris, focusedIndex, filterValue, minLineY = 0, maxLineY = Infinity, viewMode = List) => {
2550
+ const getVisibleProblems = (problems, fileIconCache, collapsedUris, focusedIndex, filterValue, minLineY = 0, maxLineY = Infinity, viewMode = List, showErrors = true, showWarnings = true, showInfos = true) => {
2526
2551
  array(problems);
2527
2552
  array(collapsedUris);
2528
2553
  number(focusedIndex);
2529
2554
  string(filterValue);
2530
2555
  const visibleItems = [];
2531
2556
  const filterValueLength = filterValue.length;
2532
- const filtered = filterProblems(problems, collapsedUris, filterValue);
2557
+ const filtered = filterProblems(problems, collapsedUris, filterValue, showErrors, showWarnings, showInfos);
2533
2558
  const displayProblems = viewMode === Table ? filtered.filter(problem => problem.message) : filtered;
2534
2559
  const finalLineY = Math.min(maxLineY, displayProblems.length);
2535
2560
  for (let i = minLineY; i < finalLineY; i++) {
@@ -2558,6 +2583,9 @@ const handleClickAt = (state, eventX, eventY) => {
2558
2583
  filterValue,
2559
2584
  itemHeight,
2560
2585
  problems,
2586
+ showErrors,
2587
+ showInfos,
2588
+ showWarnings,
2561
2589
  smallWidthBreakPoint,
2562
2590
  viewMode,
2563
2591
  width,
@@ -2567,7 +2595,7 @@ const handleClickAt = (state, eventX, eventY) => {
2567
2595
 
2568
2596
  // TODO use functional focus rendering
2569
2597
  // Focus.setFocus(FocusKey.Problems)
2570
- const problemCount = getVisibleProblemCount(problems, collapsedUris, filterValue, viewMode);
2598
+ const problemCount = getVisibleProblemCount(problems, collapsedUris, filterValue, viewMode, showErrors, showWarnings, showInfos);
2571
2599
  if (problemCount === 0) {
2572
2600
  return focusIndex(state, -1);
2573
2601
  }
@@ -2595,9 +2623,12 @@ const handleProblemClick = async (state, eventX, eventY) => {
2595
2623
  fileIconCache,
2596
2624
  filterValue,
2597
2625
  problems,
2626
+ showErrors,
2627
+ showInfos,
2628
+ showWarnings,
2598
2629
  viewMode
2599
2630
  } = newState;
2600
- const visibleProblems = getVisibleProblems(problems, fileIconCache, collapsedUris, focusedIndex, filterValue, focusedIndex, focusedIndex + 1, viewMode);
2631
+ const visibleProblems = getVisibleProblems(problems, fileIconCache, collapsedUris, focusedIndex, filterValue, focusedIndex, focusedIndex + 1, viewMode, showErrors, showWarnings, showInfos);
2601
2632
  const problem = visibleProblems[0];
2602
2633
  if (!problem || problem.listItemType !== Item) {
2603
2634
  return newState;
@@ -2840,12 +2871,15 @@ const renderCss = (oldState, newState) => {
2840
2871
  minLineY,
2841
2872
  problems,
2842
2873
  scrollBarHeight,
2874
+ showErrors,
2875
+ showInfos,
2876
+ showWarnings,
2843
2877
  smallWidthBreakPoint,
2844
2878
  uid,
2845
2879
  viewMode,
2846
2880
  width
2847
2881
  } = newState;
2848
- const visibleProblems = getVisibleProblems(problems, fileIconCache, collapsedUris, focusedIndex, filterValue, minLineY, maxLineY, viewMode);
2882
+ const visibleProblems = getVisibleProblems(problems, fileIconCache, collapsedUris, focusedIndex, filterValue, minLineY, maxLineY, viewMode, showErrors, showWarnings, showInfos);
2849
2883
  const uniqueIndents = getUniqueIndents(visibleProblems);
2850
2884
  const listHeight = getListHeight(height, width, smallWidthBreakPoint, viewMode);
2851
2885
  const scrollBarTop = getScrollBarTop(listHeight, finalDeltaY, deltaY, scrollBarHeight);
@@ -3105,8 +3139,6 @@ const getFileIconVirtualDom = icon => {
3105
3139
  };
3106
3140
  };
3107
3141
 
3108
- const Warning = 'warning';
3109
-
3110
3142
  const warningIconNode = {
3111
3143
  childCount: 0,
3112
3144
  className: mergeClassNames(ProblemsIcon, ProblemsWarningIcon),
@@ -3419,12 +3451,15 @@ const renderItems = (oldState, newState) => {
3419
3451
  problems,
3420
3452
  scrollBarActive,
3421
3453
  scrollBarHeight,
3454
+ showErrors,
3455
+ showInfos,
3456
+ showWarnings,
3422
3457
  smallWidthBreakPoint,
3423
3458
  viewMode,
3424
3459
  width
3425
3460
  } = newState;
3426
- const problemCount = getVisibleProblemCount(problems, collapsedUris, filterValue, viewMode);
3427
- const visible = getVisibleProblems(problems, fileIconCache, collapsedUris, focusedIndex, filterValue, minLineY, maxLineY, viewMode);
3461
+ const problemCount = getVisibleProblemCount(problems, collapsedUris, filterValue, viewMode, showErrors, showWarnings, showInfos);
3462
+ const visible = getVisibleProblems(problems, fileIconCache, collapsedUris, focusedIndex, filterValue, minLineY, maxLineY, viewMode, showErrors, showWarnings, showInfos);
3428
3463
  const isSmall = width <= smallWidthBreakPoint;
3429
3464
  const dom = getProblemsVirtualDom(activeUri, viewMode, visible, filterValue, inputSource, isSmall, message, scrollBarHeight, scrollBarActive, problemCount);
3430
3465
  return ['Viewlet.setDom2', dom];
@@ -3490,11 +3525,14 @@ const getActions = state => {
3490
3525
  focusedIndex,
3491
3526
  inputSource,
3492
3527
  problems,
3528
+ showErrors,
3529
+ showInfos,
3530
+ showWarnings,
3493
3531
  smallWidthBreakPoint,
3494
3532
  viewMode,
3495
3533
  width
3496
3534
  } = state;
3497
- const visibleCount = getVisibleProblems(problems, fileIconCache, collapsedUris, focusedIndex, filterValue, 0, Infinity, viewMode).length;
3535
+ const visibleCount = getVisibleProblems(problems, fileIconCache, collapsedUris, focusedIndex, filterValue, 0, Infinity, viewMode, showErrors, showWarnings, showInfos).length;
3498
3536
  const problemsCount = problems.length;
3499
3537
  const isSmall = width <= smallWidthBreakPoint;
3500
3538
  const actions = [];
@@ -3627,6 +3665,36 @@ const toggleFileGroup = (state, uri) => {
3627
3665
  };
3628
3666
  };
3629
3667
 
3668
+ const toggleShowErrors = state => {
3669
+ const {
3670
+ showErrors
3671
+ } = state;
3672
+ return {
3673
+ ...state,
3674
+ showErrors: !showErrors
3675
+ };
3676
+ };
3677
+
3678
+ const toggleShowInfos = state => {
3679
+ const {
3680
+ showInfos
3681
+ } = state;
3682
+ return {
3683
+ ...state,
3684
+ showInfos: !showInfos
3685
+ };
3686
+ };
3687
+
3688
+ const toggleShowWarnings = state => {
3689
+ const {
3690
+ showWarnings
3691
+ } = state;
3692
+ return {
3693
+ ...state,
3694
+ showWarnings: !showWarnings
3695
+ };
3696
+ };
3697
+
3630
3698
  const commandMap = {
3631
3699
  'Problems.collapseAll': wrapCommand(collapseAll$1),
3632
3700
  'Problems.copyMessage': wrapCommand(copyMessage),
@@ -3661,6 +3729,9 @@ const commandMap = {
3661
3729
  'Problems.saveState': wrapGetter(saveState),
3662
3730
  'Problems.terminate': terminate,
3663
3731
  'Problems.toggleFileGroup': wrapCommand(toggleFileGroup),
3732
+ 'Problems.toggleShowErrors': wrapCommand(toggleShowErrors),
3733
+ 'Problems.toggleShowInfos': wrapCommand(toggleShowInfos),
3734
+ 'Problems.toggleShowWarnings': wrapCommand(toggleShowWarnings),
3664
3735
  'Problems.viewAsList': wrapCommand(viewAsList),
3665
3736
  'Problems.viewAsTable': wrapCommand(viewAsTable)
3666
3737
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/problems-view",
3
- "version": "1.28.0",
3
+ "version": "1.29.1",
4
4
  "description": "Problems View Worker",
5
5
  "repository": {
6
6
  "type": "git",