mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-30 18:27:49 +08:00
completion_contributor.md: cleanup
This commit is contained in:
parent
e4d1a7d8ed
commit
764dc59153
@ -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>
|
||||
```
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user