fluid-tree-sitter 0.1.0

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
Versions:
0.1.7 2024-Sep-26
0.1.6 2024-Sep-23
0.1.5 2024-Apr-25
0.1.4 2024-Apr-25
0.1.3 2024-Apr-25
Show all 9 versions
Download Stats:
  • 32 downloads today

  • 64 downloads this week

  • 459 downloads this month

  • 1071 downloads total

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