You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Syntax Tree additionally ships with a language server conforming to the [language server protocol](https://microsoft.github.io/language-server-protocol/). It can be invoked through the CLI by running:
178
+
Syntax Tree additionally ships with a minimal language server conforming to the [language server protocol](https://microsoft.github.io/language-server-protocol/) that registers a formatter for the Ruby language. It can be invoked through the CLI by running:
180
179
181
180
```sh
182
181
stree lsp
183
182
```
184
183
185
-
By default, the language server is relatively minimal, mostly meant to provide a registered formatter for the Ruby language. However there are a couple of additional niceties baked in. There are related projects that configure and use this language server within IDEs. For example, to use this code with VSCode, see [ruby-syntax-tree/vscode-syntax-tree](https://github.com/ruby-syntax-tree/vscode-syntax-tree).
186
-
187
-
### textDocument/formatting
188
-
189
-
As mentioned above, the language server responds to formatting requests with the formatted document. It typically responds on the order of tens of milliseconds, so it should be fast enough for any IDE.
190
-
191
-
### textDocument/inlayHint
192
-
193
-
The language server also responds to the relatively new inlay hints request. This request allows the language server to define additional information that should exist in the source code as helpful hints to the developer. In our case we use it to display things like implicit parentheses. For example, if you had the following code:
194
-
195
-
```ruby
196
-
1+2*3
197
-
```
198
-
199
-
Implicitly, the `2 * 3` is going to be executed first because the `*` operator has higher precedence than the `+` operator. To ease mental overhead, our language server includes small parentheses to make this explicit, as in:
200
-
201
-
```ruby
202
-
1+ ₍2*3₎
203
-
```
184
+
There are related projects that configure and use this language server within IDEs. For example, to use this code with VSCode, see [ruby-syntax-tree/vscode-syntax-tree](https://github.com/ruby-syntax-tree/vscode-syntax-tree).
0 commit comments