Add Project Directories Scanning#6
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds the ability to scan custom project directories in addition to VS Code's recent workspaces, allowing users to discover projects that haven't been opened in VS Code yet.
Key changes:
- New directory scanning module that reads subdirectories from configured paths
- User-configurable "Project Directories" setting accessible via Alfred's Configure menu
- Automatic deduplication to merge scanned projects with VS Code recent workspaces
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
lib/directory-scanner.mjs |
New module implementing directory scanning and path expansion logic |
index.js |
Integrates directory scanner with existing workspace fetching and implements deduplication |
info.plist |
Adds user configuration UI for project directories with textarea input |
build.bash |
New build script to package the workflow as .alfredworkflow file |
README.md |
Documents the new Project Directories configuration feature |
.gitignore |
Adds pattern to ignore generated .alfredworkflow files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| .filter((entry) => entry.isDirectory() && !entry.name.startsWith('.')) | ||
| .map((entry) => { | ||
| const fullPath = join(dirPath, entry.name); | ||
| const folderUri = `file://${fullPath}`; |
There was a problem hiding this comment.
The file URI format is missing the required third slash for absolute paths. The correct format should be file:///${fullPath} (with three slashes) to properly represent an absolute path on Unix-like systems. The current format file://${fullPath} will result in file:///path/to/project being generated as file://path/to/project, which is invalid.
| const folderUri = `file://${fullPath}`; | |
| const folderUri = `file:///${fullPath}`; |
| @@ -110,6 +110,31 @@ code -n --folder-uri "$1"</string> | |||
| <string># Alfred Visual Studio Code Workspace Workflow | |||
|
|
|||
| For furher details see https://github.com/phartenfeller/alfred-vscode-workspaces</string> | |||
There was a problem hiding this comment.
Spelling error: 'furher' should be 'further'.
| For furher details see https://github.com/phartenfeller/alfred-vscode-workspaces</string> | |
| For further details see https://github.com/phartenfeller/alfred-vscode-workspaces</string> |
|
|
||
| echo "Done! Created: $WORKFLOW_NAME" | ||
|
|
||
| open "$SCRIPT_DIR/$WORKFLOW_NAME" |
There was a problem hiding this comment.
The build script automatically opens the generated workflow file at the end, which may not be desirable in all contexts (e.g., CI/CD pipelines or when running multiple builds). Consider making this optional or removing it to avoid unexpected behavior.
| open "$SCRIPT_DIR/$WORKFLOW_NAME" | |
| # Optionally open the generated workflow. Set OPEN_WORKFLOW=0 to disable. | |
| if [[ "${OPEN_WORKFLOW:-1}" == "1" ]]; then | |
| open "$SCRIPT_DIR/$WORKFLOW_NAME" | |
| fi |
| function expandHome(filepath) { | ||
| if (filepath.startsWith('~/')) { | ||
| return join(homedir(), filepath.slice(2)); | ||
| } | ||
| return filepath; | ||
| } |
There was a problem hiding this comment.
The expandHome function only handles paths starting with '/' but doesn't handle a standalone ''. If a user enters just '' as a directory path, it will not be expanded to the home directory and will be treated as a literal '' directory in the current working directory.
add ability to scan configured directories for projects in addition to VS Code recent workspaces. includes build script for workflow packaging and user configuration via Alfred's Configure Workflow.
|
Thanks for the contribution @pdegeeter ! Could you elaborate a bit the need of such a feature? |
Summary
Add ability to scan custom directories for projects in addition to VS Code recent workspaces.
Features
projects_directoriesconfiguration option accessible via Alfred's "Configure..." menuConfiguration
~/Projects
~/Work
~/GitHub
Changes
lib/directory-scanner.mjsindex.jsinfo.plistbuild.bash.alfredworkflowREADME.md.gitignore