Skip to content

Commit a360de4

Browse files
committed
Initial JetBrains plugin setup
Migrate JetBrains plugin from main t-ruby repository: - Kotlin/Gradle plugin with IntelliJ Platform support - CI/CD workflows for JetBrains Marketplace - Plugin signing configuration - README with dynamic badges - Local publish script
1 parent 0b12deb commit a360de4

32 files changed

+1957
-1
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Setup Java
17+
uses: actions/setup-java@v4
18+
with:
19+
distribution: 'temurin'
20+
java-version: '21'
21+
22+
- name: Setup Gradle
23+
uses: gradle/actions/setup-gradle@v3
24+
25+
- name: Build plugin
26+
run: ./gradlew buildPlugin
27+
28+
- name: Verify plugin
29+
run: ./gradlew verifyPlugin
30+
31+
- name: Run tests
32+
run: ./gradlew test

.github/workflows/release.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Setup Java
16+
uses: actions/setup-java@v4
17+
with:
18+
distribution: 'temurin'
19+
java-version: '21'
20+
21+
- name: Setup Gradle
22+
uses: gradle/actions/setup-gradle@v3
23+
24+
- name: Build plugin
25+
run: ./gradlew buildPlugin
26+
27+
- name: Sign plugin
28+
run: ./gradlew signPlugin
29+
env:
30+
CERTIFICATE_CHAIN: ${{ secrets.CERTIFICATE_CHAIN }}
31+
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
32+
PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }}
33+
34+
- name: Publish to JetBrains Marketplace
35+
run: ./gradlew publishPlugin
36+
env:
37+
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
38+
39+
- name: Create GitHub Release
40+
uses: softprops/action-gh-release@v1
41+
with:
42+
files: 'build/distributions/*.zip'
43+
generate_release_notes: true
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Gradle
2+
.gradle/
3+
build/
4+
out/
5+
6+
# IDE
7+
.idea/
8+
*.iml
9+
10+
# IntelliJ Platform
11+
.intellijPlatform/
12+
13+
# OS
14+
.DS_Store
15+
Thumbs.db
16+
17+
# Secrets (signing keys, tokens)
18+
.secrets/

