miguelopezv
miguelopezv

Reputation: 860

suggest .erb 'functions' in sublime

I'm barely beginning to understand Ruby on Rails and there are a lots of things I don't get to remember correctly, so I wonder if there's a way to enable suggestion and autocomplete for functions in html.erb files.

Right now it suggest me things when I'm working on ruby files, but this is not the case in html.erb files so I make a mess each time I try to remember how to do something until I find that I'm looking for 'yield' or 'provide'... I know is not a big help but I would love if sublime could suggest me this when I type 'y' or 'p' between <% %> tags.

Upvotes: 0

Views: 179

Answers (2)

idleberg
idleberg

Reputation: 12882

If this is about the autocomplete popup not showing while typing, rather than completions not working when pressing the Tab, you need add the scope to you auto_complete_selector setting. By default, Sublime Text shows this popup only when working in the source scope, even though you can force showing the popup when pressing Ctrl+Space. To change this, open your user preferences (Preferences > Settings User) and adjust the auto_complete_selector by adding the text.html scope (or the more limited text.html.erb).

Upvotes: 0

coderVishal
coderVishal

Reputation: 9109

there are a few packages you can check for sublime text 3 ,

https://github.com/matthewrobertson/ERB-Sublime-Snippets

https://github.com/CasperLaiTW/ERBAutocomplete

some convenience you can get are, just write

er and tab which will print <% %>

ep and tab which will print <%= %>

Upvotes: 1

Related Questions