diff options
author | ii14 <ii14@users.noreply.github.com> | 2022-07-15 17:55:00 +0200 |
---|---|---|
committer | ii14 <ii14@users.noreply.github.com> | 2022-07-15 17:55:00 +0200 |
commit | 8bccefcb87ec1beb91fc42e4646201917d85baf7 (patch) | |
tree | ef2796c9aa75157586ef59bb2e2b15fbb00d3617 /runtime/lua/vim/lsp/buf.lua | |
parent | 8a5c7e91f21b9f49c5443105e694056a65bf761e (diff) | |
download | rneovim-8bccefcb87ec1beb91fc42e4646201917d85baf7.tar.gz rneovim-8bccefcb87ec1beb91fc42e4646201917d85baf7.tar.bz2 rneovim-8bccefcb87ec1beb91fc42e4646201917d85baf7.zip |
refactor: use npcall from vim.F
Diffstat (limited to 'runtime/lua/vim/lsp/buf.lua')
-rw-r--r-- | runtime/lua/vim/lsp/buf.lua | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua index 50e77cb7ca..07f552239f 100644 --- a/runtime/lua/vim/lsp/buf.lua +++ b/runtime/lua/vim/lsp/buf.lua @@ -2,31 +2,11 @@ local vim = vim local a = vim.api local validate = vim.validate local util = require('vim.lsp.util') +local npcall = vim.F.npcall local M = {} ---@private ---- Returns nil if {status} is false or nil, otherwise returns the rest of the ---- arguments. -local function ok_or_nil(status, ...) - if not status then - return - end - return ... -end - ----@private ---- Swallows errors. ---- ----@param fn Function to run ----@param ... Function arguments ----@returns Result of `fn(...)` if there are no errors, otherwise nil. ---- Returns nil if errors occur during {fn}, otherwise returns -local function npcall(fn, ...) - return ok_or_nil(pcall(fn, ...)) -end - ----@private --- Sends an async request to all active clients attached to the current --- buffer. --- |