Syntax highlighting for the Loci DSL used to describe rules, data dependencies, and computation steps in Loci-based applications.
- Loci directives and declarations like
$include,$type, type names, storage kinds (store,storeVec,param,Map,MapVec,blackbox,Constraint, etc.), and$ruleforms (pointwise,singleton,apply,unit,default,optional,constraint,blackbox). - Rule modifiers and helpers:
constraint(...),conditional(...),option(...),inplace(...),parametric(...),comments(...),prelude/compute/postlude, Loci reduction tags ([Loci::Summation]), constants likeEMPTY/UNIVERSE. $-prefixed variables (including$variable{n=0}) and Loci namespace calls (Loci::load_module,Loci::makeQuery, etc.).- Comments (
//,/* */), string and numeric literals, and the<-ci->,<-,->arrows used in rule heads. - Mixed Loci/C++: unmatched content falls back to the built-in C++ grammar, especially inside
{ ... }blocks.
- Install the extension, open a
.locifile, and confirm the status bar shows Loci DSL. Colors come from your theme; this extension provides scopes. - If VS Code doesn’t auto-detect, switch the language mode to Loci DSL manually.
- Open user settings JSON:
Preferences: Open User Settings (JSON)or edit:- Linux:
$HOME/.config/Code/User/settings.json - macOS:
$HOME/Library/Application Support/Code/User/settings.json - Windows:
%APPDATA%\\Code\\User\\settings.json
- Linux:
- Add or merge:
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "keyword.control.rule-statement.loci",
"settings": { "fontStyle": "bold" }
},
{
"scope": "support.function.rule-kind.loci",
"settings": { "fontStyle": "italic" }
},
{
"scope": "entity.name.function.rule-output.loci",
"settings": { "foreground": "#ffcc66" }
},
{
"scope": "variable.parameter.rule-input.loci",
"settings": { "foreground": "#82aaff" }
}
]
}- Adjust colors to taste. These scopes come from
syntaxes/loci.tmlLanguage.jsonand override your theme for Loci files.
$rulekeyword and rule kind (pointwise,singleton,apply,unit,default,optional,constraint,blackbox).- Rule head: outputs before the rightmost
<-, inputs after it; the arrow is highlighted separately. - Trailing modifiers:
constraint(...),conditional(...),inplace(...),option(...),parametric(...),comments(...); markers likeprelude,compute,postlude.
$include "flowPsi.lh"
$type solution store<real> ;
$type stop_iter param<int> ;
$rule default(stop_iter) { $stop_iter = 1000 ; }
$rule pointwise(dtcfl<-dtmax) {
$dtcfl = real($dtmax) ;
}
$rule apply(cl->qresidual<-qdot)[Loci::Summation],
constraint(cl->geom_cells) {
join($cl->$qresidual, $qdot) ;
}
- Prereqs: Node.js 20+ for
vscepackaging/publishing, npm. Node 18 is enough fornpm installandnpm run compile, butnpx @vscode/vsce package,login, andpublishcurrently fail there withReferenceError: File is not defined. - Install deps:
npm install - Build once:
npm run compile(ornpm run watchwhile developing) - Run in VS Code: open the folder, press Run and Debug (F5) and pick Run Extension; reload the Extension Development Host after edits. For a faster loop, run
npm run watchin the main window while using F5 to reload. - Package a VSIX (share/install locally):
npm install
npm run compile
npx @vscode/vsce package- Outputs
loci-syntax-<version>.vsix; install viacode --install-extension loci-syntax-*.vsix. - If
vscewarns about a missingrepositoryfield, add your Git repo URL topackage.jsonor pass--allow-missing-repository.
- Publisher for this repo:
StreamlineNumerics(seepackage.json). - Before publishing, bump the extension version in
package.json. - Use Node.js 20+ for the publish step. Current
@vscode/vscein this repo declaresnode >= 20, and Node 18 fails duringvsce login/package/publish. - Create or confirm a Visual Studio Marketplace publisher named
StreamlineNumerics. - Create an Azure DevOps personal access token with Marketplace
Managepermission. - Log in once on this machine:
npx @vscode/vsce login StreamlineNumerics- Publish a new version directly:
npm install
npm run compile
npx @vscode/vsce publish- Or publish while bumping the version automatically:
npx @vscode/vsce publish patchnpx @vscode/vsce publish minornpx @vscode/vsce publish major- If you prefer uploading through the website instead of direct CLI publish:
npm install
npm run compile
npx @vscode/vsce package- Then upload the generated
.vsixathttps://marketplace.visualstudio.com/manage/publishers/. - Official docs:
https://code.visualstudio.com/api/working-with-extensions/publishing-extension
- Adjust scopes in
syntaxes/loci.tmlLanguage.json. - Update
language-configuration.jsonif bracket or comment behavior changes. - Provide example snippets/screenshots in this README to showcase improvements.
- 0.1.0 — Expand grammar coverage, add language activation, and document install/usage.
- 0.0.1 — Initial scaffold.