Content assist to commit message

Answered

Hi,

I want to extends content assist of vcs commit message dialog.

What I did is

* add `completion.contributor language="any"` to plugin.xml
* create custom `CompletionContributor`
* call `extend()` in constructor

For now, I implemented following code. This code hit breakpoints if I do content assist at Editor, but not works for Commit Dialog.

```

init {
extend(CompletionType.BASIC, TruePattern(), object : CompletionProvider<CompletionParameters>() {
override fun addCompletions(parameters: CompletionParameters, context: ProcessingContext?, result: CompletionResultSet) {
println()
}
})
}

override fun fillCompletionVariants(parameters: CompletionParameters, result: CompletionResultSet) {
super.fillCompletionVariants(parameters, result)
}

private class TruePattern : ElementPattern<PsiElement> {
override fun accepts(o: Any?): Boolean {
return true
}

override fun accepts(o: Any?, context: ProcessingContext): Boolean {
return true
}

override fun getCondition(): ElementPatternCondition<PsiElement> {
return ElementPatternCondition(object : InitialPatternCondition<PsiElement>(PsiElement::class.java) {
override fun accepts(o: Any?, context: ProcessingContext?): Boolean {
return true
}
})
}
}


```

Is there a way to content assist to Commit Message?

Thanks, in advance.

2 comments
Comment actions Permalink

Default CommitCompletionContributor disables all subsequent completion providers (by calling `result.stopHere()`).

You should be able to specify `order` parameter in plugin.xml, so that your provider is processed before default one.
Ex: https://github.com/JetBrains/intellij-community/blob/master/platform/platform-resources/src/META-INF/LangExtensions.xml#L893

1
Comment actions Permalink

This is really what I was looking for! Thanks for your quick response!!!

0

Please sign in to leave a comment.