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

Elixir: Not all functions are properly identified

Open
#249 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug
In addition to #245, there are two other function declarations that are currently not correctly identified by @function.inner/@function.outer queries. The following are not matched:

def foo(), do: 12
def foo() do
  12
end

def guarded_fn(a, b) when a == b, do: a + b
def guarded_fn(a, b) when a != b do
  a * b
end

To Reproduce
Steps to reproduce the behavior:

  1. Add above code to editor
  2. Try to move to next/prev function.

Expected behavior
Functions with guards and functions without parameters are correctly identified.

Additional context

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 examples in an editor and inspect the @function.inner and @function.outer queries that handle Elixir functions. Compare declarations with and without parameters and with guards, then verify that moving to the next or previous function identifies all four forms.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir
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.