Skip to content
This repository has been archived by the owner on Dec 23, 2024. It is now read-only.

Commit

Permalink
Fix: Prevent folder opening in tree views
Browse files Browse the repository at this point in the history
  • Loading branch information
monstajoe2002 committed Nov 10, 2024
1 parent 09389e6 commit 8df0335
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to **Project Explorer** will be documented in this file.

## [0.3.1] 2024-11-10

### Fixed

- Prevent folders in the pages and layouts tree views from being opened as files when clicked. This ensures only valid files are opened, improving user experience.

## [0.3.0] 2024-3-1

### Added
Expand Down
12 changes: 7 additions & 5 deletions src/providers/layouts-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ export default class LayoutsProvider
? vscode.TreeItemCollapsibleState.Collapsed
: vscode.TreeItemCollapsibleState.None,

{
command: "vscode.open",
title: "",
arguments: [vscode.Uri.file(filePath)],
}
file.isDirectory()
? undefined
: {
command: "vscode.open",
title: "",
arguments: [vscode.Uri.file(filePath)],
}
);
fileTreeItem.resourceUri = vscode.Uri.file(filePath);
if (!file.isDirectory() && !file.name.includes("layout")) {
Expand Down
12 changes: 7 additions & 5 deletions src/providers/pages-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ export default class PagesProvider
? vscode.TreeItemCollapsibleState.Collapsed
: vscode.TreeItemCollapsibleState.None,

{
command: "vscode.open",
title: "",
arguments: [vscode.Uri.file(filePath)],
}
file.isDirectory()
? undefined
: {
command: "vscode.open",
title: "",
arguments: [vscode.Uri.file(filePath)],
}
);
fileTreeItem.resourceUri = vscode.Uri.file(filePath);
if (!file.isDirectory() && !file.name.includes("page")) {
Expand Down

0 comments on commit 8df0335

Please sign in to comment.