fluid-tree-sitter 0.2.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);
- 0.2.0 released a day ago
- Samerion/FluidTreeSitter
- BSL
- Copyright © 2024, Artha
- Authors:
- Sub packages:
- fluid-tree-sitter:tree-sitter, fluid-tree-sitter:smaug, fluid-tree-sitter:d
- Dependencies:
- fluid
- Versions:
-
0.2.0 2024-Nov-20 0.1.7 2024-Sep-26 0.1.6 2024-Sep-23 0.1.5 2024-Apr-25 0.1.4 2024-Apr-25 - Download Stats:
-
-
36 downloads today
-
118 downloads this week
-
410 downloads this month
-
1125 downloads total
-
- Score:
- 3.0
- Short URL:
- fluid-tree-sitter.dub.pm