YAML Plugin overwrites my AutoCompletion Plugin

Answered

Hi

I want to create a code completion for GitHub Workflow files. (with the help of intellij-platform-plugin-template && https://plugins.jetbrains.com/docs/intellij/)

But my Plugin only works by deactivating the default YAML plugin. Why is that?

I am adding elements with (or see github-link)

(CompletionResultSet) resultSet.addAllElements(githubContextItems);

But the results get partially overwritten or cleared by the YAML Plugin.

 

Steps to reproduce:

1) Clone my repo https://github.com/YunaBraska/github-workflow-plugin

2) Run Plugin

3) Open a GitHub Workflow File in a Project

4) Do autocompletions on:

   a) `uses: actionXY with: ` (should show you all inputs for the current action)

   b) `${{ github.` (should show you all predefined GitHub context envs)

   b) `${{ env.` (should show you all predefined envs)

5) Result a) works, b) doesn't work c) doesn't work

6) Deactivate the default YAML Plugin in your IDE Settings

7) Result a) works, b) works c) works

 

How can I do to make my auto-completion work with yml files without disabling or overwriting the default YAML Plugin?

0
4 comments

What does the Status change mean? "Planned"
I Still have the issue that I can't autocomplete text things in the yml like "github." "env.", "inputs.",.. cause of the default YAML Plugin. else its already working.

0

Hi Yuna,

The "Planned" state means that the question is in progress - either one of the regular support developers is analyzing it, or it was delegated to someone more specialized in the topic.

Please be patient.

0

Hi Yuna,

The reason is that when the YAML plugin is enabled, the CompletionResultSet gets the CamelHumpMatcher. In the completion inside of string value, the completion prefix is, e.g., "${{ env." and the mentioned prefix matcher rejects your items because they don't match the prefix.

To fix it, in cases b) and c), you should change the prefix matcher to one that will pass your results (you can start with PrefixMatcher.ALWAYS_TRUE). Example:

CompletionResultSet adjustedResultSet = resultSet.withPrefixMatcher(PrefixMatcher.ALWAYS_TRUE);
adjustedResultSet.addAllElements(githubContextItems);
0

Karol Lewandowski You are the hero of the day! Thanks! It works! Now I can move on :)

0

Please sign in to leave a comment.