Skip to content

Commit

Permalink
feat(language): add Shire language support
Browse files Browse the repository at this point in the history
Add Shire language support with language definition, file type, icons, and plugin configuration.
  • Loading branch information
phodal committed May 31, 2024
1 parent 1b3f8e5 commit f351552
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 31 deletions.
23 changes: 23 additions & 0 deletions language/src/main/kotlin/com/phodal/shirelang/ShireFileType.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.phodal.shirelang

import com.intellij.openapi.fileTypes.FileType
import com.intellij.openapi.fileTypes.LanguageFileType
import com.intellij.openapi.vfs.VirtualFile
import javax.swing.Icon

class ShireFileType : LanguageFileType(ShireLanguage) {
override fun getName(): String = "DevInFile"

override fun getIcon(): Icon = ShireIcons.DEFAULT

override fun getDefaultExtension(): String = "shire"

override fun getCharset(file: VirtualFile, content: ByteArray): String = "UTF-8"

override fun getDescription(): String = "Shire file"

companion object {
val INSTANCE: FileType = ShireFileType()
}

}
13 changes: 13 additions & 0 deletions language/src/main/kotlin/com/phodal/shirelang/ShireIcons.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.phodal.shirelang

import com.intellij.openapi.util.IconLoader
import javax.swing.Icon

