aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/buf.lua
diff options
context:
space:
mode:
authorTJ DeVries <devries.timothyj@gmail.com>2020-07-02 07:09:17 -0400
committerGitHub <noreply@github.com>2020-07-02 07:09:17 -0400
commit7b529e7912517af078e005dd7b06b3d042be9cb7 (patch)
tree07ce777cc208f93776e1a858bb3a1eac3d91bfdf /runtime/lua/vim/lsp/buf.lua
parent2844cd54dab2893a0baa0464e8de0a01f1048b05 (diff)
downloadrneovim-7b529e7912517af078e005dd7b06b3d042be9cb7.tar.gz
rneovim-7b529e7912517af078e005dd7b06b3d042be9cb7.tar.bz2
rneovim-7b529e7912517af078e005dd7b06b3d042be9cb7.zip
doc: fix scripts and regenerate (#12506)
* Fix some small doc issues * doc: fixup * doc: fixup * Fix lint and rebase * Remove bad advice * Ugh, stupid mpack files... * Don't let people include these for now until they specifically want to * Prevent duplicate tag
Diffstat (limited to 'runtime/lua/vim/lsp/buf.lua')
-rw-r--r--runtime/lua/vim/lsp/buf.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua
index e1ddfb7efa..839e00c67d 100644
--- a/runtime/lua/vim/lsp/buf.lua
+++ b/runtime/lua/vim/lsp/buf.lua
@@ -23,6 +23,9 @@ local function request(method, params, callback)
return vim.lsp.buf_request(0, method, params, callback)
end
+--- Sends a notification through all clients associated with current buffer.
+--
+--@return `true` if server responds.
function M.server_ready()
return not not vim.lsp.buf_notify(0, "window/progress", {})
end
@@ -69,6 +72,10 @@ function M.formatting(options)
return request('textDocument/formatting', params)
end
+--- Perform |vim.lsp.buf.formatting()| synchronously.
+---
+--- Useful for running on save, to make sure buffer is formatted prior to being
+--- saved. {timeout_ms} is passed on to |vim.lsp.buf_request_sync()|.
function M.formatting_sync(options, timeout_ms)
local params = util.make_formatting_params(options)
local result = vim.lsp.buf_request_sync(0, "textDocument/formatting", params, timeout_ms)
@@ -136,6 +143,12 @@ function M.document_symbol()
request('textDocument/documentSymbol', params)
end
+
+--- Lists all symbols in the current workspace in the quickfix window.
+---
+--- The list is filtered against the optional argument {query};
+--- if the argument is omitted from the call, the user is prompted to enter a string on the command line.
+--- An empty string means no filtering is done.
function M.workspace_symbol(query)
query = query or npcall(vfn.input, "Query: ")
local params = {query = query}