Skip to content

Commit f373582

Browse files
committed
feat(jetbrains): add TextMate syntax highlighting support
Register TextMate bundle provider to enable proper syntax highlighting for .trb files in JetBrains IDEs. Previously, the TextMate grammar file existed but was not registered with the IDE.
1 parent 9f2e0b2 commit f373582

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

‎editors/jetbrains/build.gradle.kts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ dependencies {
1818
intellijPlatform {
1919
intellijIdeaCommunity("2024.2")
2020
plugin("com.redhat.devtools.lsp4ij:0.19.0")
21+
bundledPlugin("org.jetbrains.plugins.textmate")
2122
pluginVerifier()
2223
zipSigner()
2324
testFramework(org.jetbrains.intellij.platform.gradle.TestFrameworkType.Platform)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package io.truby.intellij
2+
3+
import org.jetbrains.plugins.textmate.api.TextMateBundleProvider
4+
import java.nio.file.Path
5+
6+
/**
7+
* TextMate bundle provider for T-Ruby syntax highlighting.
8+
*
9+
* This class provides the TextMate grammar bundle to JetBrains IDEs,
10+
* enabling syntax highlighting for .trb and .d.trb files.
11+
*/
12+
class TRubyTextMateBundleProvider : TextMateBundleProvider {
13+
override fun getBundles(): List<TextMateBundleProvider.PluginBundle> {
14+
val bundlePath = javaClass.getResource("/syntaxes")?.toURI()?.let { Path.of(it) }
15+
?: return emptyList()
16+
17+
return listOf(
18+
TextMateBundleProvider.PluginBundle("T-Ruby", bundlePath)
19+
)
20+
}
21+
}

‎editors/jetbrains/src/main/resources/META-INF/plugin.xml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<depends>com.intellij.modules.platform</depends>
2828
<depends>com.intellij.modules.lang</depends>
2929
<depends>com.redhat.devtools.lsp4ij</depends>
30+
<depends>org.jetbrains.plugins.textmate</depends>
3031

3132
<extensions defaultExtensionNs="com.intellij">
3233
<!-- File Type Registration -->
@@ -53,6 +54,9 @@
5354

5455
<applicationService
5556
serviceImplementation="io.truby.intellij.settings.TRubySettings"/>
57+
58+
<!-- TextMate Bundle Provider for Syntax Highlighting -->
59+
<textmate.bundleProvider implementation="io.truby.intellij.TRubyTextMateBundleProvider"/>
5660
</extensions>
5761

5862
<extensions defaultExtensionNs="com.redhat.devtools.lsp4ij">

0 commit comments

Comments
 (0)