generated from JetBrains/intellij-platform-plugin-template
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(completion): add DevInCompletionContributor and remove deprecate…
…d TypedHandler from plugin.xml #101 The `DevInCompletionContributor` class has been added to provide code completion functionality for the DevIn language. This includes the `VariableProvider` class to suggest variables during code completion. Additionally, the deprecated `TypedHandler` has been commented out and a new `completion.contributor` extension has been added to the plugin descriptor (`cc.unitmesh.language.xml`) to register the new completion contributor.
- Loading branch information
Showing
3 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
exts/devin-lang/src/main/kotlin/cc/unitmesh/language/DevInCompletionContributor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package cc.unitmesh.language | ||
|
||
import cc.unitmesh.language.completion.VariableProvider | ||
import cc.unitmesh.language.psi.DevInTypes | ||
import com.intellij.codeInsight.completion.CompletionContributor | ||
import com.intellij.codeInsight.completion.CompletionType | ||
import com.intellij.patterns.PlatformPatterns.psiElement | ||
|
||
class DevInCompletionContributor : CompletionContributor() { | ||
init { | ||
extend(CompletionType.BASIC, psiElement(DevInTypes.IDENTIFIER), VariableProvider()) | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
exts/devin-lang/src/main/kotlin/cc/unitmesh/language/completion/VariableProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package cc.unitmesh.language.completion | ||
|
||
import com.intellij.codeInsight.completion.CompletionParameters | ||
import com.intellij.codeInsight.completion.CompletionProvider | ||
import com.intellij.codeInsight.completion.CompletionResultSet | ||
import com.intellij.util.ProcessingContext | ||
|
||
class VariableProvider: CompletionProvider<CompletionParameters>() { | ||
override fun addCompletions( | ||
parameters: CompletionParameters, | ||
context: ProcessingContext, | ||
result: CompletionResultSet, | ||
) { | ||
// CustomVariable.all.forEach { | ||
// result.addElement(it.toLookupElement()) | ||
// } | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters