diff options
| author | HenryHsieh <r901042004@yahoo.com.tw> | 2022-06-04 00:05:10 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-03 09:05:10 -0700 |
| commit | 2c210dd7ec5b2c53fa24bbb8005d6e6d08cec0b2 (patch) | |
| tree | c62ba51da3a6e831e699e712db25e5eec1414fe4 /lua | |
| parent | docs: update server_configurations.md (diff) | |
| download | nvim-lspconfig-2c210dd7ec5b2c53fa24bbb8005d6e6d08cec0b2.tar nvim-lspconfig-2c210dd7ec5b2c53fa24bbb8005d6e6d08cec0b2.tar.gz nvim-lspconfig-2c210dd7ec5b2c53fa24bbb8005d6e6d08cec0b2.tar.bz2 nvim-lspconfig-2c210dd7ec5b2c53fa24bbb8005d6e6d08cec0b2.tar.lz nvim-lspconfig-2c210dd7ec5b2c53fa24bbb8005d6e6d08cec0b2.tar.xz nvim-lspconfig-2c210dd7ec5b2c53fa24bbb8005d6e6d08cec0b2.tar.zst nvim-lspconfig-2c210dd7ec5b2c53fa24bbb8005d6e6d08cec0b2.zip | |
feat: add svlangserver support (#1916)
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/lspconfig/server_configurations/svlangserver.lua | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/lua/lspconfig/server_configurations/svlangserver.lua b/lua/lspconfig/server_configurations/svlangserver.lua new file mode 100644 index 00000000..613f815a --- /dev/null +++ b/lua/lspconfig/server_configurations/svlangserver.lua @@ -0,0 +1,66 @@ +local util = require 'lspconfig.util' + +local bin_name = 'svlangserver' +local cmd = { bin_name } + +if vim.fn.has 'win32' == 1 then + cmd = { 'cmd.exe', '/C', bin_name } +end + +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 '<cword>' }, + } + vim.lsp.buf.execute_command(params) +end + +return { + default_config = { + cmd = cmd, + filetypes = { 'verilog', 'systemverilog' }, + root_dir = function(fname) + return util.root_pattern '.nvim'(fname) or util.find_git_ancestor(fname) + end, + single_file_support = true, + settings = { + systemverilog = { + includeIndexing = { '*.{v,vh,sv,svh}', '**/*.{v,vh,sv,svh}' }, + }, + }, + on_init = function(client) + local json = '' + for line in io.lines(client.config.root_dir .. '/.nvim/lspconfig.json') do + json = json .. line + end + json = vim.json.decode(json) + client.config.cmd = { json.languageserver.svlangserver.command } + client.config.filetypes = json.languageserver.svlangserver.filetypes + client.config.settings = json.languageserver.svlangserver.settings + end, + }, + commands = { + SvlangserverBuildIndex = { + build_index, + description = 'Instructs language server to rerun indexing', + }, + SvlangserverReportHierarchy = { + report_hierarchy, + description = 'Generates hierarchy for the given module', + }, + }, + docs = { + description = [[ +https://github.com/imc-trading/svlangserver + +`svlangserver`, a language server for systemverilog +]], + }, +} |
