DariusCorvus / tree-sitter-language-injection.nvim

A NVIM Plugin which applies inline language injections, when a string contains a comment with the language name.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

typescript_inline_sql

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

typescript_above_sql

Supported Languages

  • python
    • comment inline
      • sql
      • surrealdb
  • typescript
    • comment inline
      • sql
      • surrealdb
    • comment above
      • sql
      • surrealdb
  • javascript
    • comment inline
      • sql
      • surrealdb
    • comment above
      • sql
      • surrealdb

About

A NVIM Plugin which applies inline language injections, when a string contains a comment with the language name.


Languages

Language:Lua 100.0%