Unable to jump to custom text objects of injected languages.

Open
#479 0 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
markdown
Domain
tooling

Research direction

Reproduce the issue in a markdown file using the custom (inline_link (link_text)@link.inner)@link.outer capture, and review the reported :checkhealth nvim-treesitter output. The work is done when jumping to both captures works in an injected markdown language without changing the filetype.

Written by the indexing model from the issue text.

Description

bug

Describe the bug
I am unable to jump to text objects from an injected language.

To be specific: Inside a markdown file I want to jump to an inline_link node.

From my understanding, the markdown treesitter grammar is split into markdown and markdown_inline.
I am able to jump to a custom capture with inline_link once I set the filetype to markdown_inline but this breaks my setup.

To Reproduce
Steps to reproduce the behavior:

  1. Open a markdown file
  2. Create a custom capture like: (inline_link (link_text)@link.inner)@link.outer
  3. See that you can't jump to link.inner or link.outer

Expected behavior
A clear and concise description of what you expected to happen.

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)
  • WARNING node executable not found (only needed for :TSInstallFromGrammar, not required for :TSInstall)
  • OK git executable found.
  • OK cc executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
    Version: gcc (GCC) 12.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 = "6.1.37",
sysname = "Linux",
version = "#1-NixOS SMP PREEMPT_DYNAMIC Sat Jul 1 11:16:27 UTC 2023"
} ~

