Intellij idea 在Intellij中为Apache Velocity宏参数启用隐式上下文变量解析

Intellij idea 在Intellij中为Apache Velocity宏参数启用隐式上下文变量解析,intellij-idea,velocity,Intellij Idea,Velocity,我发现Intellij隐式上下文变量在创建ApacheVelocity模板时非常宝贵 例如: #* @vtlvariable name="order" type="com.mycompany.vo.PlacedOrderVO" *# #* @vtlvariable name="formatHelper" type="com.mycompany.FormatHelper" *# #* @vtlvariable name="i18n" type="com.mycompany.I18nWriter"

我发现Intellij隐式上下文变量在创建ApacheVelocity模板时非常宝贵

例如:

#* @vtlvariable name="order" type="com.mycompany.vo.PlacedOrderVO" *#
#* @vtlvariable name="formatHelper" type="com.mycompany.FormatHelper" *#
#* @vtlvariable name="i18n" type="com.mycompany.I18nWriter" *#
但是,我无法找到为宏变量提供上下文的方法。有人知道路吗

这个问题最初是在这里提出的:

Intellij建议创建一个文件级定义,就像正常速度变量一样,但是编辑器没有将触点变量应用于宏变量,而且我的宏中仍然会出现黄色警告

我也会考虑抑制我在宏中得到的几个警告,但是在宏中,只有在文件范围内,ItLyLJ没有给出语句级抑制的选项。


谢谢。

我不知道几年前当您询问时该功能是如何工作的,但目前(IntelliJ IDEA 2020.3.1)它似乎正在工作

#* @vtlvariable name="list" type="java.util.List" *#
#macro( disabled $list ) #if($list.isEmpty()) disabled #end #end