From dc62ebeb789f62bd86b2a9c1a58899408a46d35b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Tue, 30 Apr 2024 14:11:31 +0200 Subject: [PATCH] Fix actions --- symlinks/config/nvim/after/ftplugin/scala.lua | 1 + symlinks/config/nvim/lua/esensar/init/plugins.lua | 1 + .../config/nvim/lua/esensar/lsp/diagnostic.lua | 5 +++++ .../nvim/lua/esensar/lsp/formatters/gdformat.lua | 4 ++-- .../config/nvim/lua/esensar/lsp/metals_setup.lua | 15 +++++++++++++++ .../config/nvim/lua/esensar/lsp/server_config.lua | 2 +- symlinks/config/nvim/lua/esensar/lsp/servers.lua | 5 +++-- symlinks/config/nvim/plugin/snippets.lua | 2 +- 8 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 symlinks/config/nvim/after/ftplugin/scala.lua create mode 100644 symlinks/config/nvim/lua/esensar/lsp/metals_setup.lua diff --git a/symlinks/config/nvim/after/ftplugin/scala.lua b/symlinks/config/nvim/after/ftplugin/scala.lua new file mode 100644 index 0000000..72574d1 --- /dev/null +++ b/symlinks/config/nvim/after/ftplugin/scala.lua @@ -0,0 +1 @@ +require("esensar.lsp.metals_setup").setup() diff --git a/symlinks/config/nvim/lua/esensar/init/plugins.lua b/symlinks/config/nvim/lua/esensar/init/plugins.lua index 4b0214a..a7632eb 100644 --- a/symlinks/config/nvim/lua/esensar/init/plugins.lua +++ b/symlinks/config/nvim/lua/esensar/init/plugins.lua @@ -154,6 +154,7 @@ return require("lazy").setup({ "akinsho/flutter-tools.nvim", -- Additional flutter integrations { "mrcjkb/rustaceanvim", ft = "rust" }, -- Additional rust integrations { "mfussenegger/nvim-jdtls", ft = "java" }, -- Additional java integrations + "scalameta/nvim-metals", -- Scala -- Lua support "nvim-lua/popup.nvim", -- Popup API integration - needed for some plugins diff --git a/symlinks/config/nvim/lua/esensar/lsp/diagnostic.lua b/symlinks/config/nvim/lua/esensar/lsp/diagnostic.lua index f54196f..8895e7d 100644 --- a/symlinks/config/nvim/lua/esensar/lsp/diagnostic.lua +++ b/symlinks/config/nvim/lua/esensar/lsp/diagnostic.lua @@ -10,6 +10,7 @@ require("formatter").setup({ }, kotlin = { require("formatter.filetypes.kotlin").ktlint, + require("formatter.filetypes.kotlin").detekt, }, cpp = { require("formatter.filetypes.cpp").clangformat, @@ -41,6 +42,10 @@ require("formatter").setup({ godot = { require("esensar.lsp.formatters.gdformat"), }, + xml = { + require("formatter.filetypes.xml").xmlformat, + require("formatter.filetypes.xml").xmllint, + }, ["*"] = { require("formatter.filetypes.any").remove_trailing_whitespace, }, diff --git a/symlinks/config/nvim/lua/esensar/lsp/formatters/gdformat.lua b/symlinks/config/nvim/lua/esensar/lsp/formatters/gdformat.lua index b9d83ac..3a9c0f9 100644 --- a/symlinks/config/nvim/lua/esensar/lsp/formatters/gdformat.lua +++ b/symlinks/config/nvim/lua/esensar/lsp/formatters/gdformat.lua @@ -2,7 +2,7 @@ return { exe = "gdformat", args = { "--diff", - "-" + "-", }, - stdin = true + stdin = true, } diff --git a/symlinks/config/nvim/lua/esensar/lsp/metals_setup.lua b/symlinks/config/nvim/lua/esensar/lsp/metals_setup.lua new file mode 100644 index 0000000..4562654 --- /dev/null +++ b/symlinks/config/nvim/lua/esensar/lsp/metals_setup.lua @@ -0,0 +1,15 @@ +------------------------------------------------------------------------------- +-- - Metals server configuration - +------------------------------------------------------------------------------- + +local common_config = require("esensar.lsp.server_config") +local M = {} + +local metals_config = require("metals").bare_config() +metals_config.on_attach = common_config.on_attach + +function M.setup() + require("metals").initialize_or_attach(metals_config) +end + +return M diff --git a/symlinks/config/nvim/lua/esensar/lsp/server_config.lua b/symlinks/config/nvim/lua/esensar/lsp/server_config.lua index e08bbe4..5e6a7ca 100644 --- a/symlinks/config/nvim/lua/esensar/lsp/server_config.lua +++ b/symlinks/config/nvim/lua/esensar/lsp/server_config.lua @@ -41,7 +41,7 @@ local function on_attach(client, bufnr) end if vim.fn.has("nvim-0.10") then - vim.lsp.inlay_hint.enable(bufnr, true) + vim.lsp.inlay_hint.enable(true, { bufnr = bufnr }) end end diff --git a/symlinks/config/nvim/lua/esensar/lsp/servers.lua b/symlinks/config/nvim/lua/esensar/lsp/servers.lua index 3afde82..07a52ec 100644 --- a/symlinks/config/nvim/lua/esensar/lsp/servers.lua +++ b/symlinks/config/nvim/lua/esensar/lsp/servers.lua @@ -5,7 +5,7 @@ require("neodev").setup({ library = { plugins = { "neotest", "plenary.nvim" }, types = true }, -- Always add neovim plugins into lua_ls library, even if not neovim config - override = function(root_dir, library) + override = function(_, library) library.enabled = true library.plugins = true end, @@ -55,6 +55,7 @@ local servers = { "crystalline", "cucumber_language_server", "dockerls", + "dotls", "gdscript", "gopls", "hls", @@ -90,7 +91,7 @@ vim.g.rustaceanvim = { on_attach = function(client, bufnr) common_config.on_attach(client, bufnr) end, - cmd = {"ra-multiplex"}, + cmd = { "ra-multiplex" }, -- init_options = { -- lspMux = { -- version = "1", diff --git a/symlinks/config/nvim/plugin/snippets.lua b/symlinks/config/nvim/plugin/snippets.lua index 19fb29c..f678b91 100644 --- a/symlinks/config/nvim/plugin/snippets.lua +++ b/symlinks/config/nvim/plugin/snippets.lua @@ -105,7 +105,7 @@ local function jdocsnip(args, _, old_state) end vim.list_extend(nodes, { t({ " * ", " * @throws " .. exc .. " " }), ins, t({ "", "" }) }) param_nodes.ex = ins - insert = insert + 1 + -- insert = insert + 1 end vim.list_extend(nodes, { t({ " */" }) })