Skip to content

Commit

Permalink
feat: add line marker for struct
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Sep 28, 2022
1 parent 7e5646c commit 962a48f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@file:Suppress("Indentation", "ParameterListWrapping")

package com.feakin.intellij.linemarkers

import com.feakin.intellij.ide.editor.elementType
import com.feakin.intellij.psi.FeakinStructDeclaration
import com.intellij.execution.lineMarker.ExecutorAction
import com.intellij.execution.lineMarker.RunLineMarkerContributor
import com.intellij.icons.AllIcons
import com.intellij.psi.PsiElement

class FkCreateStructLineMarkerProvider : RunLineMarkerContributor() {
override fun getInfo(element: PsiElement): Info? {
if (element !is FeakinStructDeclaration) return null

val actions = ExecutorAction.getActions(0)
return Info(
AllIcons.RunConfigurations.TestState.Run,
{ psiElement -> actions.mapNotNull { getText(it, psiElement) }.joinToString("\n") },
*actions
)
}
}
10 changes: 8 additions & 2 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@

<!-- Parser -->

<lang.parserDefinition language="Feakin" implementationClass="com.feakin.intellij.parser.FeakinParserDefinition"/>
<lang.parserDefinition language="Feakin"
implementationClass="com.feakin.intellij.parser.FeakinParserDefinition"/>
<stubElementTypeHolder class="com.feakin.intellij.lexer.FeakinElementTypes"/>

<lang.syntaxHighlighter language="Feakin"
implementationClass="com.feakin.intellij.highlight.FeakinSyntaxHighlighter"/>
implementationClass="com.feakin.intellij.highlight.FeakinSyntaxHighlighter"/>

<lang.psiStructureViewFactory language="Feakin"
implementationClass="com.feakin.intellij.structure.FeakinStructureViewFactory"/>
Expand All @@ -44,5 +45,10 @@
implementationClass="com.feakin.intellij.completion.FkKeywordCompletionContributor"
id="FkKeywordCompletionContributor"
order="first"/>


<runLineMarkerContributor language="Feakin"
implementationClass="com.feakin.intellij.linemarkers.FkCreateStructLineMarkerProvider"/>

</extensions>
</idea-plugin>

0 comments on commit 962a48f

Please sign in to comment.