Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong indentation on "end" keyword #333

Open
khangal opened this issue Feb 12, 2017 · 1 comment
Open

Wrong indentation on "end" keyword #333

khangal opened this issue Feb 12, 2017 · 1 comment
Labels

Comments

@khangal
Copy link

khangal commented Feb 12, 2017

Ubuntu 16.04
VIM 8.0

  1. if statement with nested erb fails
<div>
  <% if signed_in? %>
    Signed in as: <%= current_user.name %>
  foo
<% end %>
</div>
  1. else statement fails
<div>
  <% if signed_in? %>
    Signed in as: <%= current_user.name %>
<% else %>
  foo
<% end %>
</div>
  1. Without nested erb works
<div>
  <% if signed_in? %>
    Signed in as: without nested erb
    foo
  <% end %>
</div>
@AndrewRadev
Copy link
Member

@tpope Can you think of what case is being handled by this code?

vim-ruby/indent/eruby.vim

Lines 97 to 100 in 4788a08

if line !~# '^\s*<%' && line =~# '%>\s*$' && line !~# '^\s*end\>'
\ && synID(v:lnum, match(cline, '\S') + 1, 1) != hlID('htmlEndTag')
let ind = ind - sw
endif

I get the meaning, it doesn't start with a <%, but it does end in %>, but I'm not sure what its purpose is. If I comment it out, this example works, but I'm assuming something valid would break.

@AndrewRadev AndrewRadev reopened this Feb 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants