Skip to content

Commit

Permalink
Exclude 'unused-images' and 'node_modules' directories during file se…
Browse files Browse the repository at this point in the history
…arch (#7)
  • Loading branch information
therainisme committed Jan 14, 2025
1 parent bd9c598 commit ebff505
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## 1.1.1

- Fix regex to handle filenames with spaces correctly (#6)
- Exclude 'unused-images' and 'node_modules' directories during file search (#7)

## 1.1.0

- Implement concurrent markdown scanning and parallel image movement.
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "clear-markdown-unused-images",
"displayName": "Clear Markdown Unused Images",
"description": "This extension moves unused images in Markdown files to the 'unused-images' folder.",
"version": "1.1.0",
"version": "1.1.1",
"engines": {
"vscode": "^1.85.2"
},
Expand Down
5 changes: 4 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ export function activate(context: vscode.ExtensionContext) {
try {
// Step 1: Find all image files in the workspace
progress.report({ message: 'Finding image files...', increment: 5 });
const images = await vscode.workspace.findFiles('**/*.{png,jpg,jpeg,gif,bmp,tiff,webp,svg}');
const images = await vscode.workspace.findFiles(
'**/*.{png,jpg,jpeg,gif,bmp,tiff,webp,svg}',
'{**/unused-images/**,**/node_modules/**}' // Exclude unused-images and node_modules directories
);
const imagePathsSet = new Set<string>(images.map(image => path.normalize(image.fsPath)));
const totalImages = imagePathsSet.size;

Expand Down

0 comments on commit ebff505

Please sign in to comment.