Questions tagged [treesitter]

Tree-sitter is a parser generator tool and an incremental parsing library. Use this tag for questions about how to write or compile grammars and how to use Tree-sitter's API.

81 questions
0
votes
0 answers

How to use web-tree-sitter for syntax highlighting

I am trying to use web-tree-sitter for live syntax highlighting in the browser. Setting up tree-sitter and parsing works fine, I am just not able to understand if and how syntax highlighting is supported through the JS bindings. I’ve read the…
ikosa
  • 1
  • 1
0
votes
0 answers

Copy fold then edit it Nvim

Yanking a simple fold in Nvim then pasting it will paste it in an unfolded format, but the next Nvim command will refold every possible layers. Why ? Here is an example with a GIF: Nvim folding bug I tried to change the folding method. The method…
Rekwass
  • 3
  • 3
0
votes
1 answer

Determine wether a string is a prefix of a valid string in a language

Given a string and a formal grammar I would like to determine wether a string is a valid prefix of another string that is accepted by that grammar. For example, say I was looking for valid JSON prefixes, I would like to determine that [1, 2, 3 is a…
Betlander
  • 35
  • 3
0
votes
0 answers

Treesitter: Query to search variable definition using first argument in function call

The problem is divided in 2 pieces: Search for all the function calls with the name 'run_query' and extract the first argument. Second, use the first argument to find the definition of that variable (if the first argument is a…
0
votes
0 answers

Get all lists and their elements using tree-sitter

I'm struggling with the tree-sitter query language for a few days. Let's say my end goal is to ensure every list is sorted in a given language (the parsed language isn't important here and mustn't be)). I would hope to obtain all the lists (to get…
Jérôme Pin
  • 1,363
  • 4
  • 18
  • 33
0
votes
0 answers

emacs tree-sitter doesn't highlight my *.ts Typescript files

I'm new in the emacs world and after practicing a bit with doomemacs, I'm trying to configure vanilla emacs by myself with my own init.el file. I have installer tree-sitter for syntax highlighting and works fine for JS file but not for TS files. My…
acanimal
  • 4,800
  • 3
  • 32
  • 41
0
votes
0 answers

Configure treesitter in pywal.nvim

I am currently using the AlphaTechnology/pywal.nvim plugin in order to generate the colorscheme for my Neovim configuration. The only problem I have with this is that the .html files lack much color and are quite bland. I want to be able to…
0
votes
1 answer

Is there a tree-sitter grammar for .scm file

I am working on a tree-sitter related application, hence it contains .scm files to describe my queries. I would like to run the application on the code of the application itself, but I am unable to find a tree-sitter grammar for the .scm files. Does…
GuiGeek
  • 1
  • 1
0
votes
1 answer

Why neovim plug treesitter don't work on WINDOWS?

I'm trying to use the treesitter plugin of neovim on windows, but it doesn't work, error as follows: c.so is not a valid Win32 application python.so is not a valid Win32 application I did some research which says perhaps there are something wrong…
ebynapura
  • 3
  • 1
  • 3
0
votes
1 answer

Why this tree-sitter query is capturing twice?

I don't understand why this tree-sitter query is capturing the same data twice.. How do I make it only once. Here's my bash script that I'm parsing: pkgname="potato" Here's the tree-sitter query: (program (variable_assignment name:…
Wizard28
  • 355
  • 1
  • 3
  • 12
0
votes
0 answers

ValueError: Incompatible Language version 11. Must be between 13 and 14

tried to run docly to auto generate some comments for my python code. installation went smooth: pip install -U PyYAML pip install docly however, when trying to process the first file via: docly-gen first_file.py there keeps coming the…
0
votes
1 answer

nvim treesitter compilation error while loading

This error comes while i open nvim I copied config from my old pc and pasted to new pc, the same config worked in other pc nvim-treesitter[rust]: Error during compilation /usr/bin/ld: cannot find -lstdc++
Gowtham V
  • 67
  • 1
  • 2
  • 7
0
votes
1 answer

treesitter get deeply nested child

I'm making a little script using treesitter that will extract all code blocks inside an ORG file, but only if they're under an headline with a specific property (:TANGLE:). I was able to make this query, which works, but only finds code blocks that…
Drago96
  • 1,265
  • 10
  • 19
0
votes
1 answer

How to import a local grammar in tree-sitter node?

I am currently trying to import my own created grammar in a typescript node project in the following way: import Parser = require('tree-sitter'); import Language = require('tree-sitter-own'); This throws the error: Cannot find module…
0
votes
1 answer

Negating a child node in a tree-sitter query

Given a tree-sitter tree for some HTML elements: (script_element (start_tag (tag_name)) (raw_text ; ... etc ) (end_tag …
Benny Powers
  • 5,398
  • 4
  • 32
  • 55