DEV Community

Cover image for πŸš€ Neovim + COQ + Mason + LSP: Mini Guide
Alberto Barrago
Alberto Barrago

Posted on

πŸš€ Neovim + COQ + Mason + LSP: Mini Guide

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" }, }, 
Enter fullscreen mode Exit fullscreen mode

⚑ 2. Enable COQ Auto-Start

COQ does not start automatically unless configured.

vim.g.coq_settings = { auto_start = 'shut-up' } 
Enter fullscreen mode Exit fullscreen mode

Alternatively, use manually later:

:COQnow 
Enter fullscreen mode Exit fullscreen mode

🧠 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, }, }) 
Enter fullscreen mode Exit fullscreen mode

❗ 4. What Not To Do

❌ Do NOT use omnifunc with COQ

autocmd FileType markdown setlocal omnifunc=coq#complete 
Enter fullscreen mode Exit fullscreen mode

Remove this. COQ does not use omnifunc.

πŸ§ͺ 5. Verification Steps

βœ” Check if LSPs are connected:

:LspInfo 
Enter fullscreen mode Exit fullscreen mode

βœ” Check COQ status:

:COQnow 
Enter fullscreen mode Exit fullscreen mode

βœ” 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", ... } 
Enter fullscreen mode Exit fullscreen mode

πŸŽ‰ Done!

You now have a clean Neovim setup using COQ + Mason + LSP.

Top comments (0)