object ShireIcons {
@JvmField
val DEFAULT: Icon = IconLoader.getIcon("/icons/shire.svg", ShireIcons::class.java)
@JvmField
val COMMAND: Icon = IconLoader.getIcon("/icons/shire.svg", ShireIcons::class.java)
@JvmField
val Terminal: Icon = IconLoader.getIcon("/icons/terminal.svg", ShireIcons::class.java)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.phodal.shirelang

import com.intellij.lang.Language

object ShireLanguage : Language("Shire", "text/shire", "text/x-shire", "application/x-shire") {
val INSTANCE: Language = ShireLanguage
override fun isCaseSensitive() = true
override fun getDisplayName() = "Shire"
}
51 changes: 20 additions & 31 deletions language/src/main/resources/com.phodal.shirelang.xml
Original file line number Diff line number Diff line change
@@ -1,57 +1,46 @@
<idea-plugin package="com.phodal.shire">
<idea-plugin package="com.phodal.shirelang">
<dependencies>
<plugin id="org.intellij.plugins.markdown"/>
<plugin id="com.jetbrains.sh"/>
</dependencies>

<!-- <extensions defaultExtensionNs="com.intellij">-->
<!-- &lt;!&ndash; refs: https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/simple_language_plugin/src/main/resources/META-INF/plugin.xml&ndash;&gt;-->
<!-- <fileType name="ShireFile" implementationClass="com.phodal.shire.language.ShireFileType" fieldName="INSTANCE"-->
<!-- language="Shire" extensions="Shire"/>-->
<extensions defaultExtensionNs="com.intellij">
<!-- refs: https://github.com/JetBrains/intellij-sdk-code-samples/blob/main/simple_language_plugin/src/main/resources/META-INF/plugin.xml-->
<fileType name="ShireFile" implementationClass="com.phodal.shirelang.ShireFileType" fieldName="INSTANCE"
language="Shire" extensions="shire"/>

<!-- <lang.parserDefinition language="Shire"-->
<!-- implementationClass="com.phodal.shire.language.parser.ShireParserDefinition"/>-->
<!-- implementationClass="com.phodal.shirelang.parser.ShireParserDefinition"/>-->
<!-- <lang.syntaxHighlighterFactory language="Shire"-->
<!-- implementationClass="com.phodal.shire.language.highlight.ShireSyntaxHighlighterFactory"/>-->
<!-- implementationClass="com.phodal.shirelang.highlight.ShireSyntaxHighlighterFactory"/>-->

<!-- <lang.ast.factory language="Shire"-->
<!-- implementationClass="com.phodal.shire.language.ShireAstFactory"/>-->
<!-- implementationClass="com.phodal.shirelang.ShireAstFactory"/>-->

<!-- <typedHandler implementation="com.phodal.shire.language.ShireTypedHandler"/>-->
<!-- <typedHandler implementation="com.phodal.shirelang.ShireTypedHandler"/>-->

<!-- <completion.contributor language="Shire"-->
<!-- id="ShireCompletionContributor"-->
<!-- order="first"-->
<!-- implementationClass="com.phodal.shire.language.completion.ShireCompletionContributor"/>-->
<!-- implementationClass="com.phodal.shirelang.completion.ShireCompletionContributor"/>-->
<!-- <completion.contributor language="Shire"-->
<!-- order="after ShireCompletionContributor"-->
<!-- implementationClass="com.phodal.shire.language.completion.UserCustomCompletionContributor"/>-->
<!-- implementationClass="com.phodal.shirelang.completion.UserCustomCompletionContributor"/>-->

<!-- <lang.foldingBuilder language="Shire"-->
<!-- implementationClass="com.phodal.shire.language.folding.ShireCustomVariableFoldingBuilder"/>-->
<!-- implementationClass="com.phodal.shirelang.folding.ShireCustomVariableFoldingBuilder"/>-->
<!-- <lang.foldingBuilder language="Shire"-->
<!-- implementationClass="com.phodal.shire.language.folding.ShireFileReferenceFoldingBuilder"/>-->
<!-- implementationClass="com.phodal.shirelang.folding.ShireFileReferenceFoldingBuilder"/>-->

<!-- <languageInjector implementation="com.phodal.shire.language.ShireLanguageInjector"/>-->
<!-- <languageInjector implementation="com.phodal.shirelang.ShireLanguageInjector"/>-->


<!-- <configurationType implementation="com.phodal.shire.language.run.ShiresConfigurationType"/>-->
<!-- <programRunner implementation="com.phodal.shire.language.run.ShiresProgramRunner"/>-->
<!-- <runConfigurationBeforeRunProviderDelegate implementation="com.phodal.shire.language.run.ShiresBeforeRunProviderDelegate"/>-->
<!-- <runConfigurationProducer implementation="com.phodal.shire.language.run.ShiresRunConfigurationProducer"/>-->
<!-- <configurationType implementation="com.phodal.shirelang.run.ShiresConfigurationType"/>-->
<!-- <programRunner implementation="com.phodal.shirelang.run.ShiresProgramRunner"/>-->
<!-- <runConfigurationBeforeRunProviderDelegate implementation="com.phodal.shirelang.run.ShiresBeforeRunProviderDelegate"/>-->
<!-- <runConfigurationProducer implementation="com.phodal.shirelang.run.ShiresRunConfigurationProducer"/>-->
<!-- <runLineMarkerContributor language="Shire"-->
<!-- implementationClass="com.phodal.shire.language.run.ShiresRunLineMarkersProvider"/>-->
<!-- implementationClass="com.phodal.shirelang.run.ShiresRunLineMarkersProvider"/>-->

<!-- <lang.commenter language="Shire" implementationClass="com.phodal.shire.language.commenter.ShiresCommenter"/>-->

<!-- <lang.documentationProvider language="Shire"-->
<!-- id="ShiresDocumentationProvider"-->
<!-- implementationClass="com.phodal.shire.language.documentation.ShiresDocumentationProvider"/>-->

<!-- <localInspection language="Shire" groupPath="Shire" groupName="Lints"-->
<!-- displayName="Duplicate agent declaration"-->
<!-- enabledByDefault="true"-->
<!-- level="ERROR"-->
<!-- implementationClass="com.phodal.shire.language.lints.ShiresDuplicateAgentInspection"/>-->
<!-- </extensions>-->
</extensions>
</idea-plugin>
11 changes: 11 additions & 0 deletions language/src/main/resources/icons/shire.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions language/src/main/resources/icons/terminal.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions src/main/resources/META-INF/pluginIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f351552

Please sign in to comment.