|
| 1 | +<p align="center"> |
| 2 | + <img src="https://avatars.githubusercontent.com/u/248530250" alt="T-Ruby" height="120"> |
| 3 | +</p> |
| 4 | + |
| 5 | +<h1 align="center">T-Ruby for JetBrains</h1> |
| 6 | + |
| 7 | +<p align="center"> |
| 8 | + <a href="https://type-ruby.github.io">Official Website</a> |
| 9 | + • |
| 10 | + <a href="https://github.com/type-ruby/t-ruby">GitHub</a> |
| 11 | + • |
| 12 | + <a href="https://plugins.jetbrains.com/plugin/29335-t-ruby">JetBrains Marketplace</a> |
| 13 | +</p> |
| 14 | + |
| 15 | +--- |
| 16 | + |
| 17 | +Welcome to T-Ruby for JetBrains! This guide will help you install and configure the T-Ruby plugin for a seamless typed Ruby development experience. |
| 18 | + |
| 19 | +> **Note**: This plugin works with all JetBrains IDEs including IntelliJ IDEA, RubyMine, WebStorm, and more. |
| 20 | +
|
| 21 | +## Prerequisites |
| 22 | + |
| 23 | +Before installing the plugin, ensure you have: |
| 24 | + |
| 25 | +- **JetBrains IDE** 2023.1 or higher (IntelliJ IDEA, RubyMine, WebStorm, etc.) |
| 26 | +- **Ruby** 3.0 or higher |
| 27 | +- **T-Ruby Compiler** (`trc`) installed and available in your PATH |
| 28 | + |
| 29 | +### Installing T-Ruby Compiler |
| 30 | + |
| 31 | +```bash |
| 32 | +# Install via gem (recommended) |
| 33 | +gem install t-ruby |
| 34 | +``` |
| 35 | + |
| 36 | +Verify the installation: |
| 37 | +```bash |
| 38 | +trc --version |
| 39 | +``` |
| 40 | + |
| 41 | +## Installation |
| 42 | + |
| 43 | +### Method 1: JetBrains Marketplace (Recommended) |
| 44 | + |
| 45 | +1. Open your JetBrains IDE |
| 46 | +2. Go to `Settings/Preferences` > `Plugins` |
| 47 | +3. Search for "T-Ruby" in the `Marketplace` tab |
| 48 | +4. Click **Install** |
| 49 | +5. Restart the IDE |
| 50 | + |
| 51 | +Or install directly from the [JetBrains Marketplace](https://plugins.jetbrains.com/plugin/29335-t-ruby). |
| 52 | + |
| 53 | +### Method 2: Install from Disk (Coming Soon) |
| 54 | + |
| 55 | +1. Download the `.zip` file from [Releases](https://github.com/type-ruby/t-ruby/releases) |
| 56 | +2. Go to `Settings/Preferences` > `Plugins` |
| 57 | +3. Click the gear icon > `Install Plugin from Disk...` |
| 58 | +4. Select the downloaded file |
| 59 | + |
| 60 | +### Method 3: Build from Source |
| 61 | + |
| 62 | +```bash |
| 63 | +# Clone the repository |
| 64 | +git clone https://github.com/type-ruby/t-ruby.git |
| 65 | +cd t-ruby/editors/jetbrains |
| 66 | + |
| 67 | +# Build with Gradle |
| 68 | +./gradlew buildPlugin |
| 69 | + |
| 70 | +# The built plugin will be in build/distributions/ |
| 71 | +``` |
| 72 | + |
| 73 | +## Configuration |
| 74 | + |
| 75 | +After installation, configure the plugin in `Settings/Preferences` > `Languages & Frameworks` > `T-Ruby`: |
| 76 | + |
| 77 | +### Configuration Options |
| 78 | + |
| 79 | +| Option | Default | Description | |
| 80 | +|--------|---------|-------------| |
| 81 | +| T-Ruby Compiler Path | `trc` | Path to T-Ruby compiler | |
| 82 | +| Enable Real-time Diagnostics | `true` | Check errors while typing | |
| 83 | +| Enable Autocomplete | `true` | Type-based autocompletion | |
| 84 | + |
| 85 | +## Features |
| 86 | + |
| 87 | +### Syntax Highlighting |
| 88 | + |
| 89 | +The plugin provides full syntax highlighting for: |
| 90 | +- `.trb` files (T-Ruby source files) |
| 91 | +- `.d.trb` files (T-Ruby declaration files) |
| 92 | + |
| 93 | +Type annotations, interfaces, and type aliases are highlighted distinctly. |
| 94 | + |
| 95 | +### IntelliSense |
| 96 | + |
| 97 | +- **Autocomplete**: Type suggestions for parameters and return types |
| 98 | +- **Hover**: View type information by hovering over symbols |
| 99 | +- **Go to Definition**: `Ctrl+Click` to navigate to type/function definitions |
| 100 | + |
| 101 | +### Diagnostics |
| 102 | + |
| 103 | +Real-time error checking for: |
| 104 | +- Unknown types |
| 105 | +- Duplicate definitions |
| 106 | +- Syntax errors |
| 107 | + |
| 108 | +### Actions |
| 109 | + |
| 110 | +Access via `Find Action` (`Ctrl+Shift+A` / `Cmd+Shift+A`): |
| 111 | + |
| 112 | +| Action | Description | |
| 113 | +|--------|-------------| |
| 114 | +| `T-Ruby: Compile Current File` | Compile the active `.trb` file | |
| 115 | +| `T-Ruby: Generate Declaration File` | Generate `.d.trb` from source | |
| 116 | + |
| 117 | +## Quick Start Example |
| 118 | + |
| 119 | +1. Create a new file `hello.trb`: |
| 120 | + |
| 121 | +```trb |
| 122 | +type UserId = String |
| 123 | +
|
| 124 | +interface User |
| 125 | + id: UserId |
| 126 | + name: String |
| 127 | + age: Integer |
| 128 | +end |
| 129 | +
|
| 130 | +def greet(user: User): String |
| 131 | + "Hello, #{user.name}!" |
| 132 | +end |
| 133 | +``` |
| 134 | + |
| 135 | +2. Save the file - you'll see syntax highlighting and real-time diagnostics |
| 136 | + |
| 137 | +3. Hover over types to see their definitions |
| 138 | + |
| 139 | +4. Use `Ctrl+Space` for autocomplete suggestions |
| 140 | + |
| 141 | +## Troubleshooting |
| 142 | + |
| 143 | +### Plugin not working |
| 144 | + |
| 145 | +1. Check if `trc` is installed: `which trc` |
| 146 | +2. Verify the path in settings: `Settings` > `Languages & Frameworks` > `T-Ruby` |
| 147 | +3. Check IDE logs: `Help` > `Show Log in Finder/Explorer` |
| 148 | + |
| 149 | +### No syntax highlighting |
| 150 | + |
| 151 | +1. Ensure file has `.trb` or `.d.trb` extension |
| 152 | +2. Check file type association: `Settings` > `Editor` > `File Types` |
| 153 | + |
| 154 | +### Performance issues |
| 155 | + |
| 156 | +- Disable diagnostics for large files |
| 157 | +- Restart the IDE |
| 158 | + |
| 159 | +## Next Steps |
| 160 | + |
| 161 | +- [Syntax Highlighting Guide](../../syntax-highlighting/en/guide.md) |
| 162 | +- [T-Ruby Language Reference](https://github.com/type-ruby/t-ruby/wiki) |
| 163 | +- [Report Issues](https://github.com/type-ruby/t-ruby/issues) |
| 164 | + |
| 165 | +## Support |
| 166 | + |
| 167 | +For questions and bug reports, please visit GitHub Issues: |
| 168 | +https://github.com/type-ruby/t-ruby/issues |
0 commit comments