Skip to content

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

Notifications You must be signed in to change notification settings

DariusCorvus/tree-sitter-language-injection.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages