📂 File Reader Extension
This Visual Studio Code extension provides context menu options to read files from folders or selected files.
🚀 Features
- Read files in a selected folder.
- Read selected files.
- Apply filters to include or exclude specific files.
- View the directory structure in a tree format.
🛠️ Installation
From the Marketplace
- Open the Extensions view by pressing
Ctrl+Shift+X
.
- Search for
File Reader
in the Extensions view search box or click here.
- Click on the Install button.
- Reload the window to enable the extension.
From a VSIX file
- Clone the repository:
git clone https://github.com/ntkhang03/file-reader-extension.git
- Navigate to the project directory:
cd file-reader-extension
- Install dependencies:
npm install
- Package the extension:
npm run package
- Install the extension:
- Open the Extensions view by pressing
Ctrl+Shift+X
.
- Click on the
...
icon and choose Install from VSIX...
.
- Select the generated
.vsix
file in the out
directory.
📋 Usage
- Open the folder containing the files you want to read in VS Code.
Right-click
on a folder or selected files in the Explorer context menu.
- Choose
Read files in this folder
or Read selected files
.
- Optionally, select a filter to apply.
⚙️ Configuration
You can define filters to include or exclude specific files. Add the following configuration in your VS Code settings:
"fileReader.filters": [
{
"name": "Example Filter",
"include": ["**/*.js"], // optional - filter to include files
"exclude": ["**/node_modules/**"], // optional - filter to exclude files
"removeCommonPath": true, // optional - remove common path from file path
"outputTemplate": "=====\n{{filePath}}\n=====\n{{content}}\n" // optional - custom output template for each file
}
]
📄 Example
Here is an example of how the directory structure and file contents will be displayed:
Directory Structure:
└── folder1/
│ ├── file1.txt
│ └── subfolder1/
│ └── file2.txt
└── folder2/
│ ├── file3.txt
│ └── subfolder2/
│ ├── file4.txt
│ └── file5.txt
└── folder3/
│ └── file1.txt
└── file6.txt
└── folder4/
└── dir/
└── test.txt
================================================
File: folder1/file1.txt
================================================
<file content>
================================================
File: folder1/subfolder1/file2.txt
================================================
<file content>
...
🧑💻 Contributing
Contributions are welcome! Please open an issue or submit a pull request.
📄 License
This project is licensed under the MIT License.