easy-dotnet.nvim
easy-dotnet.nvim copied to clipboard
feat:🎁 tree-sitter injections
Hi, I want to write tree-sitter language injections to work with sql, json and xml strings that are in a .cs file. Like for example in this plugin https://github.com/ray-x/go.nvim/tree/master/after/queries/go.
What do you think about including them in your plugin? I'm planning to make an analog of language injections like in Rider https://www.jetbrains.com/help/rider/Language_Injections.html#use-comments so that this sql string will be correctly highlighted:
//language=sql
var someQuery = "select * from user where id = 0";
with fallback options that will work based on regexp.
Implementation
test c# project with some strings: https://github.com/molostovvs/TreeSitterCsharpInjectionsTestProject
todo:
strings
string | sql | json | xml |
---|---|---|---|
quoted | ✅ | ❌ | ❌ |
verbatim | ✅ | ❌ | ❌ |
raw | ✅ | ✅ | ✅ |
regexp quoted | ❌ | ❌ | ❌ |
regexp verbatim | ❌ | ❌ | ❌ |
regexp raw | ❌ | ❌ | ❌ |
interpolated strings
interpolated string | json | xml |
---|---|---|
quoted | ❌ | ❌ |
verbatim | ❌ | ❌ |
raw | ❌ | ❌ |
regexp quoted | ❌ | ❌ |
regexp verbatim | ❌ | ❌ |
regexp raw | ❌ | ❌ |