slim-template/ruby-slim.tmbundle

Ruby syntax error - unexpected end-of-input

gemp opened this issue ยท 4 comments

gemp commented

For a while now, my slim files are riddled with errors like unexpected end-of-input sometimes with the added expecting keyword_then or ';' or '\n' and also assigned but unused variable even if it is actually used like no_items below. Mostly taken from the slim-lang.com example:

test_slim

Any idea how to solve this? I tried many things but to no avail. I have Sublime Text 3.1.1 Build 3176.

Hey @gemp are you using a Sublime plugin to interpret Ruby? Like an analyzer? Does this affect your compilation to HTML?

gemp commented

Does SublimeLinter-ruby count as an analyzer @tshedor? If so, I have it. Deactivating it removes the errors in Slim but also in Ruby where syntax error isn't performed, which isn't cool.
The Slim compilation to HTML is handled by the slim-rails gem, I have nothing in Sublime to do that.

Ahh. That's out of the scope for this repo because your Ruby is valid and highlighted correctly. Sublime syntax highlights this line as Ruby which is probably where SublimeLinter-ruby is called.

So while I can't resolve this error in this repo (but feel free to open an issue with that package), perhaps you can selectively disable Slim files in the linter settings?

(This is untested)

...
"linters": {
  // The name of the linter you installed
  "ruby": {
    // Disables the linter. The default here is 'not set'
    "excludes": ["*.slim"],
  }
}
...
gemp commented

It works as expected. After fiddling a (long) bit with it, I figured out it should be in the SublimeLinter settings, not in the global ones ๐Ÿ˜…

In fact, I could use a Slim linter, which I do not, it would have solved the problem another way, maybe.

Thank you!