Merge cc1a4d7cc6
into 3338d39206
This commit is contained in:
commit
5584db881c
17
init.lua
17
init.lua
|
@ -572,26 +572,13 @@ require('lazy').setup({
|
||||||
-- the definition of its *type*, not where it was *defined*.
|
-- the definition of its *type*, not where it was *defined*.
|
||||||
map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition')
|
map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition')
|
||||||
|
|
||||||
-- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
|
|
||||||
---@param client vim.lsp.Client
|
|
||||||
---@param method vim.lsp.protocol.Method
|
|
||||||
---@param bufnr? integer some lsp support methods only in specific files
|
|
||||||
---@return boolean
|
|
||||||
local function client_supports_method(client, method, bufnr)
|
|
||||||
if vim.fn.has 'nvim-0.11' == 1 then
|
|
||||||
return client:supports_method(method, bufnr)
|
|
||||||
else
|
|
||||||
return client.supports_method(method, { bufnr = bufnr })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- The following two autocommands are used to highlight references of the
|
-- The following two autocommands are used to highlight references of the
|
||||||
-- word under your cursor when your cursor rests there for a little while.
|
-- word under your cursor when your cursor rests there for a little while.
|
||||||
-- See `:help CursorHold` for information about when this is executed
|
-- See `:help CursorHold` for information about when this is executed
|
||||||
--
|
--
|
||||||
-- When you move your cursor, the highlights will be cleared (the second autocommand).
|
-- When you move your cursor, the highlights will be cleared (the second autocommand).
|
||||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||||
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then
|
if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then
|
||||||
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
|
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
|
||||||
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||||
buffer = event.buf,
|
buffer = event.buf,
|
||||||
|
@ -618,7 +605,7 @@ require('lazy').setup({
|
||||||
-- code, if the language server you are using supports them
|
-- code, if the language server you are using supports them
|
||||||
--
|
--
|
||||||
-- This may be unwanted, since they displace some of your code
|
-- This may be unwanted, since they displace some of your code
|
||||||
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
|
if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
|
||||||
map('<leader>th', function()
|
map('<leader>th', function()
|
||||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
|
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
|
||||||
end, '[T]oggle Inlay [H]ints')
|
end, '[T]oggle Inlay [H]ints')
|
||||||
|
|
|
@ -12,7 +12,7 @@ local check_version = function()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if vim.version.ge(vim.version(), '0.10-dev') then
|
if vim.version.ge(vim.version(), '0.11') then
|
||||||
vim.health.ok(string.format("Neovim version is: '%s'", verstr))
|
vim.health.ok(string.format("Neovim version is: '%s'", verstr))
|
||||||
else
|
else
|
||||||
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
vim.health.error(string.format("Neovim out of date: '%s'. Upgrade to latest stable or nightly", verstr))
|
||||||
|
|
Loading…
Reference in New Issue