From 2e92065686f62851318150a315591c30b8306a4b Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Thu, 14 Sep 2023 08:23:01 -0500 Subject: docs: replace
 with ``` (#25136)

---
 runtime/lua/vim/lsp/buf.lua             | 23 +++++++++---------
 runtime/lua/vim/lsp/codelens.lua        |  6 ++---
 runtime/lua/vim/lsp/diagnostic.lua      | 10 +++++---
 runtime/lua/vim/lsp/handlers.lua        | 43 +++++++++++++++++++--------------
 runtime/lua/vim/lsp/semantic_tokens.lua |  7 +++---
 5 files changed, 49 insertions(+), 40 deletions(-)

(limited to 'runtime/lua/vim/lsp')

diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua
index 6cd0aa1e95..8a29fac2b5 100644
--- a/runtime/lua/vim/lsp/buf.lua
+++ b/runtime/lua/vim/lsp/buf.lua
@@ -168,13 +168,11 @@ end
 ---
 ---     - filter (function|nil):
 ---         Predicate used to filter clients. Receives a client as argument and must return a
----         boolean. Clients matching the predicate are included. Example:
----
----         
lua
----           -- Never request typescript-language-server for formatting
----           vim.lsp.buf.format {
----             filter = function(client) return client.name ~= "tsserver" end
----           }
+---         boolean. Clients matching the predicate are included. Example: 
lua
+---                     -- Never request typescript-language-server for formatting
+---                     vim.lsp.buf.format {
+---                       filter = function(client) return client.name ~= "tsserver" end
+---                     }
 ---         
--- --- - async boolean|nil @@ -555,11 +553,12 @@ end --- Send request to the server to resolve document highlights for the current --- text document position. This request can be triggered by a key mapping or --- by events such as `CursorHold`, e.g.: ----
vim
----   autocmd CursorHold   lua vim.lsp.buf.document_highlight()
----   autocmd CursorHoldI  lua vim.lsp.buf.document_highlight()
----   autocmd CursorMoved  lua vim.lsp.buf.clear_references()
---- 
+--- +--- ```vim +--- autocmd CursorHold lua vim.lsp.buf.document_highlight() +--- autocmd CursorHoldI lua vim.lsp.buf.document_highlight() +--- autocmd CursorMoved lua vim.lsp.buf.clear_references() +--- ``` --- --- Note: Usage of |vim.lsp.buf.document_highlight()| requires the following highlight groups --- to be defined or you won't be able to see the actual highlights. diff --git a/runtime/lua/vim/lsp/codelens.lua b/runtime/lua/vim/lsp/codelens.lua index d581eb985f..384d09ee48 100644 --- a/runtime/lua/vim/lsp/codelens.lua +++ b/runtime/lua/vim/lsp/codelens.lua @@ -255,10 +255,10 @@ end --- It is recommended to trigger this using an autocmd or via keymap. --- --- Example: ----
vim
----   autocmd BufEnter,CursorHold,InsertLeave  lua vim.lsp.codelens.refresh()
---- 
--- +--- ```vim +--- autocmd BufEnter,CursorHold,InsertLeave lua vim.lsp.codelens.refresh() +--- ``` function M.refresh() local params = { textDocument = util.make_text_document_params(), diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua index 2a77992c4d..73ffa1a46c 100644 --- a/runtime/lua/vim/lsp/diagnostic.lua +++ b/runtime/lua/vim/lsp/diagnostic.lua @@ -203,7 +203,8 @@ end --- --- See |vim.diagnostic.config()| for configuration options. Handler-specific --- configuration can be set using |vim.lsp.with()|: ----
lua
+---
+--- ```lua
 --- vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
 ---   vim.lsp.diagnostic.on_publish_diagnostics, {
 ---     -- Enable underline, use default values
@@ -221,7 +222,7 @@ end
 ---     update_in_insert = false,
 ---   }
 --- )
---- 
+--- ``` --- ---@param config table Configuration table (see |vim.diagnostic.config()|). function M.on_publish_diagnostics(_, result, ctx, config) @@ -263,7 +264,8 @@ end --- --- See |vim.diagnostic.config()| for configuration options. Handler-specific --- configuration can be set using |vim.lsp.with()|: ----
lua
+---
+--- ```lua
 --- vim.lsp.handlers["textDocument/diagnostic"] = vim.lsp.with(
 ---   vim.lsp.diagnostic.on_diagnostic, {
 ---     -- Enable underline, use default values
@@ -281,7 +283,7 @@ end
 ---     update_in_insert = false,
 ---   }
 --- )
---- 
+--- ``` --- ---@param config table Configuration table (see |vim.diagnostic.config()|). function M.on_diagnostic(_, result, ctx, config) diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua index 81d4d6cceb..4ea3dde81c 100644 --- a/runtime/lua/vim/lsp/handlers.lua +++ b/runtime/lua/vim/lsp/handlers.lua @@ -342,16 +342,18 @@ M[ms.textDocument_completion] = function(_, result, _, _) end --- |lsp-handler| for the method "textDocument/hover" ----
lua
----   vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
----     vim.lsp.handlers.hover, {
----       -- Use a sharp border with `FloatBorder` highlights
----       border = "single",
----       -- add the title in hover float window
----       title = "hover"
----     }
----   )
---- 
+--- +--- ```lua +--- vim.lsp.handlers["textDocument/hover"] = vim.lsp.with( +--- vim.lsp.handlers.hover, { +--- -- Use a sharp border with `FloatBorder` highlights +--- border = "single", +--- -- add the title in hover float window +--- title = "hover" +--- } +--- ) +--- ``` +--- ---@param config table Configuration table. --- - border: (default=nil) --- - Add borders to the floating window @@ -430,15 +432,20 @@ M[ms.textDocument_typeDefinition] = location_handler M[ms.textDocument_implementation] = location_handler --- |lsp-handler| for the method "textDocument/signatureHelp". +--- --- The active parameter is highlighted with |hl-LspSignatureActiveParameter|. ----
lua
----   vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
----     vim.lsp.handlers.signature_help, {
----       -- Use a sharp border with `FloatBorder` highlights
----       border = "single"
----     }
----   )
---- 
+--- +--- ```lua +--- vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with( +--- vim.lsp.handlers.signature_help, { +--- -- Use a sharp border with `FloatBorder` highlights +--- border = "single" +--- } +--- ) +--- ``` +--- +---@param result table Response from the language server +---@param ctx table Client context ---@param config table Configuration table. --- - border: (default=nil) --- - Add borders to the floating window diff --git a/runtime/lua/vim/lsp/semantic_tokens.lua b/runtime/lua/vim/lsp/semantic_tokens.lua index 5b20344bd3..a5831c0beb 100644 --- a/runtime/lua/vim/lsp/semantic_tokens.lua +++ b/runtime/lua/vim/lsp/semantic_tokens.lua @@ -555,9 +555,10 @@ local M = {} --- delete the semanticTokensProvider table from the {server_capabilities} of --- your client in your |LspAttach| callback or your configuration's --- `on_attach` callback: ----
lua
----   client.server_capabilities.semanticTokensProvider = nil
---- 
+--- +--- ```lua +--- client.server_capabilities.semanticTokensProvider = nil +--- ``` --- ---@param bufnr integer ---@param client_id integer -- cgit