elixir-sublime-syntax
elixir-sublime-syntax copied to clipboard
SQL coloration for `Repo.query!`
Hello! thanks for the great package.
i'm trying to add Repo.query!
as a valid way to start an SQL fragment.
By just adding it to the list like so:
## SQL
sql_or_fragment:
- match: (?>(fragment)|(sql)|(Repo\.query!))(\()
It kinda works, but it looses the function coloration, i.e. becomes white:
Before:
After:
It's miles better, but what am I missing? Adding only query!
doesn't work at all.
There's also this form
result = Ecto.Adapters.SQL.query!(MyRepo, "SELECT * FROM users", [])
But harder to deal with since the query is at the second position.
You're welcome! Thanks for the suggestion! I managed to implement it. Can you check out the v3.3.0 branch (PR #68)?
Works almost like a charm! Looking at the PR it seems like it's trying to look at popping arguments for this case:
Ecto.Adapters.SQL.query!(MyRepo, "SELECT * FROM users", [])
?
This doesn't seem to work.
For what it's worth, we also use the aliased version
SQL.query!(MyRepo, "SELECT * FROM users", [])
But Repo.query!
works perfectly:
(note, i'm only pointing it out because I thought your change was trying to handle that case, if that's not the case no worries, this must be a pain to handle I guess)
I think I solved this now. :+1: Better late than never... :sweat_smile: