Skip to content

Commit d53c934

Browse files
authored
Document initialization options (#2464)
Document all initialization options In a discussion on a recent PR[1], it was mentioned that it would be helpful to document all of the initialization options. Something noteworthy is that Neovim's LspConfig uses `init_options` rather than the VSCode `initializationOptions`. Neovim converts `init_options` to `initializationOptions` under the hood. We can also roll the indexing section into the initialization options section. [1]: https://github.com/Shopify/ruby-lsp/pull/2445/files#r1722069148
1 parent 5b45af8 commit d53c934

File tree

1 file changed

+48
-16
lines changed

1 file changed

+48
-16
lines changed

EDITORS.md

Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,54 @@ If your version manager doesn't provide either of those, then activate the envir
4040
These strategies will ensure that the `ruby-lsp` executable is invoked with the correct Ruby version, `GEM_HOME` and
4141
`GEM_PATH`, which are necessary for proper integration with your project.
4242

43+
## All initialization options
44+
45+
Each LSP client can control various abilities of the LSP at startup. The following JSON dictionary contains all of the
46+
available initialization options. Generally, editor LSP clients will configure LSP servers using a dictionary in their
47+
configuration languages (JSON, Lua, ELisp, etc.).
48+
49+
```json
50+
{
51+
"initializationOptions": {
52+
"enabledFeatures": {
53+
"codeActions": true,
54+
"codeLens": true,
55+
"completion": true,
56+
"definition": true,
57+
"diagnostics": true,
58+
"documentHighlights": true,
59+
"documentLink": true,
60+
"documentSymbols": true,
61+
"foldingRanges": true,
62+
"formatting": true,
63+
"hover": true,
64+
"inlayHint": true,
65+
"onTypeFormatting": true,
66+
"selectionRanges": true,
67+
"semanticHighlighting": true,
68+
"signatureHelp": true,
69+
"typeHierarchy": true,
70+
"workspaceSymbol": true
71+
},
72+
"featuresConfiguration": {
73+
"inlayHint": {
74+
"implicitHashValue": true,
75+
"implicitRescue": true
76+
}
77+
},
78+
"indexing": {
79+
"excludedPatterns": ["path/to/excluded/file.rb"],
80+
"includedPatterns": ["path/to/included/file.rb"],
81+
"excludedGems": ["gem1", "gem2", "etc."],
82+
"excludedMagicComments": ["compiled:true"]
83+
},
84+
"formatter": "auto",
85+
"linters": [],
86+
"experimentalFeaturesEnabled": false
87+
}
88+
}
89+
```
90+
4391
<!-- When adding a new editor to the list, either link directly to a website containing the instructions or link to a
4492
new H2 header in this file containing the instructions. -->
4593

@@ -238,19 +286,3 @@ To use it with Ruby LSP, you can override particular configuration items in the
238286
Kate will start an instance of the Ruby LSP server in the background for any Ruby project matching the `rootIndicationFileNames`.
239287
If starting Ruby LSP succeeds, the entries in the LSP-Client menu are activated.
240288
Otherwise the error output can be inspected in the Output window.
241-
242-
# Indexing Configuration
243-
244-
To configure indexing, pass a JSON hash as part of the initialization options for your editor, for example:
245-
246-
```json
247-
{
248-
"indexing": {
249-
"excludedPatterns": ["**/test/**.rb"],
250-
"includedPatterns": ["**/bin/**"],
251-
"excludedGems": ["rubocop", "rubocop-performance"],
252-
"includedPatterns": ["rake"],
253-
"excludedMagicComments": ["compiled:true"]
254-
}
255-
}
256-
```

0 commit comments

Comments
 (0)