kcl-lang / kcl.nvim

NeoVim KCL Extension
Apache License 2.0
15 stars 6 forks source link

Plugin should remove LSP related code and rely on nvim-lspconfig #11

Closed eshepelyuk closed 3 months ago

eshepelyuk commented 3 months ago

Hello,

Currently plugin relies on combination of plugin manager setting (like lazyvim) and internal code to manage start of LSP servers. This causes few bugs (like in #10 ) and removes portability between different plugin managers.

I've been playing with my fork and nvim-lspconfig and I realize that lsp related code can be completely removed and offloaded to nvim-lspconfig.

Having nvim-lspconfig plugin added via your plugin manager and configuring nvim-lspconfig like this

local server_config = require("lspconfig.configs")
local util = require("lspconfig.util")

server_config.kcl = {
    default_config = {},
}

require("lspconfig").kcl.setup({
    cmd = { "kcl-language-server" },
    filetypes = { "kcl" },
    root_dir = util.root_pattern(".git"),
})

It's possible to remove lsp/init.lua and lsp/handlers.lua and everything will keep working. More over, those files are overriding user's LSP settings, like diagnostics, that is undesirable.

So basically, this plugin may only provide syntax highligh and comment string - and with nvim-lspconfig it will be enough.

Peefy commented 3 months ago

cc @He1pa

He1pa commented 3 months ago

Thanks for your suggestion, I'll test it

eshepelyuk commented 3 months ago

Thanks for your suggestion, I'll test it

eshepelyuk commented 3 months ago

Here's a screenshot running : LspInfo from nvin-lspconfig image

He1pa commented 3 months ago

Thanks a lot, I tested it and it works for both lazy.vim and vim-plug. I have submitted a PR to modify them

eshepelyuk commented 3 months ago

@He1pa all works fine, thankx a lot.