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
1
vote
1 answer

make treesitter match classname

I am using Treesitter to parse Clojure code. Specifically I would like to distinguish between symbols, class names and Java Interop. This is my grammar: module.exports = grammar({ name: 'clojure', extras: $ => [/[\s,]/], rules: { …
Kolja
  • 2,667
  • 1
  • 30
  • 29
0
votes
1 answer

How to make spacemacs stop using treesitter mode

I was curious about treesitter so I tried it. I figured out that python-ts-mode has not much features so I want to go back. But spacemacs now loads all .py files with python-ts-mode. I want that it uses python instead. I tried to do this, it does…
Harm
  • 109
  • 9
0
votes
1 answer

Treesitter text-object to capture jupyter cell expression #%%

can a neovim guru help create a treesitter query which matches '#%%' pattern in python files? I use #%% inside my python files to quickly jump between code blocks. It also helps if i convert the .py file to .ipynb, in that it uses the ``#%%```…
Maelstorm
  • 580
  • 2
  • 10
  • 29
0
votes
1 answer

What Should I Do to Fix Unknown Error was Caused by Treesitter

When I use Neovim with treesitter plugin to edit lua file, it show these error info Error detected while processing BufNewFile Autocommands for "*": Error executing lua callback: C:\Program Files\Neovim\share\nvim\runtime\filetype.lua:21: Error…
0
votes
1 answer

how to understand from where a function call is made?

I am using TreeSitter to parse python code. I need to understand check_files_in_directory is invoked from GPT4Readability.utils. I already captured all the function calls. I have to do this programatically. But now I have to find out from which file…
Exploring
  • 2,493
  • 11
  • 56
  • 97
0
votes
0 answers

Using Tree Sitter, How to disable extras in string literal?

I am writing a Tree-Sitter grammar, I want to include escape sequences as child nodes within string literals, but I also want to avoid matching comments as extras within string literals. The input "https://example.com" is not parsed correctly…
uben
  • 1,221
  • 2
  • 11
  • 20
0
votes
0 answers

SPL (Shakespear Programming Language) highlighting for NeoVim

I'm a bit new to TreeSitter and I have been recently trying to create a syntax highlighting for NeoVim for this esoteric language called SPL. I have tried installing the nvim plugin treesitter-playground and it works, but not with SPL language. It…
notcarl
  • 11
  • 2
0
votes
1 answer

Problem with YAML on Lunar VIM in Windows

Hello I was 3 hours trying to solve this issue by my own but I did not arrive in a solution, everytime that I open a project with yaml give this error: Error executing vim.schedule lua callback: Failed to load parser for language 'yaml': uv_dlopen:…
0
votes
0 answers

Tree sitter looking ahead, failing, but not reversing and trying another path

I'm writing a tree sitter grammar. It is parsing this code using one path until it hits an error, but instead of backtracking and trying another, it just says "error" and moves on to the next section to try and parse it. Here is the problem…
user1713450
  • 1,307
  • 7
  • 18
0
votes
1 answer

Tree sitter query: optionally step into a node

I want to extract all function names from some C++ source code via a tree_sitter query. (link to playground Here is my query: (function_definition declarator: [ (reference_declarator (function_declarator declarator: (_) @name)) …
Ari Sweedler
  • 807
  • 7
  • 25
0
votes
0 answers

Is there a way to use the language server to make neovim show the path to the current symbol?

When editing or diffing a large json file, I'd love to see the path to the current node (the symbol under the cursor) like VS Code provides. In fact every good IDE does this, but they don't all have JSON support. In VS and VS Code, the path to the…
piojo
  • 6,351
  • 1
  • 26
  • 36
0
votes
0 answers

How to add modules in treesitter neovim?

I'm trying to install treesitter nvim.I do everything according to the documentation, but nothing works. google does not provide any useful information on these errors. My packer.lua file: vim.cmd [[packadd packer.nvim]] return…
0
votes
0 answers

I have this error with tresitter and neovim "Failed to load parser for lenguage 'html': uv_dlopen: dont found the specified process"

I don't know the reason for the error, previously it worked normally. It is also happening to me with ".yaml. Can someone tell me what I can try or how to fix it? I have found similar errors but with .cpp although they have not helped me at all.…
0
votes
0 answers

In JSX and TSX files, while using ts:get_node(), I'm getting error there is no parser for javascriptreact

Using luasnip in neovim I created a snippet that creates console.log with function name local luasnip = require("luasnip") local sn = luasnip.snippet local t = luasnip.text_node local s = luasnip.snippet_node local d = luasnip.dynamic_node local fmt…
Herob
  • 1
  • 1
0
votes
0 answers

How to write a treesitter query that matches only if import is present

I use nvim and nvim-treesitter, and I want to apply syntax highlighting to SQL strings in elixir files. But only when the corresponding SQL function is imported, since I don't want to match any 'ol function that is named execute. E.g. defmodule…
Link0
  • 655
  • 5
  • 17