Official Language Server and Syntax Highlighting for the LOVE Metalang compiler.
Features
- Triadic Syntax Highlighting: Follows the ROYGBIV color philosophy. String boundaries (
<...>, "...") are colored normally, while embedded ornaments like ::tags pop independently.
- Full Extension Support: Natively registers highlighting for
.love, .skill, .job, .template, .rule, .model, .main, .language, .secret, .command, .error, .log, .prompt, .programme, .test, .persona, .fact, .context, .lang.
- Active Language Server (LSP): Evaluates deterministic natural language ASTs. Rejects esoteric dialects (e.g.
SATOR, caveman) and enforces strict Triadic Logic (Firstness, Secondness, Thirdness).
Next Steps: Tree-Sitter & Autocompletion
To enhance the LSP with real-time autocompletion, a Tree-sitter grammar should be integrated into the server.
- Compile the Grammar:
Write your
tree-sitter-love grammar (defining nodes for Firstness, #INVARIANT, etc.) and compile it via tree-sitter generate.
- Bind to Node.js LSP:
In
server/src/server.ts, import web-tree-sitter:
import Parser from 'web-tree-sitter';
await Parser.init();
const parser = new Parser();
const Lang = await Parser.Language.load('path/to/tree-sitter-love.wasm');
parser.setLanguage(Lang);
- Parse and Provide Completions:
On every document change (
documents.onDidChangeContent), pass the text through parser.parse(text).
In connection.onCompletion(), traverse the Tree-sitter AST to determine if the cursor is inside a string or global scope, and return the relevant @::tags or keywords!
Uploading to the VS Code Marketplace
Once the Tree-sitter LSP is finalized, you can officially publish this to the Microsoft Marketplace:
- Get a Personal Access Token (PAT)
- Go to Azure DevOps.
- Create a PAT with the scope
Marketplace (Publish).
- Create a Publisher
- Login via VSCE
- Run
npx @vscode/vsce login love-lang-foundation
- Paste your PAT when prompted.
- Publish!
- Run
npx @vscode/vsce publish
- Within 5 minutes,
LOVE Metalang will be live in the extension tab for anyone in the world to download!
| |