@ruby-fast/lsp 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +122 -0
- package/package.json +5 -5
package/README.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Ruby Fast LSP
|
|
2
|
+
|
|
3
|
+
A high-performance Ruby Language Server written in Rust, built to power both AI coding agents and traditional editors with fast, accurate code intelligence.
|
|
4
|
+
|
|
5
|
+
## Why Ruby Fast LSP
|
|
6
|
+
|
|
7
|
+
AI coding agents like Claude Code, Cursor, and Windsurf rely on Language Server Protocol features to understand codebases, validate their own edits, and navigate code with precision. Ruby deserves a language server that treats these agent workflows as first-class.
|
|
8
|
+
|
|
9
|
+
Ruby Fast LSP is designed around the features that matter most for agent-assisted development:
|
|
10
|
+
|
|
11
|
+
- **Diagnostics** that catch errors in real time, so agents can self-correct without running a build
|
|
12
|
+
- **Go to Definition** and **Find References** for precise, type-aware navigation instead of text search
|
|
13
|
+
- **Hover** with type signatures, so agents understand what they're working with
|
|
14
|
+
- **Workspace Symbols** for systematic codebase exploration
|
|
15
|
+
|
|
16
|
+
Written in Rust with millisecond response times, it handles large Ruby codebases without becoming a bottleneck.
|
|
17
|
+
|
|
18
|
+
## Type Inference
|
|
19
|
+
|
|
20
|
+
At the core of Ruby Fast LSP is Yard & RBS backed type inference engine that gives diagnostics and navigation real accuracy, not just syntax awareness.
|
|
21
|
+
|
|
22
|
+
- Resolves standard library types through RBS definitions
|
|
23
|
+
- Handles generic substitution (e.g., `Array[Integer]#first` resolves to `Integer`)
|
|
24
|
+
- Walks ancestor chains across includes, prepends, and inheritance
|
|
25
|
+
- Validates return types against YARD and RBS annotations
|
|
26
|
+
- Understands union types (eg. `User, nil`) for accurate nullability and branch analysis
|
|
27
|
+
- Powers unresolved method and constant detection
|
|
28
|
+
|
|
29
|
+
You can guide the engine with simple YARD annotations on your methods:
|
|
30
|
+
|
|
31
|
+
```ruby
|
|
32
|
+
# @param name [String]
|
|
33
|
+
# @return [User, nil]
|
|
34
|
+
def find_by_name(name)
|
|
35
|
+
# ...
|
|
36
|
+
end
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
This is enough for the LSP to resolve return types, validate callers, and propagate types through method chains. No separate type files or complex setup required.
|
|
40
|
+
|
|
41
|
+
This is what makes the difference between a language server that can grep and one that can reason about Ruby code.
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
### npm (recommended)
|
|
46
|
+
|
|
47
|
+
Install the language server binary globally:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm install -g @ruby-fast/lsp
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
This makes the `ruby-fast-lsp` binary available in your PATH.
|
|
54
|
+
|
|
55
|
+
### Building from Source
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
cargo build --release
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The binary will be at `target/release/ruby-fast-lsp`.
|
|
62
|
+
|
|
63
|
+
## Setup
|
|
64
|
+
|
|
65
|
+
### Claude Code
|
|
66
|
+
|
|
67
|
+
1. Install the binary globally via npm (see above).
|
|
68
|
+
|
|
69
|
+
2. Add the language server to your Claude Code settings. Edit `~/.claude/settings.json`:
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"lspServers": {
|
|
74
|
+
"ruby": {
|
|
75
|
+
"command": "ruby-fast-lsp",
|
|
76
|
+
"args": ["--stdio"],
|
|
77
|
+
"extensionToLanguage": {
|
|
78
|
+
".rb": "ruby",
|
|
79
|
+
".rake": "ruby",
|
|
80
|
+
".gemspec": "ruby"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
3. Restart Claude Code. The language server will start automatically when you work with Ruby files, providing diagnostics, navigation, and type information.
|
|
88
|
+
|
|
89
|
+
For project-specific configuration, add the same `lspServers` block to `.claude/settings.json` in your project root instead.
|
|
90
|
+
|
|
91
|
+
### VS Code
|
|
92
|
+
|
|
93
|
+
1. Install the extension from the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=naveenraj.ruby-fast-lsp).
|
|
94
|
+
2. Open a Ruby project. The server starts automatically and indexes your workspace.
|
|
95
|
+
|
|
96
|
+
### Cursor, Windsurf, and Other VS Code Forks
|
|
97
|
+
|
|
98
|
+
Editors based on VS Code that use the [Open VSX Registry](https://open-vsx.org/) can install the extension from:
|
|
99
|
+
|
|
100
|
+
[open-vsx.org/extension/naveenraj/ruby-fast-lsp](https://open-vsx.org/extension/naveenraj/ruby-fast-lsp)
|
|
101
|
+
|
|
102
|
+
### Other Editors
|
|
103
|
+
|
|
104
|
+
Any editor that supports LSP can use Ruby Fast LSP. Start the server with:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
ruby-fast-lsp --stdio
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Configure your editor's LSP client to connect via stdio with language ID `ruby`.
|
|
111
|
+
|
|
112
|
+
## See Also
|
|
113
|
+
|
|
114
|
+
- [Ruby Fast Cop](https://github.com/rajnaveen344/ruby-fast-cop) - A high-performance Ruby linter written in Rust, designed as a companion to Ruby Fast LSP.
|
|
115
|
+
|
|
116
|
+
## Contributing
|
|
117
|
+
|
|
118
|
+
Issues and feature requests welcome on [GitHub](https://github.com/rajnaveen344/ruby-fast-lsp).
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
|
|
122
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ruby-fast/lsp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "A fast Language Server Protocol implementation for Ruby",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"README.md"
|
|
16
16
|
],
|
|
17
17
|
"optionalDependencies": {
|
|
18
|
-
"@ruby-fast/lsp-darwin-arm64": "0.2.
|
|
19
|
-
"@ruby-fast/lsp-darwin-x64": "0.2.
|
|
20
|
-
"@ruby-fast/lsp-linux-x64": "0.2.
|
|
21
|
-
"@ruby-fast/lsp-win32-x64": "0.2.
|
|
18
|
+
"@ruby-fast/lsp-darwin-arm64": "0.2.3",
|
|
19
|
+
"@ruby-fast/lsp-darwin-x64": "0.2.3",
|
|
20
|
+
"@ruby-fast/lsp-linux-x64": "0.2.3",
|
|
21
|
+
"@ruby-fast/lsp-win32-x64": "0.2.3"
|
|
22
22
|
}
|
|
23
23
|
}
|