T-Ruby for VS Code & Cursor
Official Website
•
GitHub
•
VS Code Marketplace
•
Cursor Marketplace
VS Code
Cursor (Open VSX)
T-Ruby language support for VS Code and Cursor. Provides syntax highlighting, LSP-based code intelligence, and development tools for T-Ruby - a TypeScript-style static type system for Ruby.
Note: This extension shares the same source code for both VS Code and Cursor, providing identical functionality in both editors.
Requirements
gem install t-ruby
Installation
VS Code
Install from the Visual Studio Marketplace:
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Search for "T-Ruby"
- Click Install
Or install via command line:
code --install-extension t-ruby.t-ruby
Cursor
Install from the Open VSX Registry:
- Open Cursor
- Go to Extensions (Ctrl+Shift+X)
- Search for "T-Ruby"
- Click Install
Configuration
After installation, configure the extension in VS Code settings (Ctrl+,):
{
"t-ruby.lspPath": "trc",
"t-ruby.enableLSP": true,
"t-ruby.diagnostics.enable": true,
"t-ruby.completion.enable": true
}
Configuration Options
| Option |
Type |
Default |
Description |
t-ruby.lspPath |
string |
"trc" |
Path to T-Ruby compiler |
t-ruby.enableLSP |
boolean |
true |
Enable Language Server |
t-ruby.diagnostics.enable |
boolean |
true |
Enable real-time diagnostics |
t-ruby.completion.enable |
boolean |
true |
Enable autocomplete |
Features
Syntax Highlighting
The extension provides full syntax highlighting for:
.trb files (T-Ruby source files)
.d.trb files (T-Ruby declaration files)
Type annotations, interfaces, and type aliases are highlighted distinctly.
IntelliSense
- Autocomplete: Type suggestions for parameters and return types
- Hover: View type information by hovering over symbols
- Go to Definition: Navigate to type/function definitions
Diagnostics
Real-time error checking for:
- Unknown types
- Duplicate definitions
- Syntax errors
Commands
Access via Command Palette (Ctrl+Shift+P):
| Command |
Description |
T-Ruby: Compile Current File |
Compile the active .trb file |
T-Ruby: Generate Declaration File |
Generate .d.trb from source |
T-Ruby: Restart Language Server |
Restart the LSP server |
Quick Start Example
- Create a new file
hello.trb:
type UserId = String
interface User
id: UserId
name: String
age: Integer
end
def greet(user: User): String
"Hello, #{user.name}!"
end
Save the file - you'll see syntax highlighting and real-time diagnostics
Hover over types to see their definitions
Use Ctrl+Space for autocomplete suggestions
Troubleshooting
LSP not starting
- Check if
trc is installed: which trc
- Verify the path in settings:
t-ruby.lspPath
- Check Output panel: View > Output > T-Ruby Language Server
No syntax highlighting
- Ensure file has
.trb or .d.trb extension
- Check file association: View > Command Palette > "Change Language Mode"
- Disable diagnostics for large files:
"t-ruby.diagnostics.enable": false
- Restart the language server: Command Palette > "T-Ruby: Restart Language Server"
Contributing
Issues and pull requests are welcome!
https://github.com/type-ruby/t-ruby-vscode/issues
License
BSD 2-Clause