Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to select @function.inner when Treesitter encounters an error #726

Open
arielherself opened this issue Jan 23, 2025 · 0 comments
Open
Labels
bug Something isn't working

Comments

@arielherself
Copy link

Describe the bug
Sometimes Treesitter cannot parse a statement with complex grammar, thus producing an "ERROR" node in the syntax tree. Then @function.inner doesn't treat the current function as a function.

To Reproduce
A simple example:

#include <stdio.h>

#define def(type, name) type name

int main() {
	def(int, a);
	a = 5;
}

As you can see, I pass a type name (i.e. int) as a macro argument. And this is the syntax tree shown by :InspectTree:

Image

If you type vif (under default configuration) then it selects nothing.

Expected behavior

Textobjects should include (ERROR) nodes in @function.inner.

Output of :checkhealth nvim-treesitter

nvim-treesitter: require("nvim-treesitter.health").check()

Installation ~

  • WARNING tree-sitter executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)
  • OK node found v22.12.0 (only needed for :TSInstallFromGrammar)
  • OK git executable found.
  • OK cc executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
    Version: gcc (GCC) 13.3.0
  • OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

OS Info:
{
machine = "x86_64",
release = "5.15.153.1-microsoft-standard-WSL2",
sysname = "Linux",
version = "#1 SMP Fri Mar 29 23:14:13 UTC 2024"
} ~

