Skip to content

Commit e21d01a

Browse files
committed
refactor: cater for deprecation of vim.lsp.protocol.Methods
neovim/neovim#35998
1 parent 3460930 commit e21d01a

5 files changed

Lines changed: 16 additions & 21 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ winbar:
215215
or pcall(vim.treesitter.get_parser, buf)
216216
or not vim.tbl_isempty(vim.lsp.get_clients({
217217
bufnr = buf,
218-
method = vim.lsp.protocol.Methods.textDocument_documentSymbol,
218+
method = 'textDocument/documentSymbol',
219219
}))
220220
end,
221221
```
@@ -1352,7 +1352,7 @@ require('dropbar').setup({
13521352
or pcall(vim.treesitter.get_parser, buf)
13531353
or not vim.tbl_isempty(vim.lsp.get_clients({
13541354
bufnr = buf,
1355-
method = vim.lsp.protocol.Methods.textDocument_documentSymbol,
1355+
method = 'textDocument/documentSymbol',
13561356
}))
13571357
end,
13581358
},

doc/dropbar.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*dropbar.txt* Last change: 2025 August 30
1+
*dropbar.txt* Last change: 2025 September 07
22

33
==============================================================================
44
INTRODUCTION *dropbar-introduction*
@@ -209,7 +209,7 @@ the winbar:
209209
or pcall(vim.treesitter.get_parser, buf)
210210
or not vim.tbl_isempty(vim.lsp.get_clients({
211211
bufnr = buf,
212-
method = vim.lsp.protocol.Methods.textDocument_documentSymbol,
212+
method = 'textDocument/documentSymbol',
213213
}))
214214
end,
215215
<
@@ -1286,7 +1286,7 @@ This configuration should addresses the issue:
12861286
or pcall(vim.treesitter.get_parser, buf)
12871287
or not vim.tbl_isempty(vim.lsp.get_clients({
12881288
bufnr = buf,
1289-
method = vim.lsp.protocol.Methods.textDocument_documentSymbol,
1289+
method = 'textDocument/documentSymbol',
12901290
}))
12911291
end,
12921292
},

lua/dropbar/configs.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ M.opts = {
291291
or pcall(vim.treesitter.get_parser, buf)
292292
or not vim.tbl_isempty(vim.lsp.get_clients({
293293
bufnr = buf,
294-
method = vim.lsp.protocol.Methods.textDocument_documentSymbol,
294+
method = 'textDocument/documentSymbol',
295295
}))
296296
end,
297297
attach_events = {

lua/dropbar/sources/lsp.lua

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ local function update_symbols(buf, ttl)
298298

299299
local client = vim.lsp.get_clients({
300300
bufnr = buf,
301-
method = vim.lsp.protocol.Methods.textDocument_documentSymbol,
301+
method = 'textDocument/documentSymbol',
302302
})[1]
303303
if not client then
304304
defer_update_symbols()
@@ -314,7 +314,7 @@ local function update_symbols(buf, ttl)
314314
end
315315

316316
local _, request_id = client:request(
317-
vim.lsp.protocol.Methods.textDocument_documentSymbol,
317+
'textDocument/documentSymbol',
318318
{ textDocument = vim.lsp.util.make_text_document_params(buf) },
319319
function(err, symbols, _)
320320
if err or not symbols or vim.tbl_isempty(symbols) then
@@ -403,7 +403,7 @@ local function init()
403403
if
404404
not vim.tbl_isempty(vim.lsp.get_clients({
405405
bufnr = buf,
406-
method = vim.lsp.protocol.Methods.textDocument_documentSymbol,
406+
method = 'textDocument/documentSymbol',
407407
}))
408408
then
409409
attach(buf)
@@ -419,12 +419,7 @@ local function init()
419419
return
420420
end
421421
local client = vim.lsp.get_client_by_id(id)
422-
if
423-
client
424-
and client:supports_method(
425-
vim.lsp.protocol.Methods.textDocument_documentSymbol
426-
)
427-
then
422+
if client and client:supports_method('textDocument/documentSymbol') then
428423
attach(args.buf)
429424
end
430425
end,
@@ -438,7 +433,7 @@ local function init()
438433
if
439434
vim.tbl_isempty(vim.lsp.get_clients({
440435
bufnr = args.buf,
441-
method = vim.lsp.protocol.Methods.textDocument_documentSymbol,
436+
method = 'textDocument/documentSymbol',
442437
}))
443438
then
444439
detach(args.buf)

tests/sources/lsp_spec.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('[source][lsp]', function()
2020
id = 1,
2121
name = 'mock-lsp',
2222
supports_method = function(method)
23-
return method == vim.lsp.protocol.Methods.textDocument_documentSymbol
23+
return method == 'textDocument/documentSymbol'
2424
end,
2525
}
2626
end)
@@ -77,7 +77,7 @@ describe('[source][lsp]', function()
7777
-- textDocument/documentSymbol request
7878
---@diagnostic disable-next-line: assign-type-mismatch
7979
mock_client.request = function(_, method, _, handler)
80-
if method ~= vim.lsp.protocol.Methods.textDocument_documentSymbol then
80+
if method ~= 'textDocument/documentSymbol' then
8181
return
8282
end
8383

@@ -107,7 +107,7 @@ describe('[source][lsp]', function()
107107
},
108108
},
109109
}, {
110-
method = vim.lsp.protocol.Methods.textDocument_documentSymbol,
110+
method = 'textDocument/documentSymbol',
111111
client_id = mock_client.id,
112112
})
113113

@@ -159,7 +159,7 @@ describe('[source][lsp]', function()
159159
-- Mock a client that returns symbols with identical start positions
160160
---@diagnostic disable-next-line: assign-type-mismatch
161161
mock_client.request = function(_, method, _, handler)
162-
if method ~= vim.lsp.protocol.Methods.textDocument_documentSymbol then
162+
if method ~= 'textDocument/documentSymbol' then
163163
return
164164
end
165165

@@ -197,7 +197,7 @@ describe('[source][lsp]', function()
197197
},
198198
},
199199
}, {
200-
method = vim.lsp.protocol.Methods.textDocument_documentSymbol,
200+
method = 'textDocument/documentSymbol',
201201
client_id = mock_client.id,
202202
})
203203

0 commit comments

Comments
 (0)