Skip to content

Commit 0ab278a

Browse files
committed
Merge branch 'master' into codemedic-customisations
* master: Propsed fix for init.lua warnings as per nvim-lua#1305 (comment) (nvim-lua#1354) Remove duplicate cmp-path (nvim-lua#1369) fix: regression introduced in db78c0b (nvim-lua#1367) Fix: fix the cmp-nvim-lsp-signature-help link (nvim-lua#1363)
2 parents ee60df3 + 34e7d29 commit 0ab278a

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

init.lua

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -574,13 +574,26 @@ require('lazy').setup({
574574
-- For example, in C this would take you to the header.
575575
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
576576

577+
-- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10)
578+
---@param client vim.lsp.Client
579+
---@param method vim.lsp.protocol.Method
580+
---@param bufnr? integer some lsp support methods only in specific files
581+
---@return boolean
582+
local function client_supports_method(client, method, bufnr)
583+
if vim.fn.has 'nvim-0.11' == 1 then
584+
return client:supports_method(method, bufnr)
585+
else
586+
return client.supports_method(method, { bufnr = bufnr })
587+
end
588+
end
589+
577590
-- The following two autocommands are used to highlight references of the
578591
-- word under your cursor when your cursor rests there for a little while.
579592
-- See `:help CursorHold` for information about when this is executed
580593
--
581594
-- When you move your cursor, the highlights will be cleared (the second autocommand).
582595
local client = vim.lsp.get_client_by_id(event.data.client_id)
583-
if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight) then
596+
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then
584597
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
585598
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
586599
buffer = event.buf,
@@ -607,7 +620,7 @@ require('lazy').setup({
607620
-- code, if the language server you are using supports them
608621
--
609622
-- This may be unwanted, since they displace some of your code
610-
if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then
623+
if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
611624
map('<leader>th', function()
612625
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
613626
end, '[T]oggle Inlay [H]ints')
@@ -724,6 +737,8 @@ require('lazy').setup({
724737
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
725738

726739
require('mason-lspconfig').setup {
740+
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
741+
automatic_installation = false,
727742
handlers = {
728743
function(server_name)
729744
local server = servers[server_name] or {}
@@ -817,8 +832,7 @@ require('lazy').setup({
817832
-- into multiple repos for maintenance purposes.
818833
'hrsh7th/cmp-nvim-lsp',
819834
'hrsh7th/cmp-path',
820-
'hrsh7th/cmp-path',
821-
'htsh7th/cmp-nvim-lsp-signature-help',
835+
'hrsh7th/cmp-nvim-lsp-signature-help',
822836
},
823837
config = function()
824838
-- See `:help cmp`

0 commit comments

Comments
 (0)