diff options
Diffstat (limited to 'test/functional/plugin/lsp_spec.lua')
-rw-r--r-- | test/functional/plugin/lsp_spec.lua | 81 |
1 files changed, 57 insertions, 24 deletions
diff --git a/test/functional/plugin/lsp_spec.lua b/test/functional/plugin/lsp_spec.lua index 1d43b5d449..88b0e0c991 100644 --- a/test/functional/plugin/lsp_spec.lua +++ b/test/functional/plugin/lsp_spec.lua @@ -3607,21 +3607,21 @@ describe('LSP', function() range = { ['end'] = { character = 8, - line = 9, + line = 3, }, start = { character = 6, - line = 9, + line = 3, }, }, selectionRange = { ['end'] = { character = 8, - line = 9, + line = 3, }, start = { character = 6, - line = 9, + line = 3, }, }, uri = 'file:///home/jiangyinzuo/hello.cpp', @@ -3651,21 +3651,21 @@ describe('LSP', function() range = { ['end'] = { character = 8, - line = 8, + line = 2, }, start = { character = 6, - line = 8, + line = 2, }, }, selectionRange = { ['end'] = { character = 8, - line = 8, + line = 2, }, start = { character = 6, - line = 8, + line = 2, }, }, uri = 'file:///home/jiangyinzuo/hello.cpp', @@ -3679,7 +3679,15 @@ describe('LSP', function() }) local client_id = vim.lsp.start({ name = 'dummy', cmd = server.cmd }) local handler = require 'vim.lsp.handlers'['typeHierarchy/subtypes'] - handler(nil, clangd_response, { client_id = client_id, bufnr = 1 }) + local bufnr = vim.api.nvim_get_current_buf() + vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { + 'class B : public A{};', + 'class C : public B{};', + 'class D1 : public C{};', + 'class D2 : public C{};', + 'class E : public D1, D2 {};', + }) + handler(nil, clangd_response, { client_id = client_id, bufnr = bufnr }) return vim.fn.getqflist() end) @@ -3689,7 +3697,7 @@ describe('LSP', function() col = 7, end_col = 0, end_lnum = 0, - lnum = 10, + lnum = 4, module = '', nr = 0, pattern = '', @@ -3703,7 +3711,7 @@ describe('LSP', function() col = 7, end_col = 0, end_lnum = 0, - lnum = 9, + lnum = 3, module = '', nr = 0, pattern = '', @@ -3763,7 +3771,15 @@ describe('LSP', function() }) local client_id = vim.lsp.start({ name = 'dummy', cmd = server.cmd }) local handler = require 'vim.lsp.handlers'['typeHierarchy/subtypes'] - handler(nil, jdtls_response, { client_id = client_id, bufnr = 1 }) + local bufnr = vim.api.nvim_get_current_buf() + vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { + 'package mylist;', + '', + 'public class MyList {', + ' static class Inner extends MyList{}', + '~}', + }) + handler(nil, jdtls_response, { client_id = client_id, bufnr = bufnr }) return vim.fn.getqflist() end) @@ -3840,21 +3856,21 @@ describe('LSP', function() range = { ['end'] = { character = 8, - line = 9, + line = 3, }, start = { character = 6, - line = 9, + line = 3, }, }, selectionRange = { ['end'] = { character = 8, - line = 9, + line = 3, }, start = { character = 6, - line = 9, + line = 3, }, }, uri = 'file:///home/jiangyinzuo/hello.cpp', @@ -3884,21 +3900,21 @@ describe('LSP', function() range = { ['end'] = { character = 8, - line = 8, + line = 2, }, start = { character = 6, - line = 8, + line = 2, }, }, selectionRange = { ['end'] = { character = 8, - line = 8, + line = 2, }, start = { character = 6, - line = 8, + line = 2, }, }, uri = 'file:///home/jiangyinzuo/hello.cpp', @@ -3912,7 +3928,16 @@ describe('LSP', function() }) local client_id = vim.lsp.start({ name = 'dummy', cmd = server.cmd }) local handler = require 'vim.lsp.handlers'['typeHierarchy/supertypes'] - handler(nil, clangd_response, { client_id = client_id, bufnr = 1 }) + local bufnr = vim.api.nvim_get_current_buf() + vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { + 'class B : public A{};', + 'class C : public B{};', + 'class D1 : public C{};', + 'class D2 : public C{};', + 'class E : public D1, D2 {};', + }) + + handler(nil, clangd_response, { client_id = client_id, bufnr = bufnr }) return vim.fn.getqflist() end) @@ -3922,7 +3947,7 @@ describe('LSP', function() col = 7, end_col = 0, end_lnum = 0, - lnum = 10, + lnum = 4, module = '', nr = 0, pattern = '', @@ -3936,7 +3961,7 @@ describe('LSP', function() col = 7, end_col = 0, end_lnum = 0, - lnum = 9, + lnum = 3, module = '', nr = 0, pattern = '', @@ -3996,7 +4021,15 @@ describe('LSP', function() }) local client_id = vim.lsp.start({ name = 'dummy', cmd = server.cmd }) local handler = require 'vim.lsp.handlers'['typeHierarchy/supertypes'] - handler(nil, jdtls_response, { client_id = client_id, bufnr = 1 }) + local bufnr = vim.api.nvim_get_current_buf() + vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { + 'package mylist;', + '', + 'public class MyList {', + ' static class Inner extends MyList{}', + '~}', + }) + handler(nil, jdtls_response, { client_id = client_id, bufnr = bufnr }) return vim.fn.getqflist() end) |