fluid-tree-sitter 0.1.5

Tree Sitter integration for Fluid's CodeInput


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

FluidTreeSitter

This package provides Tree-sitter integration for Fluid, so that Tree-sitter can be used to highlight syntax in CodeInput. Compiles and links dependencies using ImportC.

Exposes Tree-sitter through the lib_tree_sitter module, and provides Fluid API in fluid.tree_sitter:

/*
"dependencies": {
    "fluid": "~>0.7"
    "fluid-tree-sitter": ">=0.0.0",
}
*/
import fluid.tree_sitter;

TSQueryError error;
uint errorOffset;

auto language = treeSitterLanguage!"json";
auto query = ts_query_new(language, queryString.ptr, queryString.length, &errorOffset, &error);
auto highlighter = new TreeSitterHighlighter(language, query);
auto editor = codeInput(highlighter);

In order to use a language with this package, parser for the language must be linked into program. Subpackage fluid-tree-sitter:d can be used to load the D language parser via ImportC — exposing queries via dQuerySource.

/*
"dependencies": {
    "fluid": "~>0.7"
    "fluid-tree-sitter": ">=0.0.0",
    "fluid-tree-sitter:d": ">=0.0.0"
}
*/
import fluid.tree_sitter;

TSQueryError error;
uint errorOffset;

auto language = treeSitterLanguage!"d";
auto query = ts_query_new(language, dQuerySource.ptr, dQuerySource.length, &errorOffset, &error);
auto highlighter = new TreeSitterHighlighter(language, query);
auto editor = codeInput(highlighter);
Authors:
  • Artha
Sub packages:
fluid-tree-sitter:smaug, fluid-tree-sitter:d
Dependencies:
fluid-tree-sitter:smaug, fluid-tree-sitter:d, fluid
Versions:
0.1.5 2024-Apr-25
0.1.4 2024-Apr-25
0.1.3 2024-Apr-25
0.1.2 2024-Apr-25
0.1.1 2024-Apr-25
Show all 7 versions
Download Stats:
  • 0 downloads today

  • 1 downloads this week

  • 12 downloads this month

  • 26 downloads total

Score:
0.2
Short URL:
fluid-tree-sitter.dub.pm