refactor - #3
Merged
Merged
refactor#3
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enhances the extension’s UX around image usage by surfacing “used vs unused” status in the explorer (via file decorations) and by making image tree entries more descriptive. It also removes a markdown test reference file and adjusts the debug launch configuration.
Changes:
- Update image tree node descriptions to show which files reference an image (or mark it as unused).
- Add a
FileDecorationProviderto badge images as used/unused in the explorer. - Remove the debug
preLaunchTaskfrom.vscode/launch.json(affects local debugging workflow).
Reviewed changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/imageTreeProvider.ts |
Changes image node descriptions to list referencing files instead of ref counts. |
src/imageDecorationProvider.ts |
New provider that computes used/unused images and returns explorer decorations. |
src/extension.ts |
Registers the decoration provider during activation and disposes it on deactivation. |
.vscode/launch.json |
Removes preLaunchTask from the extension host debug configuration. |
test-reference.md |
Deletes a markdown test/reference file. |
test-images/hola.png |
Adds a new test image asset. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+70
to
+72
| node.description = item.references.length > 0 | ||
| ? `in: ${[...new Set(item.references.map(r => path.basename(r.file.fsPath)))].join(', ')}` | ||
| : 'unused'; |
Comment on lines
+24
to
+40
| const changed: vscode.Uri[] = []; | ||
|
|
||
| for (const img of images) { | ||
| const key = img.uri.toString(); | ||
| if (img.references.length > 0) { | ||
| this.usedImages.add(key); | ||
| } | ||
| if (this.usedImages.has(key) !== prev.has(key)) { | ||
| changed.push(img.uri); | ||
| } | ||
| } | ||
|
|
||
| for (const key of prev) { | ||
| if (!this.usedImages.has(key)) { | ||
| changed.push(vscode.Uri.parse(key)); | ||
| } | ||
| } |
Comment on lines
+14
to
+18
| decorationProvider = new ImageDecorationProvider(scanner); | ||
|
|
||
| context.subscriptions.push( | ||
| vscode.window.registerFileDecorationProvider(decorationProvider) | ||
| ); |
Comment on lines
+14
to
+18
| decorationProvider = new ImageDecorationProvider(scanner); | ||
|
|
||
| context.subscriptions.push( | ||
| vscode.window.registerFileDecorationProvider(decorationProvider) | ||
| ); |
Comment on lines
15
to
+17
| "outFiles": [ | ||
| "${workspaceFolder}/dist/**/*.js" | ||
| ], | ||
| "preLaunchTask": "${defaultBuildTask}" | ||
| ] |
Comment on lines
+13
to
+17
| constructor(private scanner: ImageScanner) { | ||
| this.disposables.push( | ||
| this.scanner.onDidChange(() => this.refresh()) | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.