From 099e4fd6fa391872319cb11c453d7e6eec9c2234 Mon Sep 17 00:00:00 2001 From: Dimitris Dimitropoulos Date: Mon, 11 Aug 2025 21:38:30 +0300 Subject: fix(svlangserver): update config to 0.11+ - Drop .buf.execute_command and use :exec_cmd --- lsp/svlangserver.lua | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'lsp/svlangserver.lua') diff --git a/lsp/svlangserver.lua b/lsp/svlangserver.lua index 9e205e28..9fed7358 100644 --- a/lsp/svlangserver.lua +++ b/lsp/svlangserver.lua @@ -10,21 +10,6 @@ --- $ npm install -g @imc-trading/svlangserver --- ``` -local function build_index() - local params = { - command = 'systemverilog.build_index', - } - vim.lsp.buf.execute_command(params) -end - -local function report_hierarchy() - local params = { - command = 'systemverilog.report_hierarchy', - arguments = { vim.fn.expand '' }, - } - vim.lsp.buf.execute_command(params) -end - return { cmd = { 'svlangserver' }, filetypes = { 'verilog', 'systemverilog' }, @@ -34,11 +19,24 @@ return { includeIndexing = { '*.{v,vh,sv,svh}', '**/*.{v,vh,sv,svh}' }, }, }, - on_attach = function(_, bufnr) - vim.api.nvim_buf_create_user_command(bufnr, 'LspSvlangserverBuildIndex', build_index, { + ---@param client vim.lsp.Client + ---@param bufnr integer + on_attach = function(client, bufnr) + vim.api.nvim_buf_create_user_command(bufnr, 'LspSvlangserverBuildIndex', function() + client:exec_cmd({ + title = 'Build Index', + command = 'systemverilog.build_index', + }, { bufnr = bufnr }) + end, { desc = 'Instructs language server to rerun indexing', }) - vim.api.nvim_buf_create_user_command(bufnr, 'LspSvlangserverReportHierarchy', report_hierarchy, { + vim.api.nvim_buf_create_user_command(bufnr, 'LspSvlangserverReportHierarchy', function() + client:exec_cmd({ + title = 'Build Index', + command = 'systemverilog.build_index', + arguments = { vim.fn.expand '' }, + }, { bufnr = bufnr }) + end, { desc = 'Generates hierarchy for the given module', }) end, -- cgit v1.2.3-70-g09d2