tree-sitter-language-injection.nvim
A NVIM Plugin which applies inline language injections, when a string contains a comment with the language name.
Installation
Packer
use({"dariuscorvus/tree-sitter-language-injection.nvim", after="nvim-treesitter"})
Setup
require("tree-sitter-language-injection").setup()
Features
Comment Inline
When a string is found, and the first line is language specifc comment, for the desired language, followed by the language name, syntax highlighting gets applied.
as example we use the language typescript
and want that the string gets highlighted as sql
const select = `
--sql
SELECT * FROM user
WHERE active = 1
`;
which results in
Comment Above
When a comment is found above a variable, and starts with the name of the desired language, syntax highlighting gets applied.
as example we use the language typescript
and want that the string gets highlighted as sql
// sql
const select = `
SELECT * FROM user
WHERE active = 1
`;
which results in
Supported Languages
- python
- comment inline
sql
surrealdb
- comment inline
- typescript
- comment inline
sql
surrealdb
- comment above
sql
surrealdb
- comment inline
- javascript
- comment inline
sql
surrealdb
- comment above
sql
surrealdb
- comment inline