@lvce-editor/problems-view 1.31.2 → 1.32.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.
@@ -1922,7 +1922,8 @@ const filterProblems = (problems, collapsedUris, filterValue, showErrors = true,
1922
1922
  };
1923
1923
 
1924
1924
  const getVisibleProblemCount = (problems, collapsedUris, filterValue, viewMode, showErrors = true, showWarnings = true, showInfos = true) => {
1925
- const filtered = filterProblems(problems, collapsedUris, filterValue, showErrors, showWarnings, showInfos);
1925
+ const effectiveCollapsedUris = viewMode === Table ? [] : collapsedUris;
1926
+ const filtered = filterProblems(problems, effectiveCollapsedUris, filterValue, showErrors, showWarnings, showInfos);
1926
1927
  if (viewMode !== Table) {
1927
1928
  return filtered.length;
1928
1929
  }
@@ -2335,6 +2336,13 @@ const getProblems = async (workspaceUri, activeUri) => {
2335
2336
  const countByType = (diagnostics, type) => {
2336
2337
  return diagnostics.filter(diagnostic => diagnostic.type === type).length;
2337
2338
  };
2339
+ const getActiveDiagnostics = async editorId => {
2340
+ try {
2341
+ return await getDiagnostics(editorId);
2342
+ } catch {
2343
+ return [];
2344
+ }
2345
+ };
2338
2346
  const getProblemsSummary = async () => {
2339
2347
  const editorId = await getActiveEditorId();
2340
2348
  if (editorId === -1) {
@@ -2345,7 +2353,7 @@ const getProblemsSummary = async () => {
2345
2353
  warningCount: 0
2346
2354
  };
2347
2355
  }
2348
- const [allDiagnostics, activeDiagnostics] = await Promise.all([getProblems$1(), getDiagnostics(editorId)]);
2356
+ const [allDiagnostics, activeDiagnostics] = await Promise.all([getProblems$1(), getActiveDiagnostics(editorId)]);
2349
2357
  const uniqueDiagnostics = getUniqueDiagnostics(allDiagnostics);
2350
2358
  const uniqueActiveDiagnostics = getUniqueDiagnostics(activeDiagnostics);
2351
2359
  return {
@@ -2591,9 +2599,19 @@ const set = rpc => {
2591
2599
  state.connected = true;
2592
2600
  };
2593
2601
 
2594
- const handleMessagePort = async port => {
2602
+ const handleMessagePort = async (port, viewletCommandMap) => {
2603
+ const executeViewletCommand = async (uid, command, ...args) => {
2604
+ const fn = viewletCommandMap[`Problems.${command}`];
2605
+ if (typeof fn !== 'function') {
2606
+ throw new TypeError(`Viewlet command not found: ${command}`);
2607
+ }
2608
+ await fn(uid, ...args);
2609
+ await invoke$1('Viewlet.requestRender', uid);
2610
+ };
2595
2611
  const rpc = await create$5({
2596
- commandMap: {},
2612
+ commandMap: {
2613
+ 'Viewlet.executeViewletCommand': executeViewletCommand
2614
+ },
2597
2615
  messagePort: port
2598
2616
  });
2599
2617
  set(rpc);
@@ -2613,7 +2631,8 @@ const getVisibleProblems = (problems, fileIconCache, collapsedUris, focusedIndex
2613
2631
  string(filterValue);
2614
2632
  const visibleItems = [];
2615
2633
  const filterValueLength = filterValue.length;
2616
- const filtered = filterProblems(problems, collapsedUris, filterValue, showErrors, showWarnings, showInfos);
2634
+ const effectiveCollapsedUris = viewMode === Table ? [] : collapsedUris;
2635
+ const filtered = filterProblems(problems, effectiveCollapsedUris, filterValue, showErrors, showWarnings, showInfos);
2617
2636
  const displayProblems = viewMode === Table ? filtered.filter(problem => problem.message) : filtered;
2618
2637
  const finalLineY = Math.min(maxLineY, displayProblems.length);
2619
2638
  for (let i = minLineY; i < finalLineY; i++) {
@@ -3767,6 +3786,7 @@ const toggleShowWarnings = state => {
3767
3786
  };
3768
3787
  };
3769
3788
 
3789
+ const handleDirectMessagePort = port => handleMessagePort(port, commandMap);
3770
3790
  const commandMap = {
3771
3791
  'Problems.collapseAll': wrapCommand(collapseAll$1),
3772
3792
  'Problems.copyMessage': wrapCommand(copyMessage),
@@ -3789,7 +3809,7 @@ const commandMap = {
3789
3809
  'Problems.handleDiagnosticsChange': wrapCommand(handleDiagnosticsChange),
3790
3810
  'Problems.handleFilterInput': wrapCommand(handleFilterInput),
3791
3811
  'Problems.handleIconThemeChange': wrapCommand(handleIconThemeChange),
3792
- 'Problems.handleMessagePort': handleMessagePort,
3812
+ 'Problems.handleMessagePort': handleDirectMessagePort,
3793
3813
  'Problems.handleScrollBarCaptureLost': wrapCommand(handleScrollBarCaptureLost),
3794
3814
  'Problems.handleScrollBarClick': wrapCommand(handleScrollBarClick),
3795
3815
  'Problems.handleScrollBarMove': wrapCommand(handleScrollBarMove),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/problems-view",
3
- "version": "1.31.2",
3
+ "version": "1.32.0",
4
4
  "description": "Problems View Worker",
5
5
  "repository": {
6
6
  "type": "git",