-
-
Notifications
You must be signed in to change notification settings - Fork 10
Updated Project view to highlight active project #172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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)); |
There was a problem hiding this comment.
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.
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 { |
There was a problem hiding this comment.
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.
} 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; |
There was a problem hiding this comment.
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.
No description provided.