Neovim has built in LSP support, and the Flow CLI tool has language-server capabilities built into it, so I’m trying to get it working in Neovim. This is in lieu of LSP support from the nvim-lspconfig plugin, which I am using for all of my language servers besides Cadence currently.
Preamble:
I am aware of the coc-cadence plugin. I do not use CoC in my nvim config. Instead I use:
- nvim-cmp (for completion)
- null-ls (for formatting)
So this is what I have in my config right now:
vim.api.nvim_create_autocmd("FileType", { pattern = "cadence", callback = function() vim.lsp.start({ name = "cadence-language-server", cmd = { "flow", "cadence", "language-server" }, root_dir = vim.fs.dirname(vim.fs.find({ "flow.json" }, { upward = true })[1]), }) end, })
But I get the following error upon nvim startup for a flow project:
Error executing vim.schedule lua callback: …w/Cellar/neovim/0.8.0/share/nvim/runtime/lua/vim/lsp.lua:1285: RPC[Error] code_name = InternalError, message = “invalid initializat
ion options”
stack traceback:
[C]: in function ‘assert’
…w/Cellar/neovim/0.8.0/share/nvim/runtime/lua/vim/lsp.lua:1285: in function ‘’
vim/_editor.lua: in function <vim/_editor.lua:0>
If anyone has luck getting the Cadence LSP that is bundled with the Flow CLI tool working with Neovim built in LSP, please do share here. I will be posting updates as I make progress.
Thanks all!