Skip to content

Commit

Permalink
Document initialization options (#2464)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
neanias authored Aug 26, 2024
1 parent 5b45af8 commit d53c934
Showing 1 changed file with 48 additions and 16 deletions.
64 changes: 48 additions & 16 deletions EDITORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,54 @@ If your version manager doesn't provide either of those, then activate the envir
These strategies will ensure that the `ruby-lsp` executable is invoked with the correct Ruby version, `GEM_HOME` and
`GEM_PATH`, which are necessary for proper integration with your project.

## All initialization options

Each LSP client can control various abilities of the LSP at startup. The following JSON dictionary contains all of the
available initialization options. Generally, editor LSP clients will configure LSP servers using a dictionary in their
configuration languages (JSON, Lua, ELisp, etc.).

```json
{
"initializationOptions": {
"enabledFeatures": {
"codeActions": true,
"codeLens": true,
"completion": true,
"definition": true,
"diagnostics": true,
"documentHighlights": true,
"documentLink": true,
"documentSymbols": true,
"foldingRanges": true,
"formatting": true,
"hover": true,
"inlayHint": true,
"onTypeFormatting": true,
"selectionRanges": true,
"semanticHighlighting": true,
"signatureHelp": true,
"typeHierarchy": true,
"workspaceSymbol": true
},
"featuresConfiguration": {
"inlayHint": {
"implicitHashValue": true,
"implicitRescue": true
}
},
"indexing": {
"excludedPatterns": ["path/to/excluded/file.rb"],
"includedPatterns": ["path/to/included/file.rb"],
"excludedGems": ["gem1", "gem2", "etc."],
"excludedMagicComments": ["compiled:true"]
},
"formatter": "auto",
"linters": [],
"experimentalFeaturesEnabled": false
}
}
```

<!-- When adding a new editor to the list, either link directly to a website containing the instructions or link to a
new H2 header in this file containing the instructions. -->

Expand Down Expand Up @@ -238,19 +286,3 @@ To use it with Ruby LSP, you can override particular configuration items in the
Kate will start an instance of the Ruby LSP server in the background for any Ruby project matching the `rootIndicationFileNames`.
If starting Ruby LSP succeeds, the entries in the LSP-Client menu are activated.
Otherwise the error output can be inspected in the Output window.

# Indexing Configuration

To configure indexing, pass a JSON hash as part of the initialization options for your editor, for example:

```json
{
"indexing": {
"excludedPatterns": ["**/test/**.rb"],
"includedPatterns": ["**/bin/**"],
"excludedGems": ["rubocop", "rubocop-performance"],
"includedPatterns": ["rake"],
"excludedMagicComments": ["compiled:true"]
}
}
```

0 comments on commit d53c934

Please sign in to comment.