Deprecated decoration not visible if element not semantically highlighted
The deprecated strike through is only added to element if semantic highlighting is enabled on its type.
In a fresh Scala IDE install, in the following snippet, only
This dependence should not exist.
In a fresh Scala IDE install, in the following snippet, only
aaa
is stricken through, not bbb
. This is because semantic highlighting is enabled by default for vars, but not for functions.class NoStrikeThrough {
@deprecated
var aaa = 1
@deprecated
def bbb = {}
}
This dependence should not exist.
Leave a comment
on 2013-03-13 11:03 *
By Mirco Dotta
Description changed from The deprecated strike throu... to The deprecated strike throu...
(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