From d53c9344c0ac8e5c9864a6a7ca6454617df1c09b Mon Sep 17 00:00:00 2001 From: William Mathewson Date: Mon, 26 Aug 2024 14:28:56 +0100 Subject: [PATCH] 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 --- EDITORS.md | 64 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 48 insertions(+), 16 deletions(-) diff --git a/EDITORS.md b/EDITORS.md index 80e64f587..a92c97bc8 100644 --- a/EDITORS.md +++ b/EDITORS.md @@ -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 + } +} +``` + @@ -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"] - } -} -```