Repository: neovim/neovim
File: runtime/lua/vim/lsp.lua (Lua)

Code before:
---
--- ```lua
---   root_markers = { { 'stylua.toml', '.luarc.json' }, '.git' }
--- ```
---
--- Looks for both `.stylua.toml` and `.luarc.json` (in this order) in every
--- directory going up, if none of them is found it does the same for `.git`.
--- @field root_markers? (string|string[])[]
---
--- Directory where the LSP server will base its workspaceFolders, rootUri, and
--- rootPath on initialization. If a function, it is passed the buffer number
--- and a callback argument which must be called with the value of root_dir to
--- use. The LSP server will not be started until the callback is called.
--- @field root_dir? string|fun(bufnr: integer, cb:fun(root_dir?:string))
---
--- Predicate used to decide if a client should be re-used. Used on all
--- running clients. The default implementation re-uses a client if name and
--- root_dir matches.
--- @field reuse_client? fun(client: vim.lsp.Client, config: vim.lsp.ClientConfig): boolean

--- Sets the default configuration for an LSP client (or _all_ clients if the special name "*" is
--- used).
---
--- Can also be accessed by table-indexing (`vim.lsp.config[…]`) to get the resolved config, or
--- redefine the config (instead of "merging" with the config chain).
---
--- Examples:
---
--- - Add root markers for ALL clients:
---   ```lua
---   vim.lsp.config('*', {
---       root_markers = { '.git', '.hg' },
---     })
---   ```
--- - Add capabilities to ALL clients:
---   ```lua
---   vim.lsp.config('*', {
---     capabilities = {
---       textDocument = {
---         semanticTokens = {
---           multilineTokenSupport = true,
---         }
---       }
---     }
---   })
---   ```
--- - Add root markers and capabilities for "clangd":
---   ```lua
---   vim.lsp.config('clangd', {
---     root_markers = { '.clang-format', 'compile_commands.json' },
---     capabilities = {

Review comment (suggestion):
```suggestion
--- Example:
---
--- ```lua
---   root_markers = { 'stylua.toml', '.git' }
--- ```
---
--- Find the first parent directory containing the file `stylua.toml`. If not
--- found, find the first parent directory containing the file or directory
--- `.git`.
---
--- Example:
---
--- ```lua
---   root_markers = { { 'stylua.toml', '.luarc.json' }, '.git' }
--- ```
---
--- Find the first parent directory containing EITHER `stylua.toml` or
--- `.luarc.json`. If not found, find the first parent directory containing the
--- file or directory `.git`.
---
--- @field root_markers? (string|string[])[]
```

Code after:
--- will search upwards for each marker contained in the set. If a marker is
--- found, the directory which contains that marker is used as the root
--- directory. If no markers from the set are found, the process is repeated
--- with the next set in the list.
---
--- Example:
---
--- ```lua
---   root_markers = { 'stylua.toml', '.git' }
--- ```
---
--- Find the first parent directory containing the file `stylua.toml`. If not
--- found, find the first parent directory containing the file or directory
--- `.git`.
---
--- Example:
---
--- ```lua
---   root_markers = { { 'stylua.toml', '.luarc.json' }, '.git' }
--- ```
---
--- Find the first parent directory containing EITHER `stylua.toml` or
--- `.luarc.json`. If not found, find the first parent directory containing the
--- file or directory `.git`.
---
--- @field root_markers? (string|string[])[]

--- Sets the default configuration for an LSP client (or _all_ clients if the special name "*" is
--- used).
---
--- Can also be accessed by table-indexing (`vim.lsp.config[…]`) to get the resolved config, or
--- redefine the config (instead of "merging" with the config chain).
---
--- Examples:
---
--- - Add root markers for ALL clients:
---   ```lua
---   vim.lsp.config('*', {
---       root_markers = { '.git', '.hg' },
---     })
---   ```
--- - Add capabilities to ALL clients:
---   ```lua
---   vim.lsp.config('*', {
---     capabilities = {
---       textDocument = {
---         semanticTokens = {
---           multilineTokenSupport = true,
---         }
---       }
---     }