This guide explains how to properly set up COQ.nvim autocomplete
with Mason and LSP servers in Neovim. It includes the most
common pitfalls and a working configuration.
π§ 1. Install Required Plugins
Make sure you have:
-
ms-jpq/coq_nvim -
ms-jpq/coq.artifacts(optional, extra completions) -
williamboman/mason.nvim -
williamboman/mason-lspconfig.nvim -
neovim/nvim-lspconfig
Example (lazy.nvim):
{
"ms-jpq/coq_nvim",
branch = "coq",
},
{
"ms-jpq/coq.artifacts",
branch = "artifacts",
},
{
"williamboman/mason.nvim",
config = true,
},
{
"williamboman/mason-lspconfig.nvim",
dependencies = { "neovim/nvim-lspconfig" },
},
β‘ 2. Enable COQ Auto-Start
COQ does not start automatically unless configured.
vim.g.coq_settings = { auto_start = 'shut-up' }
Alternatively, use manually later:
:COQnow
π§ 3. Correct Working LSP + COQ Setup
require("mason").setup()
local coq = require("coq")
require("mason-lspconfig").setup({
ensure_installed = { "pyright", "jdtls", "dockerls", "elixirls", "ts_ls" },
automatic_installation = true,
handlers = {
function(server_name)
require("lspconfig")[server_name].setup(
coq.lsp_ensure_capabilities({})
)
end,
["elixirls"] = function()
require("lspconfig").elixirls.setup(
coq.lsp_ensure_capabilities({
settings = {
flags = {
debounce_text_changes = 150,
},
elixirLS = {
dialyzerEnabled = false,
fetchDeps = false,
}
}
})
)
end,
},
})
β 4. What Not To Do
β Do NOT use omnifunc with COQ
autocmd FileType markdown setlocal omnifunc=coq#complete
Remove this. COQ does not use omnifunc.
π§ͺ 5. Verification Steps
β Check if LSPs are connected:
:LspInfo
β Check COQ status:
:COQnow
β Test autocomplete
Open a file and type --- completion should appear.
π 6. Common Issues & Fixes
β Autocomplete doesn't show up
- COQ not started β
:COQnow - LSP not attached β
:LspInfo - Missing capabilities β use
coq.lsp_ensure_capabilities() - Remove delayed init like
vim.defer_fn
β Markdown has no completion
Install a Markdown LSP:
ensure_installed = { "marksman", ... }
π Done!
You now have a clean Neovim setup using COQ + Mason + LSP.
Top comments (0)