atom / language-ruby-on-rails

Ruby on Rails package for Atom
Other
48 stars 41 forks source link

Highlighting SQL in .where, .order queries #41

Open ghost opened 9 years ago

ghost commented 9 years ago

Issue: #40

rails-grammar-test

winstliu commented 9 years ago

Please add specs to this.

ghost commented 9 years ago

Sure thing! Can you point me to a example test-case?

winstliu commented 9 years ago

@mkorfmann this might be helpful.

ghost commented 9 years ago

@50Wliu Thanks!

ghost commented 9 years ago

Added two tests, there are still some issues though:

1.) Escaped quoting chars end the SQL scope. I tried using negative look-behind, but no luck. 2.) String interpolation should work, this will be even more tricky I guess. The SQL grammar somehow needs to "know", that the '#' in '#{ }' is not a comment.

Does somebody have an idea on how to fix these issues?

Most kindest regards, Manuel

winstliu commented 8 years ago

Sorry for the delay in getting back to you on this.

I've seen 1) in numerous other places, but there doesn't seem to be an easy solution to that. Can you try adding a pattern before the source.sql include to catch escaped quotes and see if that works?

Same goes for 2). Not sure if that'll work, but better to start somewhere.

Also, this PR has conflicts now - can you please rebase on top of master? Thanks!