JSPredefinedLibraryProvider no longer working in IntelliJ 2018.3.x?

Answered

I would like to add some implicit Javascript variables in HTML or JSP pages. Therefore I implemented a JSPredefinedLibraryProvider as follows:

public class SimpleJSPredefinedLibraryProvider extends JSPredefinedLibraryProvider {
  public ScriptingLibraryModel[] getPredefinedLibraries(@NotNull Project project) {
    URL resourceURL = SimpleJSPredefinedLibraryProvider.class.getClassLoader().getResource("simple.js");
    VirtualFile resourceFile = VfsUtil.findFileByURL(resourceURL);
    ScriptingLibraryModel scriptingLibraryModel = ScriptingLibraryModel.createPredefinedLibrary("Simple", new VirtualFile[]{resourceFile}, true);
    return new ScriptingLibraryModel[] {scriptingLibraryModel};
  }
}


The mentioned simple.js looks like this:

var mySimpleObject = {};

I would expect that mySimpleObject would be autocompleted in a JSP page like this:

<script type="text/javascript">
  var obj = mySimpleObject;
</script>

The above worked properly in IntelliJ 2018.1. However when I use IntelliJ 2018.3, it is no longer working. The library "Simple" is present at Languages & Frameworks - JavaScript - Libraries and is enabled. However mySimpleObject is not autocompleted.

Has there anything changed between IntelliJ 2018.1 and IntelliJ 2018.3 in this area? What do I have to do to make it working in 2018.3?

1 comment
Comment actions Permalink

Thanks for reporting, reproduced. Please follow https://youtrack.jetbrains.com/issue/WEB-37355 for updates.

0

Please sign in to leave a comment.