Skip to content

Update endwise rules - do not add end before catch, rescue, else etc.#164

Open
mmrwoods wants to merge 1 commit into
cohama:masterfrom
mmrwoods:improve-endwise-rules
Open

Update endwise rules - do not add end before catch, rescue, else etc.#164
mmrwoods wants to merge 1 commit into
cohama:masterfrom
mmrwoods:improve-endwise-rules

Conversation

@mmrwoods

@mmrwoods mmrwoods commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Update endwise rules to avoid adding the end before certain keywords, e.g. no endtry before catch in vimscript or end before rescue in ruby.

Adds an optional argument to lexima#endwise_rule#make_rule() to specify an additional list of keywords before which the end is not added. Uses rest arguments to avoid breaking changes to the existing function signature.

I have not yet added any tests, primarily because I'm not sure how to test this using the existing test helpers.

@mmrwoods mmrwoods changed the title Update endwise rules - no try before catch, no if before else etc. Update endwise rules - no endtry before catch, no endif before else etc. Jun 9, 2026
@mmrwoods mmrwoods force-pushed the improve-endwise-rules branch from 5f96a0b to fd39574 Compare June 9, 2026 06:50
@mmrwoods mmrwoods changed the title Update endwise rules - no endtry before catch, no endif before else etc. Update endwise rules - do not add end before catch, rescue, else etc. Jun 9, 2026
@mmrwoods mmrwoods force-pushed the improve-endwise-rules branch from fd39574 to 5788932 Compare June 9, 2026 06:53
@cohama

cohama commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Thank you. I'll test the behavior myself.

You don't need to add any tests. I don't think you're familiar with themis.vim.

There's a conflict right now, Please rebase against origin/master if possible.

Update endwise rules to avoid adding the end before certain keywords,
e.g. no endtry before catch in vimscript or end before rescue in ruby.

Adds an optional argument to lexima#endwise_rule#make_rule() to specify an
additional list of keywords before which the end is not added. Uses rest
arguments to avoid breaking changes to the existing function signature.
@mmrwoods mmrwoods force-pushed the improve-endwise-rules branch from 5788932 to dad04fb Compare July 11, 2026 08:28
@mmrwoods

Copy link
Copy Markdown
Contributor Author

Rebased and force pushed with conflicts resolved

@mmrwoods

Copy link
Copy Markdown
Contributor Author

An example of what this fixes:

def foo
  raise 'error'
rescue
  puts 'rescue'
end

<CR> immediately after def foo above should not add end

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.

2 participants