Merge pull request #16355 from mjlbach/fix/docgen-again

This commit is contained in:
Gregory Anders 2021-11-18 11:31:31 -07:00 committed by GitHub
commit a42a9accab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 3 deletions

View File

@ -1587,9 +1587,17 @@ function lsp.formatexpr(opts)
return 0 return 0
end end
-- Provides an interface between the built-in client and `tagfunc` --- Provides an interface between the built-in client and 'tagfunc'.
-- ---
-- Used via `set tagfunc=v:lua.vim.lsp.tagfunc` --- When used with normal mode commands (e.g. |CTRL-]|) this will invoke
--- the "textDocument/definition" LSP method to find the tag under the cursor.
--- Otherwise, uses "workspace/symbol". If no results are returned from
--- any LSP servers, falls back to using built-in tags.
---
---@param pattern Pattern used to find a workspace symbol
---@param flags See |tag-function|
---
---@returns A list of matching tags
function lsp.tagfunc(...) function lsp.tagfunc(...)
return require('vim.lsp.tagfunc')(...) return require('vim.lsp.tagfunc')(...)
end end

View File

@ -1,6 +1,7 @@
local lsp = vim.lsp local lsp = vim.lsp
local util = vim.lsp.util local util = vim.lsp.util
---@private
local function mk_tag_item(name, range, uri, offset_encoding) local function mk_tag_item(name, range, uri, offset_encoding)
local bufnr = vim.uri_to_bufnr(uri) local bufnr = vim.uri_to_bufnr(uri)
-- This is get_line_byte_from_position is 0-indexed, call cursor expects a 1-indexed position -- This is get_line_byte_from_position is 0-indexed, call cursor expects a 1-indexed position
@ -12,6 +13,7 @@ local function mk_tag_item(name, range, uri, offset_encoding)
} }
end end
---@private
local function query_definition(pattern) local function query_definition(pattern)
local params = lsp.util.make_position_params() local params = lsp.util.make_position_params()
local results_by_client, err = lsp.buf_request_sync(0, 'textDocument/definition', params, 1000) local results_by_client, err = lsp.buf_request_sync(0, 'textDocument/definition', params, 1000)
@ -40,6 +42,7 @@ local function query_definition(pattern)
return results return results
end end
---@private
local function query_workspace_symbols(pattern) local function query_workspace_symbols(pattern)
local results_by_client, err = lsp.buf_request_sync(0, 'workspace/symbol', { query = pattern }, 1000) local results_by_client, err = lsp.buf_request_sync(0, 'workspace/symbol', { query = pattern }, 1000)
if err then if err then
@ -58,6 +61,7 @@ local function query_workspace_symbols(pattern)
return results return results
end end
---@private
local function tagfunc(pattern, flags) local function tagfunc(pattern, flags)
local matches local matches
if string.match(flags, 'c') then if string.match(flags, 'c') then

View File

@ -162,6 +162,7 @@ CONFIG = {
'buf.lua', 'buf.lua',
'diagnostic.lua', 'diagnostic.lua',
'codelens.lua', 'codelens.lua',
'tagfunc.lua',
'handlers.lua', 'handlers.lua',
'util.lua', 'util.lua',
'log.lua', 'log.lua',