tree-sitter-slint

Crates.iotree-sitter-slint
lib.rstree-sitter-slint
version
sourcesrc
created_at2023-01-17 01:20:07.374742
updated_at2024-12-12 07:31:44.16285
descriptionA tree-sitter parser for Slint
homepage
repositoryhttps://github.com/slint/slint-ui/tree/master/editors/tree-sitter-slint
max_upload_size
id760726
Cargo.toml error:TOML parse error at line 25, column 1 | 25 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Tobias Hunger (hunger)

documentation

README

tree-sitter support for SLint

Tree-sitter is a parser generator tool and an incremental parsing library. It can build a concrete syntax tree for a source file and efficiently update the syntax tree as the source file is edited.

                                            (taken from tree-sitter page)

Use with vim/helix/... other editors.

Inject into Rust

This tree-sitter configuration can be injected into rust, so that the slint! macro gets highlighted.

In neovim with the nvim-treesitter plugin this is done with the

:TSEditQueryUserAfter injections rust to create/edit the rust injection configuration. Copy and paste this into the new file:

;; Inject the slint language into the `slint!` macro:
(macro_invocation
  macro: [
    (
      (scoped_identifier
        path: (_) @_macro_path
        name: (_) @_macro_name
      )
    )
    ((identifier) @_macro_name @macro_path)
  ]
  ((token_tree) @injection.content
  (#eq? @_macro_name "slint")
  (#eq? @_macro_path "slint")
  (#offset! @injection.content 0 1 0 -1)
  (#set! injection.language "slint")
  (#set! injection.combined)
  (#set! injection.include-children)
  )
)

Please send PRs when you find out how to do the same with other editors.

Commit count: 0

cargo fmt