nix-community / vscode-nix-ide

Nix language support for VSCode editor [maintainer: @jnoortheen]
https://marketplace.visualstudio.com/items?itemName=jnoortheen.nix-ide
MIT License
309 stars 23 forks source link

Bash support in embedded code blocks of *.nix files #418

Open jnoortheen opened 2 months ago

jnoortheen commented 2 months ago
ian-h-chamberlain commented 2 months ago

For inspiration, tree-sitter-nix seems to use various prefixes to decide whether a string should be injected as bash:

Supporting the /* bash */ comments would be nice if possible, since this allows for highlighting scripts in let bindings and arbitrary function args that might not be recognized automatically, while still leaving other multi-line strings as plain strings.

Edit: it may also be feasible to use request forwarding to support arbitrary language servers, so VSCode could fall back to something like bash-lsp for highlighting/completion etc