aboutsummaryrefslogtreecommitdiff
path: root/test/functional/plugin/lsp/diagnostic_spec.lua
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2024-10-29 09:36:02 +0000
committerLewis Russell <me@lewisr.dev>2024-11-01 09:17:39 +0000
commit9b357e30fdd0a575480182872331fdb87e9cc331 (patch)
tree02e7a8ce3fcd70946acca8e27d2769dfcf75b6e3 /test/functional/plugin/lsp/diagnostic_spec.lua
parentf54266dbed6f1a4cb4fad3486a722a25070d7feb (diff)
downloadrneovim-9b357e30fdd0a575480182872331fdb87e9cc331.tar.gz
rneovim-9b357e30fdd0a575480182872331fdb87e9cc331.tar.bz2
rneovim-9b357e30fdd0a575480182872331fdb87e9cc331.zip
feat(lsp)!: remove client-server handlers from vim.lsp.handlers
- Partition the handlers in vim.lsp.handlers as: - client to server response handlers (RCS) - server to client request handlers (RSC) - server to client notification handlers (NSC) Note use string indexes instead of protocol.methods for improved typing in LuaLS (tip: use hover on RCS, RSC or NSC).
Diffstat (limited to 'test/functional/plugin/lsp/diagnostic_spec.lua')
-rw-r--r--test/functional/plugin/lsp/diagnostic_spec.lua107
1 files changed, 0 insertions, 107 deletions
diff --git a/test/functional/plugin/lsp/diagnostic_spec.lua b/test/functional/plugin/lsp/diagnostic_spec.lua
index b7e292cad0..5afbe22793 100644
--- a/test/functional/plugin/lsp/diagnostic_spec.lua
+++ b/test/functional/plugin/lsp/diagnostic_spec.lua
@@ -120,85 +120,6 @@ describe('vim.lsp.diagnostic', function()
end)
describe('vim.lsp.diagnostic.on_publish_diagnostics', function()
- it('allows configuring the virtual text via vim.lsp.with', function()
- local expected_spacing = 10
- local extmarks = exec_lua(function()
- _G.PublishDiagnostics = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
- virtual_text = {
- spacing = expected_spacing,
- },
- })
-
- _G.PublishDiagnostics(nil, {
- uri = fake_uri,
- diagnostics = {
- _G.make_error('Delayed Diagnostic', 4, 4, 4, 4),
- },
- }, { client_id = client_id })
-
- return _G.get_extmarks(diagnostic_bufnr, client_id)
- end)
-
- local spacing = extmarks[1][4].virt_text[1][1]
-
- eq(expected_spacing, #spacing)
- end)
-
- it('allows configuring the virtual text via vim.lsp.with using a function', function()
- local expected_spacing = 10
- local extmarks = exec_lua(function()
- _G.PublishDiagnostics = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
- virtual_text = function()
- return {
- spacing = expected_spacing,
- }
- end,
- })
-
- _G.PublishDiagnostics(nil, {
- uri = fake_uri,
- diagnostics = {
- _G.make_error('Delayed Diagnostic', 4, 4, 4, 4),
- },
- }, { client_id = client_id })
-
- return _G.get_extmarks(diagnostic_bufnr, client_id)
- end)
-
- local spacing = extmarks[1][4].virt_text[1][1]
-
- eq(expected_spacing, #spacing)
- end)
-
- it('allows filtering via severity limit', function()
- local get_extmark_count_with_severity = function(severity_limit)
- return exec_lua(function()
- _G.PublishDiagnostics = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
- underline = false,
- virtual_text = {
- severity = { min = severity_limit },
- },
- })
-
- _G.PublishDiagnostics(nil, {
- uri = fake_uri,
- diagnostics = {
- _G.make_warning('Delayed Diagnostic', 4, 4, 4, 4),
- },
- }, { client_id = client_id })
-
- return #_G.get_extmarks(diagnostic_bufnr, client_id)
- end, client_id, fake_uri, severity_limit)
- end
-
- -- No messages with Error or higher
- eq(0, get_extmark_count_with_severity('ERROR'))
-
- -- But now we don't filter it
- eq(1, get_extmark_count_with_severity('WARN'))
- eq(1, get_extmark_count_with_severity('HINT'))
- end)
-
it('correctly handles UTF-16 offsets', function()
local line = 'All 💼 and no 🎉 makes Jack a dull 👦'
local result = exec_lua(function()
@@ -380,34 +301,6 @@ describe('vim.lsp.diagnostic', function()
eq(1, diagnostics[1].severity)
end)
- it('allows configuring the virtual text via vim.lsp.with', function()
- local expected_spacing = 10
- local extmarks = exec_lua(function()
- _G.Diagnostic = vim.lsp.with(vim.lsp.diagnostic.on_diagnostic, {
- virtual_text = {
- spacing = expected_spacing,
- },
- })
-
- _G.Diagnostic(nil, {
- kind = 'full',
- items = {
- _G.make_error('Pull Diagnostic', 4, 4, 4, 4),
- },
- }, {
- params = {
- textDocument = { uri = fake_uri },
- },
- uri = fake_uri,
- client_id = client_id,
- }, {})
-
- return _G.get_extmarks(diagnostic_bufnr, client_id)
- end)
- eq(2, #extmarks)
- eq(expected_spacing, #extmarks[1][4].virt_text[1][1])
- end)
-
it('clears diagnostics when client detaches', function()
exec_lua(function()
vim.lsp.diagnostic.on_diagnostic(nil, {