New Plugin Dev: A Bunch of Questions

Answered

Hi,

I'm looking at porting an internal intellisense VS Code extension I wrote to IntelliJ for my colleagues. The extension does the following: if the schema association settings don't exist, GET an endpoint, parse and create the payload into a JSON schema and file that contains snippets, and save both to disk as cache. The schema is written to application level settings for 2 yaml filenames, and the snippets are then added to autocomplete settings at runtime. A user command is added to force this process again to update the saved files.

The files I'm associating with have no extensions, I'm not sure if this causes issues as reported here for templates: https://youtrack.jetbrains.com/issue/IDEA-170960 

IntelliJ plugins are a fair bit more complex, I haven't touched Java in ages, IntelliJ isn't my IDE of choice, and the docs are kind of sparse, so I have some questions before I dive in.

  • Is this still possible? All I'd need to do is hit an endpoint, do some file writing for persistence and then write an application-level setting.
  • Can plugins set application-level schema associations for a file name? And where might some docs/examples of this be?
  • From the SDK docs, it doesn't seem plugins have their own storage space - how should I go about storing these plugin-written files/schemas? Should I aim to use VFS or just Java IO if some special directory constants exist for determining paths?
  • How should I handle templates in this case? If they're being generated programmatically, am I able to create them and store them at application-level with them persisting?
  • Perhaps I'm blind, but are there API docs for internal functions and classes for self problem-solving? The SDK docs discuss some structural things, but doesn't list much for code use, or wider scope. For example, this question here (https://intellij-support.jetbrains.com/hc/en-us/community/posts/207357135-How-to-insert-a-dynamically-generated-live-template-) has an answer that refers a class - my question being where can these references be found?

Cheers

1 comment
Comment actions Permalink

AFAIU this should be quite possible. There's extension point com.jetbrains.jsonSchema.extension.JsonSchemaProviderFactory in JSON plugin that allows programmatically providing JSON schema file from your plugin. Such VFS schema file could be packged in plugin, cached or downloaded to some location on disk from any remote location. Your provider would automatically work for files matching com.jetbrains.jsonSchema.extension.JsonSchemaFileProvider#isAvailable. You can find samples by browsing the EP usages in OSS plugins (https://plugins.jetbrains.com/intellij-platform-explorer?extensions=JavaScript.JsonSchema.ProviderFactory) or in IJ Community sources.

Sources with JavaDoc are available in IJ Community sources https://jetbrains.org/intellij/sdk/docs/intro/intellij_platform.html#open-source, currently API docs are not published anywhere.

0

Please sign in to leave a comment.