From 22c09aac035f5fea68b414fa32d0c0316ad17509 Mon Sep 17 00:00:00 2001 From: arthur Date: Thu, 4 Apr 2024 03:32:50 +0800 Subject: [PATCH] Update plugins based on the review comments. 1. Remove kotlin language server from mason 2. Add optinal is true, only enabled if the user has explicitly enabled the extra plugin. 3. Remove duplicate dependencies cause they are already defined in the plugin. 4. Add none-ls as optional --- lua/lazyvim/plugins/extras/lang/kotlin.lua | 28 ++++++++++++++-------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/kotlin.lua b/lua/lazyvim/plugins/extras/lang/kotlin.lua index 0e99b01e..3db46730 100644 --- a/lua/lazyvim/plugins/extras/lang/kotlin.lua +++ b/lua/lazyvim/plugins/extras/lang/kotlin.lua @@ -1,13 +1,9 @@ return { - -- Add linting, debug adapter, language server + -- Add packages(linting, debug adapter) { "williamboman/mason.nvim", opts = function(_, opts) - vim.list_extend(opts.ensure_installed or {}, { - "ktlint", - "kotlin-language-server", - "kotlin-debug-adapter", - }) + vim.list_extend(opts.ensure_installed or {}, { "ktlint", "kotlin-debug-adapter" }) end, }, -- Add syntax highlighting @@ -20,7 +16,6 @@ return { -- Add language server { "neovim/nvim-lspconfig", - dependencies = "williamboman/mason.nvim", opts = { servers = { kotlin_language_server = {}, @@ -30,24 +25,37 @@ return { -- Add linting { "mfussenegger/nvim-lint", + optional = true, dependencies = "williamboman/mason.nvim", opts = { linters_by_ft = { kotlin = { "ktlint" } }, }, }, - -- Add formatting + -- Add formatting as optional { "stevearc/conform.nvim", - dependencies = "williamboman/mason.nvim", + optional = true, opts = { formatters_by_ft = { kotlin = { "ktlint" } }, }, }, + -- Add formatting and linting as optional + { + "nvimtools/none-ls.nvim", + optional = true, + opts = function(_, opts) + local nls = require("null-ls") + opts.sources = vim.list_extend(opts.sources or {}, { + nls.builtins.formatting.ktlint, + nls.builtins.diagnostics.ktlint, + }) + end, + }, -- Add debugger { "mfussenegger/nvim-dap", + optional = true, dependencies = "williamboman/mason.nvim", - opts = function() local dap = require("dap") if not dap.adapters.kotlin then