mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
refactor: create function for deferred loading
The benefit of this is that users only pay for what they use. If e.g. only `vim.lsp.buf_get_clients()` is called then they don't need to load all modules under `vim.lsp` which could lead to significant startuptime saving. Also `vim.lsp.module` is a bit nicer to user compared to `require("vim.lsp.module")`. This isn't used for some nested modules such as `filetype` as it breaks tests with error messages such as "attempt to index field 'detect'". It's not entirely certain the reason for this, but it is likely it is due to filetype being precompiled which would imply deferred loading isn't needed for performance reasons.
This commit is contained in:
@ -1,8 +1,6 @@
|
||||
---@brief lsp-diagnostic
|
||||
|
||||
local util = require('vim.lsp.util')
|
||||
local protocol = require('vim.lsp.protocol')
|
||||
local log = require('vim.lsp.log')
|
||||
local ms = protocol.Methods
|
||||
|
||||
local api = vim.api
|
||||
@ -95,7 +93,7 @@ local function tags_lsp_to_vim(diagnostic, client_id)
|
||||
tags = tags or {}
|
||||
tags.deprecated = true
|
||||
else
|
||||
log.info(string.format('Unknown DiagnosticTag %d from LSP client %d', tag, client_id))
|
||||
vim.lsp.log.info(string.format('Unknown DiagnosticTag %d from LSP client %d', tag, client_id))
|
||||
end
|
||||
end
|
||||
return tags
|
||||
@ -425,7 +423,7 @@ end
|
||||
local function _refresh(bufnr, opts)
|
||||
opts = opts or {}
|
||||
opts['bufnr'] = bufnr
|
||||
util._refresh(ms.textDocument_diagnostic, opts)
|
||||
vim.lsp.util._refresh(ms.textDocument_diagnostic, opts)
|
||||
end
|
||||
|
||||
--- Enable pull diagnostics for a buffer
|
||||
|
Reference in New Issue
Block a user