Prompts Highlighting for VSCode

Highlights groups of words in your text – subjects, actions, objects, and descriptors – for quick scanning and (hopefully) better prompt engineering.
Table of Contents
Features
- Real-time Word Classification: identifies and highlights subjects, actions, objects, and descriptors in your text or prompt.
- Theme-Agnostic Highlighting: consistent coloring across different themes, making it adaptable to light, dark, and custom themes (by leveraging semantic tokens).
- ML-Powered Ambiguous Word Detection: uses a hugging face model for words that aren’t caught by straightforward heuristics.
- Local Caching: automatically downloads and caches the model so you’re not slowed down by repeated fetches.
Installation
Install from VSCode Marketplace
- Open Visual Studio Code.
- Go to the Extensions sidebar (
Ctrl+Shift+X / Cmd+Shift+X on macOS).
- Search for "Prompts Highlighting for VSCode".
- Click Install.
Alternatively, install from a VSIX
- Download the
.vsix file from the Releases or build it yourself with vsce package .
- In VSCode, press
Ctrl+Shift+P (or Cmd+Shift+P ) and run the command: Extensions: Install from VSIX... .
Usage
- Open file with code (javascript, typescript, python, golang).
- Choose a string for which you want to enable highlighting.
- Add the activation token
#!promptskeeper at the beginning of the string.
- The extension will automatically highlight words based on their classification:
- Subject (e.g., "cat", "team", "system")
- Action (e.g., "run", "build", "classify")
- Object (e.g., "documentation", "model", "data")
- Descriptor (e.g., "fast", "experimental", "robust")
It might take a moment to initialize the first time while the model is downloaded.
How It Works
Heuristic Approach
- Skip: We omit punctuation marks, words that are too short, and exception words.
- Simple classification: Words are compared against known regex patterns that often match subjects, actions, objects, or descriptors.
- Cache: If a word matches a pattern, it’s assigned immediately and stored in an in-memory cache (
PREDICTION_CACHE ).
- Model classification: Words that don’t match heuristics are batched for classification by the model (based on distilbert) via the
@xenova/transformers library.
- Cache: The result is also saved in the same
PREDICTION_CACHE .
Troubleshooting & Known Issues
- Model Offline Caching: if you move or delete the cache folder, the model will re-download on the next activation.
Release Notes
See the CHANGELOG for a complete list of changes, updates, and fixes.
License
This project is licensed under the MIT License.
| |