diff --git a/nvim/.config/nvim/after/ftplugin/zig.lua b/nvim/.config/nvim/after/ftplugin/zig.lua new file mode 100644 index 0000000..24a2201 --- /dev/null +++ b/nvim/.config/nvim/after/ftplugin/zig.lua @@ -0,0 +1,4 @@ +local lsp_utils = require('lsp-utils') +local zls_config = lsp_utils.zls_config() + +vim.lsp.start(zls_config) diff --git a/nvim/.config/nvim/lua/lsp-utils.lua b/nvim/.config/nvim/lua/lsp-utils.lua index 1681f07..d5da917 100644 --- a/nvim/.config/nvim/lua/lsp-utils.lua +++ b/nvim/.config/nvim/lua/lsp-utils.lua @@ -372,4 +372,18 @@ function M.typescript_config() end end +function M.zls_config() + local root_files = { 'zls.json', 'build.zig' } + local root_directory = get_root_directory(root_files) + + return { + name = "zls", + cmd = { "zls" }, + capabilities = default_capabilities, + root_dir = root_directory, + filetypes = { 'zig', 'zir' }, + single_file_support = true, + } +end + return M