completion_contributor.md: cleanup

This commit is contained in:
Yann Cébron 2021-04-28 17:24:39 +02:00
parent e4d1a7d8ed
commit 764dc59153

View File

@ -1,6 +1,6 @@
[//]: # (title: 9. Completion Contributor)
<!-- Copyright 2000-2020 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
<!-- Copyright 2000-2021 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -->
Custom languages provide code completion using one of two approaches: Contributor and Reference-based (see [10. Reference Contributor](reference_contributor.md)) completion.
@ -9,19 +9,19 @@ Custom languages provide code completion using one of two approaches: Contributo
## Define a Completion Contributor
For this tutorial, the `simple_language_plugin` provides custom completion for values in Simple Language property files.
Create a completion contributor by subclassing [`CompletionContributor`](upsource:///platform/analysis-api/src/com/intellij/codeInsight/completion/CompletionContributor.java).
This rudimentary completion contributor always adds "Hello" to the results set, regardless of context:
This rudimentary completion contributor always adds "Hello" to the completion variants result set, regardless of context:
```java
```
{src="simple_language_plugin/src/main/java/org/intellij/sdk/language/SimpleCompletionContributor.java"}
## Register the Completion Contributor
The `SimpleCompletionContributor` implementation is registered in the plugin configuration file with the IntelliJ Platform using the `com.intellij.completion.contributor` extension point.
The `SimpleCompletionContributor` implementation is registered in the plugin configuration file using the `com.intellij.completion.contributor` extension point.
```xml
<extensions defaultExtensionNs="com.intellij">
<completion.contributor language="Simple"
implementationClass="org.intellij.sdk.language.SimpleCompletionContributor"/>
implementationClass="org.intellij.sdk.language.SimpleCompletionContributor"/>
</extensions>
```