typescript-plugin-huggingface
v1.0.0
Published
TypeScript language service plugin that autocompletes Hugging Face GGUF model URIs
Maintainers
Readme
typescript-plugin-huggingface
TypeScript language service plugin that autocompletes Hugging Face GGUF model URIs as you type.
When you write a string starting with hf://owner/repo/, the plugin fetches the repo's file tree from Hugging Face and offers completions for every .gguf file it finds.
Install
npm install -D typescript-plugin-huggingfaceSetup
1. Register the plugin
Add the plugin to your tsconfig.json:
{
"compilerOptions": {
"plugins": [{ "name": "typescript-plugin-huggingface" }]
}
}2. Use the workspace TypeScript version
Create or edit .vscode/settings.json:
{
"editor.quickSuggestions": {
"strings": true
},
"typescript.tsdk": "node_modules/typescript/lib"
}Then open the command palette and run TypeScript: Select TypeScript Version → Use Workspace Version.
3. Reload
Restart your editor / reload the window for the plugin to load.
Usage
Start typing a Hugging Face URI inside any string literal:
const model = "hf://TheBloke/Llama-2-7B-GGUF/";
// ^ completions appear hereThe plugin resolves owner/repo, fetches its file tree, and shows all .gguf files as completion items. Results are cached in memory and on disk ($TMPDIR/typescript-plugin-huggingface/) for 24 hours.
Authentication
For private or gated repos, provide a Hugging Face token via one of:
| Method | Example |
|---|---|
| Plugin config | "plugins": [{ "name": "typescript-plugin-huggingface", "hfToken": "hf_..." }] |
| HF_TOKEN env var | export HF_TOKEN=hf_... |
| HUGGING_FACE_HUB_TOKEN env var | export HUGGING_FACE_HUB_TOKEN=hf_... |
The plugin checks them in the order listed above.
Requirements
- Node.js ≥ 18
- TypeScript ≥ 5.0
License
MIT
