Using FreeMarker extension points

Hi,

I'm writing a plugin which needs to contribute implicit variables to FreeMarker templates. I've found the 'FtlGlobalVariableProvider' class which can be extended and registered under the 'freemarker.globalVariableProvider' extension point.

But I'm not sure how to create the FtlXXX variables. I've tried this:

    @NotNull
    @Override
    public List<? extends FtlVariable> getGlobalVariables( FtlFile ftlFile )
    {
        FtlImplicitVariable languages = new FtlImplicitVariable( null, "languages", ftlFile );
        languages.addSubVariable( "en" );
        return Arrays.asList( languages );
    }


This code throws an NPE because I'm passing 'null' as the PsiComment parameter to FtlImplicitVariable - how do I create a PsiComment?
0

请先登录再写评论。