Skip to content

[Julia] short-form function bodies ending in unicode characters break move.goto #906

Description

@melyso

Describe the bug
goto_next_end("@function.outer") fails to advance past a short-form function definition whose body ends in a non-ASCII character. Once the cursor reaches the end of such a function, repeating the command does not move it.

In contrast, goto_next_start("@function.outer"), goto_previous_start("@function.outer") and goto_previous_end("@function.outer") all work as expected.

To Reproduce
Steps to reproduce the behavior:
with neovim+nvim-treesitter (main branch) +nvim-treesitter-textobjects (main branch):

  1. Create and open a .jl file
  2. write the following:
f(x) = 2*b

g(x) = 2*α

h(x) = 3
  1. place cursor on line 1
  2. repeat the command :lua require("nvim-treesitter-textobjects.move").goto_next_end("@function.outer", "textobjects")
  3. Expected: The cursor moves to the end of h(x)=3. Actual: The cursor gets stuck at the end of the function ending with an α

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.27.0 (/opt/homebrew/bin/tree-sitter)
- ✅ OK tar 3.5.3 (/usr/bin/tar)
- ✅ OK curl 8.7.1 (/usr/bin/curl)
  curl 8.7.1 (x86_64-apple-darwin25.0) libcurl/8.7.1 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.12 nghttp2/1.68.1
  Release-Date: 2024-03-27
  Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns ldap ldaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
  Features: alt-svc AsynchDNS GSS-API HSTS HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz MultiSSL NTLM SPNEGO SSL threadsafe UnixSockets

OS Info ~
- release: 25.5.0
- machine: arm64
- sysname: Darwin
- version: Darwin Kernel Version 25.5.0: Tue Jun  9 22:18:58 PDT 2026; root:xnu-12377.121.10~1/RELEASE_ARM64_T6000

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

Installed languages     H L F I J ~
- bibtex                ✓ . ✓ ✓ ✓
- julia                 ✓ ✓ ✓ ✓ ✓
- latex                 ✓ . ✓ . ✓
- lua                   ✓ ✓ ✓ ✓ ✓
- python                ✓ ✓ ✓ ✓ ✓
- toml                  ✓ ✓ ✓ ✓ ✓
- vim                   ✓ ✓ ✓ . ✓
- vimdoc                ✓ . . . ✓

  Legend: [H]ighlights, [L]ocals, [F]olds, [I]ndents, In[J]ections ~

Output of nvim --version

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

Additional context
:InspectTree reveals that the nvim-treesitter produces structurally identical trees for the cases which work and the one that breaks.
For f(x) = 2*b:

(assignment ; [0, 0] - [0, 10]
    (call_expression ; [0, 0] - [0, 4]
      (identifier) ; [0, 0] - [0, 1]
      (argument_list ; [0, 1] - [0, 4]
        (identifier))) ; [0, 2] - [0, 3]
    (operator) ; [0, 5] - [0, 6]
    (binary_expression ; [0, 7] - [0, 10]
      (integer_literal) ; [0, 7] - [0, 8]
      (operator) ; [0, 8] - [0, 9]
      (identifier)))

for g(x) = 2*α:

(assignment ; [2, 0] - [2, 11]
    (call_expression ; [2, 0] - [2, 4]
      (identifier) ; [2, 0] - [2, 1]
      (argument_list ; [2, 1] - [2, 4]
        (identifier))) ; [2, 2] - [2, 3]
    (operator) ; [2, 5] - [2, 6]
    (binary_expression ; [2, 7] - [2, 11]
      (integer_literal) ; [2, 7] - [2, 8]
      (operator) ; [2, 8] - [2, 9]
      (identifier)))

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions