Skip to content

Conversation

rijesha
Copy link
Contributor

@rijesha rijesha commented Aug 21, 2025

No description provided.

@rijesha rijesha requested a review from Copilot August 21, 2025 23:44
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the project tree view to visually highlight the currently active project and improves the user experience when switching between projects by preserving their open/closed states.

  • Adds visual highlighting for the active project in the tree view using CSS selection styles
  • Implements state preservation logic to maintain project expansion states when switching between projects
  • Improves quick pick behavior by setting ignoreFocusOut to prevent accidental dismissal

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.

File Description
src/project_utilities/project.ts Sets ignoreFocusOut property on quick pick to prevent dismissal when focus changes
src/panels/view.css Updates CSS to maintain selection highlighting and adds styles for active project highlighting
src/panels/project_tree_view/ProjectTreeViewHandler.js Adds JavaScript logic to preserve project open states and handle project selection behavior
src/panels/project_tree_view/ProjectTreeView.ts Marks active project as selected and updates icon configuration for proper tree display

tree.data = message;
// Keep a deep copy to restore open states when needed
try {
prevData = JSON.parse(JSON.stringify(message));
Copy link
Preview

Copilot AI Aug 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using JSON.parse(JSON.stringify()) for deep cloning is inefficient and can fail with circular references or non-serializable data. Consider using a proper deep clone utility or structured cloning if available.

Suggested change
prevData = JSON.parse(JSON.stringify(message));
prevData = structuredClone(message);

Copilot uses AI. Check for mistakes.

// Keep a deep copy to restore open states when needed
try {
prevData = JSON.parse(JSON.stringify(message));
} catch {
Copy link
Preview

Copilot AI Aug 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The empty catch block silently ignores errors without logging or handling them. Consider logging the error or providing a more specific fallback behavior to aid in debugging.

Suggested change
} catch {
} catch (err) {
console.error("Failed to deep copy message in project tree view handler:", err);

Copilot uses AI. Check for mistakes.

tree.addEventListener('vsc-select', (event) => {
vscode.postMessage({ command: event.detail.value.cmd ? event.detail.value.cmd : "setActive", value: event.detail.value, treeData: tree.data });
const val = event.detail.value;
const isProjectClick = val && val.project && !val.build && !val.runner && !val.test && !val.cmd;
Copy link
Preview

Copilot AI Aug 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The boolean logic for detecting project clicks is complex and fragile. Consider extracting this into a named function like 'isProjectSelection(val)' to improve readability and maintainability.

Copilot uses AI. Check for mistakes.

@rijesha rijesha merged commit c8ffd5c into develop Aug 21, 2025
1 check passed
@rijesha rijesha deleted the highlighting_active_project branch August 21, 2025 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant