DhrLang VS Code Extension
Modern language tooling for the DhrLang language: syntax highlighting, snippets, run / compile commands, diagnostics, and quality-of-life helpers.
This README now reflects the current English‑core token set (num, duo, sab, kya, any, kaam, class, static, etc.). Legacy Hindi keyword forms were removed from the language docs and are no longer advertised here.
✨ Features
🚀 Zero Config Run
- Bundled Compiler: The extension includes the DhrLang compiler. Just install and run!
- No Setup: You don't need to download the JAR separately.
- Requirement: Ensure Java 17+ is installed on your system.
🎨 Syntax Highlighting
- Accurate grammar for
.dhr files
- Highlights keywords, literals, strings, comments, classes, functions, numbers
- Updated for the simplified English‑core tokens
🧠Full Language Server (go-to-def, hover, rename, references, completion, diagnostics)
- The extension now launches the real DhrLang Language Server (
java -jar DhrLang.jar --lsp) over stdio
via vscode-languageclient, instead of the old static/in-process providers.
- Go to Definition and Find All References across the open file
- Hover with symbol/type information
- Rename Symbol (
F2) with prepareRename support
- Scope-aware Completion — suggests symbols actually in scope at the cursor (locals, parameters,
class members), not a flat keyword dump
- Diagnostics (
textDocument/publishDiagnostics) with full-span ranges and DHR-Exxx error codes
- If Java or
DhrLang.jar can't be found, the extension falls back to the older static
keyword-completion/hover and shell-out diagnostics so it still degrades gracefully instead of
crashing on activation (governed by dhrlang.enableAutoCompletion / dhrlang.enableErrorSquiggles,
which now only apply to that fallback path).
🧩 Snippets
- Snippets for: main entry, class, method, if / if-else, while, for, foreach, arrays, printLine, try/catch skeleton
🚀 Run & Compile
Ctrl+F5 Run current DhrLang file
Ctrl+Shift+B Compile / diagnostics
- Status bar indicator (auto jar detection state)
- Error squiggles (when enabled) sourced from compiler output
âš™ï¸ Configuration (Settings)
| Setting |
Description |
dhrlang.jarPath |
Explicit path to DhrLang.jar (leave blank for auto detection) |
dhrlang.autoDetectJar |
Search workspace (root & lib/) for the JAR automatically |
dhrlang.javaPath |
Java runtime executable (default java) |
dhrlang.enableAutoCompletion |
Toggle fallback keyword/snippet completion (only used if the Language Server can't start) |
dhrlang.enableErrorSquiggles |
Toggle fallback inline diagnostics (only used if the Language Server can't start) |
dhrlang.outputEncoding |
Output encoding (utf8 / utf16) |
🛠Installation
From Marketplace (Coming Soon)
Once published to the VS Code Marketplace:
- Open VS Code
- Extensions (Ctrl+Shift+X)
- Search:
DhrLang Support (publisher: dhruv-15-03)
- Install
Manual (VSIX) - Recommended
- Download
dhrlang-vscode-1.1.8.vsix from the GitHub Releases page.
- Open VS Code.
- Press
Ctrl+Shift+P (Command Palette).
- Type "Install from VSIX" and select Extensions: Install from VSIX....
- Select the downloaded
.vsix file.
🚧 Packaging / Updating the VSIX
The repository currently contains an older dhrlang-vscode-3.0.0.vsix. Rebuild to match new version:
- In
vscode-extension/ run (PowerShell):
- Install dependencies:
npm ci
- (If not installed)
npm install -g @vscode/vsce
- Compile:
npm run compile
- Package:
vsce package (produces dhrlang-vscode-1.1.4.vsix)
- (Optional) Publish:
vsce publish patch (requires a Personal Access Token and verified publisher)
🚀 Quick Start
Create Main.dhr:
class Main {
static kaam main() {
printLine("Hello, DhrLang!");
}
}
Press Ctrl+F5 to run (jar must be resolvable or dhrlang.jarPath set).
🔑 Core Tokens (Current)
| Category |
Tokens |
| Types |
num, duo, sab, kya, any |
| Flow |
if, else, for, while, return |
| OOP |
class, extends, static |
| Functions |
kaam (method/function indicator) |
| Built‑ins (examples) |
printLine, arrayLength |
Language feature status is tracked in the main docs (README/SPEC).
📦 Snippet Prefix Samples
| Prefix |
Expands To |
mainc |
Main class + entry method skeleton |
main |
Only main method skeleton |
pl |
printLine("..."); |
if / ife |
If / If‑Else block |
for / foreach |
Loop templates |
while |
While loop |
class |
Class skeleton |
kaam |
Method skeleton |
🧪 Troubleshooting
| Issue |
Cause |
Fix |
| Extension not found in search |
Not yet published or caching delay |
Install via VSIX manually |
| Run command says JAR not found |
Auto-detect failed |
Set dhrlang.jarPath explicitly |
| No completions |
Auto completion disabled |
Enable dhrlang.enableAutoCompletion |
| No diagnostics |
Error squiggles off or compile failed |
Enable setting / check terminal output |
📚 Links
- Core README – language overview
- Tutorials – stepwise examples
- Examples – curated sample programs
- Issues / Discussions – feedback & support
🤠Contributing
See the project CONTRIBUTING guidelines. PRs to improve grammar, diagnostics, or snippets are welcome.
📄 License
MIT License – see repository root LICENSE.
Happy hacking with DhrLang!
| |