nvim-treesitter / nvim-treesitter/nvim-treesitter-textobjects

operating on inner/outer functions not working in rust (for me).

Open
#868 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug

( just FYI: the https://github.com/nvim-treesitter/nvim-treesitter#troubleshooting section exists for the "master" branch, but not for "head")

operating on inner/outer function for rust does not work for me.

To Reproduce
  1. create a simple rust file "main.rs" like this:
fn test() {
    println!("test");
    if true {
        println!("true");
    }
}
  1. put the cursor anywhere inside, eg on the "if"
  2. in normal mode type "vaF" - nothing happens.

I can confirmw with ":verbose xmap aF" that it's mapped to "@function.outer".

operating on e.g. a "{...}" block works as expected.

Expected behavior

I would have expected that "vaF" marks the entire function.

Output of :checkhealth nvim-treesitter
nvim-treesitter:                                                            ✅

Requirements ~
- ✅ OK Neovim was compiled with tree-sitter runtime ABI version 15 (required >=13).
- ✅ OK tree-sitter-cli 0.26.5 (/home/joerg/.npm-global/bin/tree-sitter)
- ✅ OK tar 1.35.0 (/usr/bin/tar)
- ✅ OK curl 8.14.1 (/usr/bin/curl)
  curl 8.14.1 (x86_64-pc-linux-gnu) libcurl/8.14.1 OpenSSL/3.5.3 zlib/1.3.1 brotli/1.1.0 zstd/1.5.7 libidn2/2.3.8 libpsl/0.21.2 libssh2/1.11.1 nghttp2/1.64.0 librtmp/2.3 OpenLDAP/2.6.10
  Release-Date: 2025-06-04, security patched: 8.14.1-2ubuntu1.1
  Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp ws wss
  Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM PSL SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd

OS Info ~
- machine: x86_64
- version: nvim-treesitter/nvim-treesitter#8-Ubuntu SMP PREEMPT_DYNAMIC Fri Nov 14 21:44:46 UTC 2025
- sysname: Linux
- release: 6.17.0-8-generic

Install directory for parsers and queries ~
- /home/joerg/.local/share/nvim/site/
- ✅ OK is writable.
- ✅ OK is in runtimepath.

Installed languages     H L F I J ~
- bash                  ✓ ✓ ✓ ✓ ✓
- c                     ✓ ✓ ✓ ✓ ✓
- lua                   ✓ ✓ ✓ ✓ ✓
- markdown              ✓ . ✓ ✓ ✓
- markdown_inline       ✓ . . . ✓
- python                ✓ ✓ ✓ ✓ ✓
- rust                  ✓ ✓ ✓ ✓ ✓

  Legend: [H]ighlights, [L]ocals, [F]olds, [I]ndents, In[J]ections ~
Output of nvim --version
nvim --version                                                                                                                                                        
NVIM v0.11.6
Build type: Release
LuaJIT 2.1.1741730670
Run "nvim -V1 -v" for more info
Additional context

No response

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.

Research direction

Reproduce the issue with the provided main.rs example and the vaF mapping, then inspect the @function.outer textobject behavior for the Rust parser. Use :verbose xmap aF and :checkhealth nvim-treesitter as the reported entry points. Done means vaF selects the entire function while block textobjects continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.