For a game I’m doing a lot of JavaScript/QuickJS coding in multi-line C++ blocks. The code looks like this:
//normal C++
void townLoad() {
makeMusic("./static/MX_TOWN_AKU.wav", "town");
PlayMusicStream(music["town"]);
init["town"] = true;
//JavaScript after this line:
qjsutil::runJs(context, R"js(
const { create, insert } = deps.gg
const { clone, without } = deps._l
log('create a grid')
let width = 22
let height = 14
const grid = create(width,height)
//huge block of JS here ...
)js");
//(back to C++)
}
So notice how even on discourse here the syntax highlighting makes JavaScript one color. So this is the behavior in Neovim/treesitter too
I was looking for even a quick hack to just write an extra line or comment to trigger syntax highlighting for my specific block(s) here. Has anyone made a plugin like that ?
The closest I’ve found is something similar for but its for code blocks in Markdown files, not specific blocks in C++.
otherwise i guess maybe need to roll sleeves up with treesitter code/architecture but at a cursory glance it looks like I wouldn’t be coding my game for a few days while I study that beheamoth; here’s hoping you have a quick fix or recommended module. Thx !