Closed dalexj closed 8 years ago
@dalexj is this still an issue that you're having?
just updated to 0.7.2
it seems to be highlighting correctly inside interpolated strings, much appreciated
I'd still love a light wrapper around the contents between #{
and }
to be a span.source.elixir
similar to the ruby highlighting, so variable names, etc (anything not picked up by any deeper highlighting) could be highlighted differently than the surrounding string
There aren't any visual differences between the elixir implementation and the ruby implementation that I'm aware of. Is there is a specific use case that you want to support?
yes it is most likely a more specific use case. my current theme gives me different highlighting inside string so its easier for me to see interpolated values:
I doubt adding the wrapper would break it for anyone else, because this is the way the ruby highlighting uses it
Can we also get #
to expand to #{}
with the cursor placed in the middle when inside a string? Like how Ruby string interpolation works in Atom? :)
@cjbottaro can you open a separate issue for that?
Just to update I'm looking at this along with #38. The interpolation code is what was generated from the TM bundle and I'm having to do quite a bit of cleanup.
@cjbottaro Expanding #
to #{}
is actually handled in the bracket matcher package: https://github.com/atom/bracket-matcher.
It'll have to be fixed there
@cjbottaro
I've actually hacked into bracket matcher locally to expand this as needed, but never went through and made a full PR to the package. If you add the selector for elixir strings into the segments
array lib/bracket-matcher.coffee
around like 185, it should work. I think the selector you want is 'string.quoted.double.elixir'
(not 100% sure since my elixir lang is hacked on that selector too)
@dalexj if you want to submit that upstream to bracket matcher that would be great. Otherwise I'll submit a PR once I'm done with the interpolated string changes. Also feel free to submit a PR with any improvements you've made and we can discuss them.
I've submitted a fix to bracket matcher: atom/bracket-matcher#221.
I'm going to close this for now because at this point there's no visual difference between the Ruby version and the elixir version. I have noticed a few themes that update ruby variables in strings by specifically targeting ruby. The solarized dark themes do this for instance. I'd check with the specific theme that you're using. If there is a specific problem that you're seeing then feel free to re-open the issue.
Requested Feature
I'd like to see the parsed markup of interpolated strings with elixir match/closely match the markup that the built in atom ruby language generates.
Reasoning
This will allow more theme/syntax highlighting packages to work more completely with elixir.
Other information
I have not spent the time to look into how language/grammar parsing works with atom, so I'm unsure how much work this will take, but I'm trying/will try to provide as much info as I can.
Here is an example of 2 strings, 1 in ruby - 1 in elixir, and the HTML generated by them to give a sense of differences
I think at the very least, I'd love to see the
.interpolated
class be added on any.double.quoted.string
and to wrap inner code with classes.source.elixir
so that themes will pick this up.