LaurenceWarne / cfn-lsp-extra

An Experimental Cloudformation language server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nvim-lspconfig setup

cbackas opened this issue · comments

commented

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

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 🙂.

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?

commented

@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.

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)

commented

@LaurenceWarne Looks great, thanks!

No problem, thanks for raising!