README.md

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,88 @@
1-
# t-ruby-jetbrains
1+
# T-Ruby for JetBrains IDEs
2+
3+
[![JetBrains Plugin](https://img.shields.io/jetbrains/plugin/v/29335-t-ruby?label=JetBrains%20Marketplace)](https://plugins.jetbrains.com/plugin/29335-t-ruby)
4+
[![JetBrains Downloads](https://img.shields.io/jetbrains/plugin/d/29335-t-ruby)](https://plugins.jetbrains.com/plugin/29335-t-ruby)
5+
[![T-Ruby Compiler](https://img.shields.io/gem/v/t-ruby?label=T-Ruby%20Compiler)](https://rubygems.org/gems/t-ruby)
6+
[![License](https://img.shields.io/github/license/type-ruby/t-ruby-jetbrains)](LICENSE)
7+
8+
T-Ruby language support for JetBrains IDEs. Provides syntax highlighting, LSP-based code intelligence, and development tools for [T-Ruby](https://github.com/type-ruby/t-ruby) - a TypeScript-style static type system for Ruby.
9+
10+
## Supported IDEs
11+
12+
- IntelliJ IDEA 2024.2+ (Ultimate & Community)
13+
- RubyMine 2024.2+
14+
- WebStorm 2024.2+
15+
- PyCharm 2024.2+
16+
- GoLand 2024.2+
17+
- And other JetBrains IDEs based on IntelliJ Platform 2024.2+
18+
19+
## Features
20+
21+
- Syntax highlighting for `.trb` and `.d.trb` files
22+
- LSP-based code intelligence (via LSP4IJ):
23+
- Real-time diagnostics (type errors)
24+
- Autocomplete suggestions
25+
- Go to definition
26+
- Hover information
27+
- Actions:
28+
- `Compile T-Ruby File` (Ctrl+Shift+T / Cmd+Shift+T)
29+
- `Generate Declaration File` (Ctrl+Shift+D / Cmd+Shift+D)
30+
31+
## Requirements
32+
33+
- [T-Ruby Compiler](https://github.com/type-ruby/t-ruby) (`trc`) must be installed and available in your PATH
34+
- [LSP4IJ](https://plugins.jetbrains.com/plugin/23257-lsp4ij) plugin (will be installed automatically as dependency)
35+
36+
```bash
37+
gem install t-ruby
38+
```
39+
40+
## Installation
41+
42+
Install from the [JetBrains Marketplace](https://plugins.jetbrains.com/plugin/29335-t-ruby):
43+
44+
1. Open your JetBrains IDE
45+
2. Go to Settings/Preferences → Plugins
46+
3. Search for "T-Ruby"
47+
4. Click Install
48+
49+
## Configuration
50+
51+
Configure the T-Ruby compiler path in:
52+
Settings/Preferences → Tools → T-Ruby
53+
54+
| Setting | Default | Description |
55+
|---------|---------|-------------|
56+
| `trc Path` | `trc` | Path to the T-Ruby compiler executable |
57+
| `Enable LSP` | `true` | Enable Language Server Protocol support |
58+
| `Enable Diagnostics` | `true` | Enable real-time diagnostics |
59+
| `Enable Completion` | `true` | Enable autocomplete suggestions |
60+
61+
## Compatibility
62+
63+
| Plugin Version | T-Ruby Compiler | JetBrains IDEs |
64+
|----------------|-----------------|----------------|
65+
| 0.1.x | >= 0.0.30 | 2024.2 - 2025.4 |
66+
67+
## Building from Source
68+
69+
```bash
70+
# Build the plugin
71+
./gradlew buildPlugin
72+
73+
# Run IDE with plugin for testing
74+
./gradlew runIde
75+
76+
# Run tests
77+
./gradlew test
78+
```
79+
80+
## Related
81+
82+
- [T-Ruby Compiler](https://github.com/type-ruby/t-ruby) - The main T-Ruby compiler
83+
- [T-Ruby VS Code](https://github.com/type-ruby/t-ruby-vscode) - VS Code extension
84+
- [T-Ruby Vim](https://github.com/type-ruby/t-ruby-vim) - Vim/Neovim plugin
85+
86+
## License
87+
88+
MIT

build.gradle.kts

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
plugins {
2+
id("java")
3+
id("org.jetbrains.kotlin.jvm") version "1.9.25"
4+
id("org.jetbrains.intellij.platform") version "2.2.1"
5+
}
6+
7+
group = "io.truby"
8+
version = "0.1.5"
9+
10+
repositories {
11+
mavenCentral()
12+
intellijPlatform {
13+
defaultRepositories()
14+
}
15+
}
16+
17+
dependencies {
18+
intellijPlatform {
19+
intellijIdeaCommunity("2024.2")
20+
plugin("com.redhat.devtools.lsp4ij:0.19.0")
21+
bundledPlugin("org.jetbrains.plugins.textmate")
22+
pluginVerifier()
23+
zipSigner()
24+
testFramework(org.jetbrains.intellij.platform.gradle.TestFrameworkType.Platform)
25+
}
26+
27+
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
28+
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
29+
}
30+
31+
intellijPlatform {
32+
pluginConfiguration {
33+
id = "io.truby.t-ruby"
34+
name = "T-Ruby"
35+
version = project.version.toString()
36+
description = """
37+
<p><b>T-Ruby</b> is a typed superset of Ruby, inspired by TypeScript.
38+
Add static type checking to your Ruby projects and catch errors before runtime.</p>
39+
40+
<h3>Features</h3>
41+
<ul>
42+
<li><b>Syntax Highlighting</b> - Full support for .trb and .d.trb files</li>
43+
<li><b>Code Completion</b> - Type-aware autocompletion</li>
44+
<li><b>Real-time Diagnostics</b> - See type errors as you type</li>
45+
<li><b>Go to Definition</b> - Navigate to symbols with Ctrl+Click</li>
46+
<li><b>Hover Information</b> - View type information on hover</li>
47+
<li><b>Compile Commands</b> - Compile .trb to .rb directly from IDE</li>
48+
</ul>
49+
50+
<h3>Requirements</h3>
51+
<ul>
52+
<li><a href="https://rubygems.org/gems/t-ruby">T-Ruby compiler</a> (gem install t-ruby)</li>
53+
<li><a href="https://plugins.jetbrains.com/plugin/23257-lsp4ij">LSP4IJ plugin</a></li>
54+
</ul>
55+
56+
<h3>Quick Start</h3>
57+
<ol>
58+
<li>Install T-Ruby: <code>gem install t-ruby</code></li>
59+
<li>Install LSP4IJ plugin</li>
60+
<li>Install this plugin</li>
61+
<li>Create a .trb file and start coding!</li>
62+
</ol>
63+
64+
<p>Learn more at <a href="https://type-ruby.github.io">type-ruby.github.io</a></p>
65+
""".trimIndent()
66+
changeNotes = """
67+
<h3>0.1.2</h3>
68+
<ul>
69+
<li>Extended IDE compatibility (2024.2 - 2025.4)</li>
70+
<li>Improved plugin description and documentation</li>
71+
<li>Added plugin icon for JetBrains Marketplace</li>
72+
</ul>
73+
74+
<h3>0.1.1 - Initial Release</h3>
75+
<ul>
76+
<li>JetBrains Marketplace initial release</li>
77+
<li>LSP integration via LSP4IJ for language server support</li>
78+
<li>TextMate grammar for syntax highlighting</li>
79+
<li>File type support for .trb and .d.trb</li>
80+
<li>Compile T-Ruby file action (Ctrl+Shift+T / Cmd+Shift+T)</li>
81+
<li>Generate declaration file action (Ctrl+Shift+D / Cmd+Shift+D)</li>
82+
</ul>
83+
""".trimIndent()
84+
vendor {
85+
name = "T-Ruby"
86+
87+
url = "https://type-ruby.github.io"
88+
}
89+
ideaVersion {
90+
sinceBuild = "242"
91+
untilBuild = "254.*"
92+
}
93+
}
94+
95+
signing {
96+
certificateChain = providers.environmentVariable("CERTIFICATE_CHAIN")
97+
privateKey = providers.environmentVariable("PRIVATE_KEY")
98+
password = providers.environmentVariable("PRIVATE_KEY_PASSWORD")
99+
}
100+
101+
publishing {
102+
token = providers.environmentVariable("PUBLISH_TOKEN")
103+
}
104+
}
105+
106+
kotlin {
107+
jvmToolchain(21)
108+
}
109+
110+
tasks {
111+
buildSearchableOptions {
112+
enabled = false
113+
}
114+
115+
test {
116+
useJUnitPlatform()
117+
}
118+
}

gradle.properties

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Gradle settings
2+
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
3+
org.gradle.caching=true
4+
org.gradle.parallel=true
5+
6+
# Kotlin settings
7+
kotlin.code.style=official
8+
kotlin.stdlib.default.dependency=false
9+
10+
# IntelliJ Platform Gradle Plugin
11+
platformType=IC
12+
platformVersion=2024.2

gradle/wrapper/gradle-wrapper.jar

42.6 KB
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)