Skip to content

fix: recognize function definition lines as scope openers - #30

Merged
nemanjamalesija merged 1 commit into
mainfrom
fix/function-head-opener
Aug 10, 2026
Merged

nemanjamalesija merged 1 commit into
mainfrom
fix/function-head-opener

Conversation

@nemanjamalesija

Copy link
Copy Markdown
Owner

The opener heuristic only matched line-ending tokens, and a definition line like local function test() ends in a closing paren, so pasting below it landed at the definition indent instead of the body level. Two new patterns catch definition statements and line-ending anonymous function heads, while call statements like function_helper(x) stay non-openers.

Closes #28

A Lua definition line like local function test() ends in a closing
paren, so the opener heuristic never matched it. Pasting with ]p
below a definition landed at the definition indent instead of the
body level.

Two new patterns catch definition statements and anonymous function
heads at the end of a line, for example vim.schedule(function().
The word boundaries reject identifier characters, so call statements
like function_helper(x) or my_function(data) stay non-openers. The
clipboard spec expectation moves to the body level because its
fixture pastes below a function definition.

Refs #28
@nemanjamalesija
nemanjamalesija merged commit 0a6a9b8 into main Aug 10, 2026
6 checks passed
@nemanjamalesija
nemanjamalesija deleted the fix/function-head-opener branch August 10, 2026 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

function definition line

1 participant