@bluesign wonderful thank you for sharing your config !
The issue was not passing in init_options
β Iβm not used to manually setting up LSPs so was unsure if issue was coming from my set up, or the Cadence LSP interface available to nvim.
Here is my working config:
vim.api.nvim_create_autocmd("FileType", {
pattern = "cadence",
callback = function()
local flow_project_dir = vim.fs.dirname(vim.fs.find({ "flow.json" }, { upward = true })[1])
vim.lsp.start({
name = "cadence-language-server",
cmd = { "flow", "cadence", "language-server" },
root_dir = flow_project_dir,
init_options = {
configPath = flow_project_dir .. "/flow.json",
numberOfAccounts = "1",
},
on_attach = on_attach,
capabilities = capabilities,
})
end,
})
Maybe you can try my implementation of init_options.configPath
so you donβt have nvim hardcoded to use a single project.
Things to Figure Out Still
- I like how you are importing from the
lspconfig
plugin. I tried out your implementation and couldnβt get LSP to attach. I will revisit this but for now I got the Cadence LSP running in Nvim which was my main goal. - I want to explore the rest of the
init_options
available. Feels odd hardcodingnumberOfAccounts = "1"
but not clear if it affects LSP usage in any way.