Closed s809 closed 1 month ago
The manifold plugin integrates Java expressions in string templates using IntelliJ's language injection feature. In order to parse correctly, the injection API requires that expressions are wrapped in a class. Using your failed example, the expression is parsed something like this:
class Xxx { Object xxxfield = this.serverLevelWrapper.getDimensionName(); }
The problem appears to be that this
is a reference to class Xxx
, being a local inner class this
does not have access to the outer serverLevelWrapper
field. I would chalk this up as a general limitation of language injection. Or, perhaps there is another way to expose the expressions in a way where this
works as expected?
I don't know much about IntelliJ's plugin system yet, but is there a way to at least somewhat transparently substitute this
with ClassName.this
in that case?
is there a way to at least somewhat transparently substitute this with ClassName.this in that case?
For simple cases where the expression begins with this
, that's not a bad idea, I'll look into that. But for more complex expressions where this
is elsewhere in the expression, it may cause problems with injection parsing wrt
location/offset .
Latest plugin now supports the simple case where an expression begins with this
.
When class members in string templates are prefixed with
this
, they have no syntax highlighting and they don't show up in references.Works:
Does not work: