Skip to content

Commit ca026ed

Browse files
committed
docs: refresh readme for directive support
1 parent 5f826ca commit ca026ed

1 file changed

Lines changed: 24 additions & 18 deletions

File tree

README.md

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,34 @@
11
# AutoPathComment
22

3-
**AutoPathComment** is a Visual Studio Code extension that automatically inserts a comment at the top of your file with its **relative path** when you save. This can be useful for quickly identifying a file’s location, especially in large or multi-root workspaces.
3+
**AutoPathComment** is a Visual Studio Code extension that automatically inserts a comment at the top of your file with its **workspace-relative path** whenever you save. The path always lands immediately after any required shebangs or language directives so scripts keep working, while still giving you a quick breadcrumb to the file’s location.
44

55
## Features
66

77
- **Auto-insertion of file path on Save**
8-
Whenever you save a file in your workspace, AutoPathComment detects its relative path from the workspace root and inserts that path as a comment at the top of the file.
8+
Whenever you save, AutoPathComment detects the file’s workspace-relative path and inserts it as a top-of-file comment.
99

1010
- **Supports Popular Languages**
11-
The extension recognizes file extensions like .js, .ts, .py, .php, .java, .go, and more. It uses the appropriate comment syntax for each language (e.g., // for JavaScript, # for Python).
11+
Ships with defaults for common extensions (.js, .ts, .py, .php, .java, .go, .rb, etc.) and uses the correct single-line comment token for each. You can extend or override this map in settings.
1212

13-
- **Shebang Detection**
14-
If a file has a shebang (e.g., #!/usr/bin/env python), the extension can optionally skip or insert the path comment *after* the shebang to avoid interfering with scripts.
13+
- **Directive-aware insertion**
14+
Shebangs, Ruby magic comments (`# frozen_string_literal`, `# encoding`), Python `coding` declarations, and PHP opening tags are detected automatically. The comment is inserted right after that preamble so executables keep their required header.
1515

1616
- **No Duplicate Comments**
17-
The extension checks if the relative path comment is already present, so it doesn’t insert it again on subsequent saves.
17+
The extension checks the insertion location before writing anything, so repeated saves keep the file tidy.
1818

1919
## Requirements
2020

21-
- Visual Studio Code 1.104.0 or higher
21+
- Visual Studio Code 1.105.0 or higher
2222
- Node.js (for extension development, if building from source)
2323

2424
## Installation
2525

26-
1. **From the VS Code Marketplace** (recommended):
27-
- Search for "AutoPathComment" by publisher "icoretech" and install.
28-
29-
2. **From a VSIX file**:
30-
1. Download the `autopathcomment-<version>.vsix` file (created by `vsce package`).
26+
1. **From a VSIX file** (current distribution):
27+
1. Download the latest `autopathcomment-<version>.vsix` from the Releases tab or build one locally with `npm run package`.
3128
2. In VS Code, press `Ctrl+Shift+P` (Windows/Linux) or `Cmd+Shift+P` (macOS) and select **Extensions: Install from VSIX...**.
3229
3. Select the downloaded `.vsix` file to install.
3330

34-
3. **From Source**:
31+
2. **From Source**:
3532
1. Clone the repository or download it.
3633
2. Run `npm install`.
3734
3. Run `npm run package` or `vsce package` to create a `.vsix`.
@@ -82,15 +79,24 @@ Examples:
8279

8380
## Known Issues / Limitations
8481

85-
- **Multi-root Workspaces**: If you use multiple workspace roots, the file path is determined relative to the first matching workspace folder. If you have nested or overlapping folders, the extension may not behave as expected.
86-
- **Large Files**: The extension does not differentiate between text and binary files. If you open and save very large files, insertion still occurs (though typically with minimal overhead).
87-
- **Shebang**: Currently, if a shebang (`#!...`) is detected, the extension *skips* inserting the comment. This is to avoid breaking executable scripts.
82+
- **Multi-root Workspaces**: The file path is determined relative to the first workspace folder whose filesystem path prefixes the document. Nested or overlapping folders may require custom settings.
83+
- **Binary / Generated Files**: The extension does not discriminate between text and non-text files. Exclude generated artifacts via VS Code settings if needed.
84+
- **Comment Syntax**: Only single-line comment prefixes are supported. Add a custom mapping in settings if your language uses a different single-line token.
85+
86+
## Development
87+
88+
- Install dependencies: `npm install` (also configures the local `commit-msg` hook for Conventional Commits).
89+
- Build once: `npm run compile`
90+
- Continuous build: `npm run watch`
91+
- Run tests (VS Code integration via `@vscode/test-cli`): `npm test`
92+
- Full check (types + lint + tests): `npm run check`
8893

8994
## Contributing
9095

9196
1. Fork and clone the repo.
92-
2. Create a new branch for your feature or bugfix.
93-
3. Open a pull request describing your changes.
97+
2. Run `npm install` (sets up commit hooks locally).
98+
3. Create a new branch for your feature or bugfix.
99+
4. Open a pull request describing your changes.
94100

95101
## License
96102

0 commit comments

Comments
 (0)