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

Commit

Permalink
Add Project Explorer feature and fix known issue
Browse files Browse the repository at this point in the history
  • Loading branch information
monstajoe2002 committed Nov 23, 2023
1 parent e9f9ffa commit 17cd76c
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 8 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ With the introduction of [Next.js 13](https://nextjs.org/), the `app` directory

## Features

Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file.
You can access the Project Explorer through the command palette (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) by searching for `Project Explorer`. This allows you to search for, create and delete page and layout files.

For example if there is an image subfolder under your extension project workspace:
![Alt text](src\assets\features\command-palette.gif)

\!\[feature X\]\(images/feature-x.png\)

> Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow.
You can also access the Project Explorer through the sidebar. This allows you to search for and delete page and layout files. However, you can also rename file paths through the sidebar.
![Alt text](src\assets\features\treeview.gif)

## Requirements

This extension works in Next.js 13 projects with `app` directory enabled **only**.

## Known Issues

Calling out known issues can help limit users opening duplicate issues against your extension.
When you delete a file through the command palette, VS Code will through an error saying that the file is not found. *See screenshot below*. This is a known issue with VS Code and is not related to this extension.
![Alt text](delete-error.png)

## Release Notes

Expand Down
Binary file added delete-error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
"categories": [
"Other"
],
"repository": {
"type": "git",
"url": "https://github.com/monstajoe2002/project-explorer.git"
},
"activationEvents": [],
"main": "./out/extension.js",
"contributes": {
Expand Down
Binary file added src/assets/features/command-palette.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/features/treeview.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/commands/nextjs-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export default class NextJsCommand implements Command {
this.commandId = `project-explorer.${name}`;
}
async deletePageOrLayout(uri: vscode.Uri): Promise<void> {
// TODO: group option by folder level
const items = await this._getQuickPickOptions(uri);

const selectedItem = await vscode.window.showQuickPick(items, {
Expand All @@ -20,6 +19,7 @@ export default class NextJsCommand implements Command {
return;
}
const selectedUri = vscode.Uri.joinPath(uri, selectedItem.fileName);
console.log(selectedUri);
if (!selectedItem.isDirectory) {
const option = await vscode.window.showWarningMessage(
"Are you sure you want to delete this file?",
Expand All @@ -32,6 +32,7 @@ export default class NextJsCommand implements Command {
await vscode.workspace.fs.delete(selectedUri, {
useTrash: true,
});
vscode.window.showInformationMessage(`Deleted ${selectedItem.fileName}`);
}

await this.deletePageOrLayout(selectedUri);
Expand Down
3 changes: 2 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ export function activate(_: vscode.ExtensionContext) {
vscode.window.createTreeView("projectExplorer.layouts", {
treeDataProvider: layoutsTree,
});
vscode.commands.registerCommand("next-project-explorer.tree.refresh", () => {
vscode.commands.registerCommand("project-explorer.tree.refresh", () => {
pagesTree.refresh();
layoutsTree.refresh();
});
vscode.commands.registerCommand(
"project-explorer.tree.delete",
Expand Down

0 comments on commit 17cd76c

Please sign in to comment.