How to customize the syntax for EL completion on JSPs, like elvariable

Answered

IntelliJ currently provides support for the following syntax elements for declaring the type of a JSP variable:

  • <%--@elvariable id="varname" type="com.example.PageModel"--%>
  • <jsp:useBean id="varname" type="com.example.PageModel"/>

I don't want to use either of them, since I have developed a custom JSP tag that validates the type at runtime. It looks like this:

  • <i:instance attr="pageModel" nullable="true" comment="is null for /admin/ URLs" />
  • <i:instance attr="customerName" type="String" />
  • <i:instance attr="price" type="double|MonetaryAmount|SpecialPrice" />

It seems unlikely that I can configure IntelliJ to recognize my custom JSP tag. So I'm thinking about writing an IntelliJ plugin to do that.

Is that possible at all? Where would I start, and what are the relevant classes for implementing it?

0
3 comments

Hi, do you use those variables in EL expressions, or somewhere else?

0
Avatar
Permanently deleted user

Yes, I use those variables in EL expressions. I don't use them anywhere else.

0

Sorry for delay, take a look at 

com.intellij.psi.impl.source.jsp.el.impl.ELVariablesProvider extension point, although this is not a public API.
0

Please sign in to leave a comment.