LaurenceWarne / cfn-lsp-extra

An Experimental Cloudformation language server
MIT License
21 stars 5 forks source link

nvim-lspconfig setup #6

Closed cbackas closed 12 months ago

cbackas commented 1 year ago

I noticed in the nvim config section you have the use of a plugin LanguageClient-neovim which seems like a pretty low code way to get going and thats cool and all, but like many people I already have the official 'nvim-lspconfig' plugin for my LSP server needs so after a bit of fiddling I got it working with this config:

require('lspconfig.configs').cfn_lsp = {
  default_config = {
    cmd = { os.getenv("HOME") .. '/.local/bin/cfn-lsp-extra' },
    filetypes = { 'yaml.cloudformation', 'json.cloudformation' },
    root_dir = function(fname)
      return require('lspconfig').util.find_git_ancestor(fname) or vim.fn.getcwd()
    end,
    settings = {
      documentFormatting = false,
    },
  },
}
require('lspconfig').cfn_lsp.setup{}

idk if you want to add this to the readme or not but figured at least if i put it here maybe it can help someone later

LaurenceWarne commented 12 months ago

Hi, yeah I'm more than happy to add more integration methods to the README, especially if that method is more prevalent than the existing :slightly_smiling_face:.

So I understand correctly (Emacs user), that config is for https://neovim.io/doc/user/lsp.html which is an LSP client which ships OOTB with Neovim, whilst https://github.com/autozimu/LanguageClient-neovim is a different neovim client which needs installing?

cbackas commented 12 months ago

@LaurenceWarne Yeah you basically hit the nail on the head. I'm not exactly sure what the context was when LanguageClient-neovim was created, maybe nvim's built in LSP client wasn't present or up to snuff at the time, but these days nvim's lsp client is great and I'd stick to it as much as possible.

LaurenceWarne commented 12 months ago

Cool, I added a note to the README here: https://github.com/LaurenceWarne/cfn-lsp-extra#neovim, does that look good to you? (I also added you as a co-auth, I hope you don't mind)

cbackas commented 12 months ago

@LaurenceWarne Looks great, thanks!

LaurenceWarne commented 12 months ago

No problem, thanks for raising!