Parser/Features H L F I J

  • ada ✓ ✓ ✓ . .
  • agda ✓ . ✓ . .
  • arduino ✓ ✓ ✓ ✓ ✓
  • astro ✓ ✓ ✓ ✓ ✓
  • awk ✓ . . . ✓
  • bash ✓ ✓ ✓ . ✓
  • bass ✓ ✓ ✓ ✓ ✓
  • beancount ✓ . ✓ . .
  • bibtex ✓ . ✓ ✓ .
  • bicep ✓ ✓ ✓ ✓ ✓
  • blueprint ✓ . . . .
  • c ✓ ✓ ✓ ✓ ✓
  • c_sharp ✓ ✓ ✓ . ✓
  • capnp ✓ ✓ ✓ ✓ ✓
  • chatito ✓ ✓ ✓ ✓ ✓
  • clojure ✓ ✓ ✓ . ✓
  • cmake ✓ . ✓ ✓ .
  • comment ✓ . . . .
  • commonlisp ✓ ✓ ✓ . .
  • cooklang ✓ . . . .
  • corn ✓ ✓ ✓ ✓ .
  • cpon ✓ ✓ ✓ ✓ ✓
  • cpp ✓ ✓ ✓ ✓ ✓
  • css ✓ . ✓ ✓ ✓
  • cuda ✓ ✓ ✓ ✓ ✓
  • cue ✓ ✓ ✓ ✓ ✓
  • dart ✓ ✓ ✓ ✓ ✓
  • devicetree ✓ ✓ ✓ ✓ ✓
  • dhall ✓ . ✓ . ✓
  • diff ✓ . . . .
  • dockerfile ✓ . . . ✓
  • dot ✓ . . . ✓
  • ebnf ✓ . . . .
  • eex ✓ . . . ✓
  • elixir ✓ ✓ ✓ ✓ ✓
  • elm ✓ . . . ✓
  • elsa ✓ ✓ ✓ ✓ ✓
  • elvish ✓ . . . ✓
  • embedded_template ✓ . . . ✓
  • erlang ✓ . ✓ . .
  • fennel ✓ ✓ ✓ . ✓
  • firrtl ✓ ✓ ✓ ✓ ✓
  • fish ✓ ✓ ✓ ✓ ✓
  • foam ✓ ✓ ✓ ✓ ✓
  • fortran ✓ . ✓ ✓ .
  • fsh ✓ . . . .
  • func ✓ . . . .
  • fusion ✓ ✓ ✓ ✓ .
  • gdscript ✓ ✓ ✓ ✓ ✓
  • git_config ✓ . . . .
  • git_rebase ✓ . . . ✓
  • gitattributes ✓ . . . ✓
  • gitcommit ✓ . . . ✓
  • gitignore ✓ . . . .
  • gleam ✓ ✓ ✓ ✓ ✓
  • glimmer ✓ ✓ ✓ ✓ .
  • glsl ✓ ✓ ✓ ✓ ✓
  • go ✓ ✓ ✓ ✓ ✓
  • godot_resource ✓ ✓ ✓ . .
  • gomod ✓ . . . ✓
  • gosum ✓ . . . .
  • gowork ✓ . . . ✓
  • graphql ✓ . . ✓ ✓
  • groovy ✓ . . . ✓
  • hack ✓ . . . .
  • hare ✓ ✓ ✓ ✓ ✓
  • haskell ✓ . ✓ . ✓
  • haskell_persistent ✓ . ✓ . .
  • hcl ✓ . ✓ ✓ ✓
  • heex ✓ ✓ ✓ ✓ ✓
  • hjson ✓ ✓ ✓ ✓ ✓
  • hlsl ✓ ✓ ✓ ✓ ✓
  • hocon ✓ . . . ✓
  • hoon ✓ ✓ ✓ . .
  • html ✓ ✓ ✓ ✓ ✓
  • htmldjango ✓ . ✓ ✓ ✓
  • http ✓ . . . ✓
  • ini ✓ . ✓ . .
  • ispc ✓ ✓ ✓ ✓ ✓
  • janet_simple ✓ ✓ ✓ . ✓
  • java ✓ ✓ ✓ ✓ ✓
  • javascript ✓ ✓ ✓ ✓ ✓
  • jq ✓ . . . ✓
  • jsdoc ✓ . . . .
  • json ✓ ✓ ✓ ✓ .
  • json5 ✓ . . . ✓
  • jsonc ✓ ✓ ✓ ✓ ✓
  • jsonnet ✓ . . . .
  • julia ✓ ✓ ✓ ✓ ✓
  • kdl ✓ ✓ ✓ ✓ ✓
  • kotlin ✓ ✓ ✓ . ✓
  • lalrpop ✓ ✓ . . ✓
  • latex ✓ . ✓ . ✓
  • ledger ✓ . ✓ ✓ ✓
  • llvm ✓ . . . .
  • lua ✓ ✓ ✓ ✓ ✓
  • luadoc ✓ . . . .
  • luap ✓ . . . .
  • luau ✓ ✓ ✓ ✓ ✓
  • m68k ✓ ✓ ✓ . ✓
  • make ✓ . ✓ . ✓
  • markdown ✓ . ✓ ✓ ✓
  • markdown_inline ✓ . . . ✓
  • matlab ✓ ✓ ✓ ✓ ✓
  • menhir ✓ . . . ✓
  • mermaid ✓ . . . .
  • meson ✓ . ✓ . ✓
  • nickel ✓ . . ✓ .
  • ninja ✓ . ✓ ✓ .
  • nix ✓ ✓ ✓ . ✓
  • norg . . . . .
  • objc ✓ ✓ ✓ ✓ ✓
  • ocaml ✓ ✓ ✓ ✓ ✓
  • ocaml_interface ✓ ✓ ✓ ✓ ✓
  • odin ✓ ✓ ✓ ✓ ✓
  • org . . . . .
  • pascal ✓ ✓ ✓ ✓ ✓
  • passwd ✓ . . . .
  • pem ✓ . ✓ . ✓
  • perl ✓ . ✓ . ✓
  • php ✓ ✓ ✓ ✓ ✓
  • phpdoc ✓ . . . .
  • pioasm ✓ . . . ✓
  • po ✓ . ✓ . ✓
  • poe_filter ✓ . ✓ ✓ ✓
  • pony ✓ ✓ ✓ ✓ ✓
  • prisma ✓ . . . .
  • proto ✓ . ✓ . .
  • prql ✓ . . . ✓
  • pug ✓ . . . ✓
  • puppet ✓ ✓ ✓ ✓ ✓
  • python ✓ ✓ ✓ ✓ ✓
  • ql ✓ ✓ ✓ ✓ ✓
  • qmldir ✓ . . . ✓
  • qmljs ✓ . ✓ . .
  • query ✓ ✓ ✓ ✓ ✓
  • r ✓ ✓ . ✓ ✓
  • racket ✓ . ✓ . ✓
  • rasi ✓ ✓ ✓ ✓ .
  • regex ✓ . . . .
  • rego ✓ . . . ✓
  • rnoweb ✓ . ✓ . ✓
  • ron ✓ ✓ ✓ ✓ ✓
  • rst ✓ ✓ . . ✓
  • ruby ✓ ✓ ✓ ✓ ✓
  • rust ✓ ✓ ✓ ✓ ✓
  • scala ✓ ✓ ✓ . ✓
  • scheme ✓ . ✓ . ✓
  • scss ✓ . ✓ ✓ .
  • slint ✓ . . ✓ .
  • smali ✓ ✓ ✓ ✓ ✓
  • smithy ✓ . . . .
  • solidity ✓ . . . .
  • sparql ✓ ✓ ✓ ✓ ✓
  • sql ✓ . . ✓ ✓
  • squirrel ✓ ✓ ✓ ✓ ✓
  • starlark ✓ ✓ ✓ ✓ ✓
  • supercollider ✓ ✓ ✓ ✓ ✓
  • surface ✓ . ✓ ✓ ✓
  • svelte ✓ . ✓ ✓ ✓
  • sxhkdrc ✓ . ✓ . ✓
  • t32 ✓ ✓ ✓ ✓ ✓
  • tablegen ✓ ✓ ✓ ✓ ✓
  • terraform ✓ . ✓ ✓ ✓
  • thrift ✓ ✓ ✓ ✓ ✓
  • tiger ✓ ✓ ✓ ✓ ✓
  • tlaplus ✓ ✓ ✓ . ✓
  • todotxt ✓ . . . .
  • toml ✓ ✓ ✓ ✓ ✓
  • tsx ✓ ✓ ✓ ✓ ✓
  • turtle ✓ ✓ ✓ ✓ ✓
  • twig ✓ . . . ✓
  • typescript ✓ ✓ ✓ ✓ ✓
  • ungrammar ✓ ✓ ✓ ✓ ✓
  • usd ✓ ✓ ✓ ✓ .
  • uxntal ✓ ✓ ✓ ✓ ✓
  • v ✓ ✓ ✓ ✓ ✓
  • vala ✓ . ✓ . .
  • verilog ✓ ✓ ✓ . ✓
  • vhs ✓ . . . .
  • vim ✓ ✓ ✓ . ✓
  • vimdoc ✓ . . . ✓
  • vue ✓ . ✓ ✓ ✓
  • wgsl ✓ . ✓ ✓ .
  • wgsl_bevy ✓ . ✓ ✓ .
  • yaml ✓ ✓ ✓ ✓ ✓
  • yang ✓ . ✓ ✓ ✓
  • yuck ✓ ✓ ✓ ✓ ✓
  • zig ✓ . ✓ ✓ ✓

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.9.1
Build type: Release
LuaJIT 2.1.0-beta3

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "
/nix/store/ypc27qm8i9vp96yh1wk5aq3giibyi1f4-neovim-unwrapped-0.9.1/share/nvim
"

Additional context
Add any other context about the problem here.

Dominant language
Tree-sitter Query
Stars
2.8k
Forks
271
Avg merge
8d 8h
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nvim-treesitter/nvim-treesitter-textobjects

All issues in nvim-treesitter/nvim-treesitter-textobjects

Similar issues

More DevTools issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.