Parser/Features H L F I J

  • ada ✓ ✓ ✓ . ✓
  • agda ✓ . ✓ . ✓
  • angular ✓ ✓ ✓ ✓ ✓
  • apex ✓ ✓ ✓ . ✓
  • arduino ✓ ✓ ✓ ✓ ✓
  • asm ✓ . . . ✓
  • astro ✓ ✓ ✓ ✓ ✓
  • authzed ✓ . . . ✓
  • awk ✓ . . . ✓
  • bash ✓ ✓ ✓ . ✓
  • bass ✓ ✓ ✓ ✓ ✓
  • beancount ✓ . ✓ . ✓
  • bibtex ✓ . ✓ ✓ ✓
  • bicep ✓ ✓ ✓ ✓ ✓
  • bitbake ✓ ✓ ✓ ✓ ✓
  • blueprint ✓ . . . ✓
  • bp ✓ ✓ ✓ ✓ ✓
  • c ✓ ✓ ✓ ✓ ✓
  • c_sharp ✓ ✓ ✓ . ✓
  • cairo ✓ ✓ ✓ ✓ ✓
  • capnp ✓ ✓ ✓ ✓ ✓
  • chatito ✓ ✓ ✓ ✓ ✓
  • clojure ✓ ✓ ✓ . ✓
  • cmake ✓ . ✓ ✓ ✓
  • comment ✓ . . . .
  • commonlisp ✓ ✓ ✓ . ✓
  • cooklang ✓ . . . ✓
  • corn ✓ ✓ ✓ ✓ ✓
  • cpon ✓ ✓ ✓ ✓ ✓
  • cpp ✓ ✓ ✓ ✓ ✓
  • css ✓ . ✓ ✓ ✓
  • csv ✓ . . . .
  • cuda ✓ ✓ ✓ ✓ ✓
  • cue ✓ ✓ ✓ ✓ ✓
  • cylc ✓ . ✓ ✓ ✓
  • d ✓ ✓ ✓ ✓ ✓
  • dart ✓ ✓ ✓ ✓ ✓
  • desktop ✓ . ✓ . ✓
  • devicetree ✓ ✓ ✓ ✓ ✓
  • dhall ✓ . ✓ . ✓
  • diff ✓ . ✓ . ✓
  • disassembly ✓ . . . ✓
  • djot ✓ ✓ ✓ ✓ ✓
  • dockerfile ✓ . . . ✓
  • dot ✓ . . ✓ ✓
  • doxygen ✓ . . ✓ ✓
  • dtd ✓ ✓ ✓ . ✓
  • earthfile ✓ . . . ✓
  • ebnf ✓ . . . ✓
  • editorconfig ✓ . ✓ . ✓
  • eds ✓ . ✓ . .
  • eex ✓ . . . ✓
  • elixir ✓ ✓ ✓ ✓ ✓
  • elm ✓ . ✓ . ✓
  • elsa ✓ ✓ ✓ ✓ ✓
  • elvish ✓ . . . ✓
  • embedded_template ✓ . . . ✓
  • erlang ✓ . ✓ . ✓
  • facility ✓ . ✓ ✓ ✓
  • faust ✓ . . . ✓
  • fennel ✓ ✓ ✓ . ✓
  • fidl ✓ . ✓ . ✓
  • firrtl ✓ ✓ ✓ ✓ ✓
  • fish ✓ ✓ ✓ ✓ ✓
  • foam ✓ ✓ ✓ ✓ ✓
  • forth ✓ ✓ ✓ ✓ ✓
  • fortran ✓ . ✓ ✓ ✓
  • fsh ✓ . . . ✓
  • fsharp ✓ . . . ✓
  • func ✓ . . . ✓
  • fusion ✓ ✓ ✓ ✓ ✓
  • gap ✓ ✓ ✓ . ✓
  • gaptst ✓ . ✓ . ✓
  • gdscript ✓ ✓ ✓ ✓ ✓
  • gdshader ✓ . . . ✓
  • git_config ✓ . ✓ . ✓
  • git_rebase ✓ . . . ✓
  • gitattributes ✓ ✓ . . ✓
  • gitcommit ✓ . . . ✓
  • gitignore ✓ . . . ✓
  • gleam ✓ ✓ ✓ ✓ ✓
  • glimmer ✓ ✓ ✓ ✓ ✓
  • glimmer_javascript ✓ ✓ . ✓ ✓
  • glimmer_typescript ✓ . . ✓ ✓
  • glsl ✓ ✓ ✓ ✓ ✓
  • gn ✓ ✓ ✓ ✓ ✓
  • gnuplot ✓ . . . ✓
  • go ✓ ✓ ✓ ✓ ✓
  • goctl ✓ . ✓ ✓ ✓
  • godot_resource ✓ ✓ ✓ . ✓
  • gomod ✓ . . . ✓
  • gosum ✓ . . . .
  • gotmpl ✓ ✓ ✓ . ✓
  • gowork ✓ . . . ✓
  • gpg ✓ . . . ✓
  • graphql ✓ . . ✓ ✓
  • gren ✓ . . . ✓
  • groovy ✓ ✓ ✓ ✓ ✓
  • gstlaunch ✓ . . . .
  • hack ✓ . . . ✓
  • hare ✓ ✓ ✓ ✓ ✓
  • haskell ✓ ✓ ✓ . ✓
  • haskell_persistent ✓ . ✓ . .
  • hcl ✓ . ✓ ✓ ✓
  • heex ✓ ✓ ✓ ✓ ✓
  • helm ✓ ✓ ✓ . ✓
  • hjson ✓ ✓ ✓ ✓ ✓
  • hlsl ✓ ✓ ✓ ✓ ✓
  • hlsplaylist ✓ . . . ✓
  • hocon ✓ . ✓ . ✓
  • hoon ✓ ✓ ✓ . ✓
  • html ✓ ✓ ✓ ✓ ✓
  • htmldjango ✓ . ✓ ✓ ✓
  • http ✓ . . . ✓
  • hurl ✓ . ✓ ✓ ✓
  • hyprlang ✓ . ✓ ✓ ✓
  • idl ✓ . . ✓ ✓
  • ini ✓ . ✓ . ✓
  • inko ✓ ✓ ✓ ✓ ✓
  • ispc ✓ ✓ ✓ ✓ ✓
  • janet_simple ✓ ✓ ✓ . ✓
  • java ✓ ✓ ✓ ✓ ✓
  • javascript ✓ ✓ ✓ ✓ ✓
  • jq ✓ ✓ . . ✓
  • jsdoc ✓ . . . .
  • json ✓ ✓ ✓ ✓ .
  • json5 ✓ . . . ✓
  • jsonc ✓ ✓ ✓ ✓ ✓
  • jsonnet ✓ ✓ ✓ . ✓
  • julia ✓ ✓ ✓ ✓ ✓
  • just ✓ ✓ ✓ ✓ ✓
  • kconfig ✓ ✓ ✓ ✓ ✓
  • kdl ✓ ✓ ✓ ✓ ✓
  • kotlin ✓ ✓ ✓ . ✓
  • koto ✓ ✓ ✓ . ✓
  • kusto ✓ . . . ✓
  • lalrpop ✓ ✓ ✓ . ✓
  • ledger ✓ . ✓ ✓ ✓
  • leo ✓ . . ✓ ✓
  • linkerscript ✓ ✓ ✓ ✓ ✓
  • liquid ✓ . . . ✓
  • liquidsoap ✓ ✓ ✓ ✓ ✓
  • llvm ✓ . . . ✓
  • lua ✓ ✓ ✓ ✓ ✓
  • luadoc ✓ . . . .
  • luap ✓ . . . .
  • luau ✓ ✓ ✓ ✓ ✓
  • m68k ✓ ✓ ✓ . ✓
  • make ✓ . ✓ . ✓
  • markdown ✓ . ✓ ✓ ✓
  • markdown_inline ✓ . . . ✓
  • matlab ✓ ✓ ✓ ✓ ✓
  • menhir ✓ . . . ✓
  • mermaid ✓ . ✓ ✓ ✓
  • meson ✓ . ✓ ✓ ✓
  • muttrc ✓ . . . ✓
  • nasm ✓ . . . ✓
  • nginx ✓ . ✓ . ✓
  • nickel ✓ . . ✓ ✓
  • nim ✓ ✓ ✓ . ✓
  • nim_format_string ✓ . . . ✓
  • ninja ✓ . ✓ ✓ ✓
  • nix ✓ ✓ ✓ ✓ ✓
  • norg . . . . .
  • nqc ✓ ✓ ✓ ✓ ✓
  • nu ✓ . . ✓ ✓
  • objc ✓ ✓ ✓ ✓ ✓
  • objdump ✓ . . . ✓
  • ocaml ✓ ✓ ✓ ✓ ✓
  • ocaml_interface ✓ ✓ ✓ ✓ ✓
  • odin ✓ ✓ ✓ ✓ ✓
  • org . . . . .
  • pascal ✓ ✓ ✓ ✓ ✓
  • passwd ✓ . . . .
  • pem ✓ . ✓ . ✓
  • perl ✓ . ✓ . ✓
  • php ✓ ✓ ✓ ✓ ✓
  • php_only ✓ ✓ ✓ ✓ ✓
  • phpdoc ✓ . . . .
  • pioasm ✓ . . . ✓
  • po ✓ . ✓ . ✓
  • pod ✓ . . . .
  • poe_filter ✓ . ✓ ✓ ✓
  • pony ✓ ✓ ✓ ✓ ✓
  • powershell ✓ ✓ ✓ ✓ ✓
  • printf ✓ . . . .
  • prisma ✓ . ✓ . ✓
  • problog ✓ . ✓ ✓ ✓
  • prolog ✓ . ✓ ✓ ✓
  • promql ✓ . . . ✓
  • properties ✓ ✓ . . ✓
  • proto ✓ . ✓ ✓ ✓
  • prql ✓ . . . ✓
  • psv ✓ . . . .
  • pug ✓ . . . ✓
  • puppet ✓ ✓ ✓ ✓ ✓
  • purescript ✓ ✓ . . ✓
  • pymanifest ✓ . . . ✓
  • python ✓ ✓ ✓ ✓ ✓
  • ql ✓ ✓ ✓ ✓ ✓
  • qmldir ✓ . . . ✓
  • qmljs ✓ . ✓ . ✓
  • query ✓ ✓ ✓ ✓ ✓
  • r ✓ ✓ . ✓ ✓
  • racket ✓ . ✓ . ✓
  • ralph ✓ . . . ✓
  • rasi ✓ ✓ ✓ ✓ ✓
  • rbs ✓ . ✓ ✓ ✓
  • re2c ✓ ✓ ✓ ✓ ✓
  • readline ✓ . ✓ ✓ ✓
  • regex ✓ . . . .
  • rego ✓ . . . ✓
  • requirements ✓ . . . ✓
  • rescript ✓ ✓ ✓ ✓ ✓
  • rnoweb ✓ . ✓ . ✓
  • robot ✓ . ✓ ✓ ✓
  • robots ✓ . . . ✓
  • roc ✓ ✓ . . ✓
  • ron ✓ ✓ ✓ ✓ ✓
  • rst ✓ ✓ . . ✓
  • ruby ✓ ✓ ✓ ✓ ✓
  • runescript ✓ . . . ✓
  • rust ✓ ✓ ✓ ✓ ✓
  • scala ✓ ✓ ✓ . ✓
  • scheme ✓ . ✓ . ✓
  • scss ✓ . ✓ ✓ ✓
  • sflog ✓ . . . .
  • slang ✓ ✓ ✓ ✓ ✓
  • slint ✓ ✓ ✓ ✓ ✓
  • smali ✓ ✓ ✓ ✓ ✓
  • smithy ✓ . . . ✓
  • snakemake ✓ ✓ ✓ ✓ ✓
  • solidity ✓ . ✓ . ✓
  • soql ✓ . . . .
  • sosl ✓ . . . .
  • sourcepawn ✓ ✓ . . ✓
  • sparql ✓ ✓ ✓ ✓ ✓
  • sql ✓ . . ✓ ✓
  • squirrel ✓ ✓ ✓ ✓ ✓
  • ssh_config ✓ ✓ ✓ ✓ ✓
  • starlark ✓ ✓ ✓ ✓ ✓
  • strace ✓ . . . ✓
  • styled ✓ . ✓ ✓ ✓
  • supercollider ✓ ✓ ✓ ✓ ✓
  • superhtml ✓ . . . ✓
  • surface ✓ . ✓ ✓ ✓
  • svelte ✓ ✓ ✓ ✓ ✓
  • sway ✓ ✓ ✓ ✓ ✓
  • sxhkdrc ✓ . ✓ . ✓
  • systemtap ✓ ✓ ✓ . ✓
  • t32 ✓ ✓ ✓ ✓ ✓
  • tablegen ✓ ✓ ✓ ✓ ✓
  • tact ✓ ✓ ✓ ✓ ✓
  • tcl ✓ . ✓ ✓ ✓
  • templ ✓ . ✓ . ✓
  • terraform ✓ . ✓ ✓ ✓
  • textproto ✓ . ✓ ✓ ✓
  • thrift ✓ ✓ ✓ ✓ ✓
  • tiger ✓ ✓ ✓ ✓ ✓
  • tlaplus ✓ ✓ ✓ . ✓
  • tmux ✓ . . . ✓
  • todotxt ✓ . . . .
  • toml ✓ ✓ ✓ ✓ ✓
  • tsv ✓ . . . .
  • tsx ✓ ✓ ✓ ✓ ✓
  • turtle ✓ ✓ ✓ ✓ ✓
  • twig ✓ . . . ✓
  • typescript ✓ ✓ ✓ ✓ ✓
  • typespec ✓ . . ✓ ✓
  • typoscript ✓ . ✓ ✓ ✓
  • typst ✓ . ✓ ✓ ✓
  • udev ✓ ✓ . . ✓
  • ungrammar ✓ ✓ ✓ ✓ ✓
  • usd ✓ ✓ ✓ ✓ ✓
  • uxntal ✓ ✓ ✓ ✓ ✓
  • v ✓ ✓ ✓ ✓ ✓
  • vala ✓ . ✓ . ✓
  • vento ✓ . . . ✓
  • verilog ✓ . ✓ . ✓
  • vhdl ✓ . ✓ . ✓
  • vhs ✓ . . . ✓
  • vim ✓ ✓ ✓ . ✓
  • vimdoc ✓ . . . ✓
  • vrl ✓ ✓ ✓ ✓ ✓
  • vue ✓ . ✓ ✓ ✓
  • wgsl ✓ . ✓ ✓ ✓
  • wgsl_bevy ✓ . ✓ ✓ .
  • wing ✓ ✓ ✓ . ✓
  • wit ✓ . ✓ . ✓
  • xcompose ✓ ✓ . . ✓
  • xml ✓ ✓ ✓ ✓ ✓
  • xresources ✓ ✓ ✓ . ✓
  • yaml ✓ ✓ ✓ ✓ ✓
  • yang ✓ . ✓ ✓ ✓
  • yuck ✓ ✓ ✓ ✓ ✓
  • zathurarc ✓ . . . ✓
  • zig ✓ ✓ ✓ ✓ ✓
  • ziggy ✓ . . ✓ .
  • ziggy_schema ✓ . . ✓ .

Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
+) multiple parsers found, only one will be used
x) errors found in the query, try to run :TSUpdate {lang} ~

Output of nvim --version

NVIM v0.10.2
Build type: Release
LuaJIT 2.1.1713773202
Run "nvim -V1 -v" for more info

Additional context
Add any other context about the problem here.

@arielherself arielherself added the bug Something isn't working label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant