JavaScript.JsonSchema.ProviderFactory extension overrides other completion contributions

Answered

I'm writing a plugin for a custom yaml-based configuration file and have run into some problems with completions. My plugin is mainly built on top of the existing YAML language support, which mean I could use the JavaScript.JsonSchema.ProviderFactory extension to get schema validation and completion from a json schema file. This part work fine.

But I've also added some more custom, semantic references and completions using a psi.referenceContributor, implementing the getVariants() method on PsiReference. However, none of these completions are ever used. The getVariants() method is not even called.

If I remove the JsonSchema extension, all other custom references and completions work as expected, so I believe there's some conflict here. What should I do to have both working?

3 comments
Comment actions Permalink

Hello, Rouzwawi,

Sorry for an unexpected API change. You can implement a 'JsonSchemaCatalogExclusion' component for your kind of YAML files, this will disable JSON schemas for particular file you specify in your component.

 

See also this post: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360002721620-YAML-completion-contributor-

0
Comment actions Permalink

Hi Anton. Thanks for replying.

In my case, I actually want both to work together. I've got a JSON schema that helps with the general field name completion in the whole YAML file. But then some fields have more semantic meaning like `mainClass` for which my plugin implement references to Java packages and classes.

Adding an exclusion would disable the general schema completion which is not what I want.

0
Comment actions Permalink

I see, thanks a lot for clarifying. I'll take a look what can be done to improve that. Created a new ticket, feel free to upvote it to subscribe to updates: https://youtrack.jetbrains.com/issue/WEB-37747.

0

Please sign in to leave a comment.