Variables blend in to interpolated strings
The default color for strings and local vals is two similar shades of blue. This makes it hard to see at a glance where variables are in an interpolated string.
It would be nice to have a syntax coloring option for variables in interpolated strings, allowing the usual bold/italic/underline/paint background. I think the default should be to make them bold to stand out more.
It would be nice to have a syntax coloring option for variables in interpolated strings, allowing the usual bold/italic/underline/paint background. I think the default should be to make them bold to stand out more.
Leave a comment
on 2013-03-09 18:03 *
By Simon Schäfer
Assigned to set to Simon Schäfer
Component changed from None to Syntax Highlighting
Description changed from The default color for strin... to The default color for strin...
The dollar sign is superseded by #1001405
on 2013-03-10 04:25 *
By Simon Schäfer
Is changing the default color of strings enough? Highlighting symbols in string interpolation is a lot of work and in my opinion not necessary.
on 2013-03-10 07:03 *
By Simon Schäfer
What about
ED9900
(light orange)?
(In scala-ide:990fcd8e0ea27935ac892303faeafa8876164ca1) Add highlighting for variables in interpolated strings
We pull the identifiers in `StringInterpolation` from SyntacticInfo, and then
use the SymbolInfo in HighlightingStyle.
The syntax preview can now render deprecated methods with strike-through.
Previously we were building a map of identifier to SyntaxClass and eventually
having it build the style from the SyntaxClass, but in real usage the
HighlightingStyle class does that using Position (and has logic for adding
strikethrough). Now we essentially build a Map of identifier to Position and we
call HighlightingStyle.
This also fixes deprecated method strike-through not being enabled unless
semantic highlighting was enabled for methods (half of ticket #1001584). In
TextPresentationEditorHighlighter we were only calling HighlightingStyle.style
if styling was enabled for that kind of token. Now we call it if the styling was
enabled or if the position says it should be styled, which is true when it is
either marked `deprecated` or `inInterpolatedString`, and HighlightingStyle will
do the right thing whether the style is enabled or not.
SyntaxColouringPreviewText uses a unicode trick to get different coloring for
the variables that are in interpolated strings. Variables that should show up as
in interpolated strings have a different name that looks the same, by using the
"Cyrillic lowercase a" in place of a normal "a". It looks the same, but is a
different character, so the Map[String, ColouringInfo] works. It would be nice
to not specify any of this at all and just compile the code and use normal
highlighting, but it would require having a scala project, compiler, etc all set
up just for previewing.
Fix #1001574, Fix #1001593
Branch: master
We pull the identifiers in `StringInterpolation` from SyntacticInfo, and then
use the SymbolInfo in HighlightingStyle.
The syntax preview can now render deprecated methods with strike-through.
Previously we were building a map of identifier to SyntaxClass and eventually
having it build the style from the SyntaxClass, but in real usage the
HighlightingStyle class does that using Position (and has logic for adding
strikethrough). Now we essentially build a Map of identifier to Position and we
call HighlightingStyle.
This also fixes deprecated method strike-through not being enabled unless
semantic highlighting was enabled for methods (half of ticket #1001584). In
TextPresentationEditorHighlighter we were only calling HighlightingStyle.style
if styling was enabled for that kind of token. Now we call it if the styling was
enabled or if the position says it should be styled, which is true when it is
either marked `deprecated` or `inInterpolatedString`, and HighlightingStyle will
do the right thing whether the style is enabled or not.
SyntaxColouringPreviewText uses a unicode trick to get different coloring for
the variables that are in interpolated strings. Variables that should show up as
in interpolated strings have a different name that looks the same, by using the
"Cyrillic lowercase a" in place of a normal "a". It looks the same, but is a
different character, so the Map[String, ColouringInfo] works. It would be nice
to not specify any of this at all and just compile the code and use normal
highlighting, but it would require having a scala project, compiler, etc all set
up just for previewing.
Fix #1001574, Fix #1001593
Branch: master