diff --git a/CHANGELOG.md b/CHANGELOG.md index 733ce14..8d13b2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/providers/layouts-provider.ts b/src/providers/layouts-provider.ts index b91a505..e04875c 100644 --- a/src/providers/layouts-provider.ts +++ b/src/providers/layouts-provider.ts @@ -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")) { diff --git a/src/providers/pages-provider.ts b/src/providers/pages-provider.ts index d36e571..5d99b4f 100644 --- a/src/providers/pages-provider.ts +++ b/src/providers/pages-provider.ts @@ -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")) {