Hello, wondering, does Roc have a LSP already? Couldn't find anything relating to that, so I guess no. Thanks!
Hi @souf,
Yes, we do :) It's included in every release archive as roc_language_server. You can set it up with this extension for example: https://marketplace.visualstudio.com/items?itemName=IvanDemchenko.roc-lang-unofficial
@Anton thanks, that was helpful. Actually using neovim, and that's how I just configured it with lazyvim, in case it can help anyone:
plugins/lspconfig.lua
(replace /path/to/roc/
):
return {
{
"neovim/nvim-lspconfig",
opts = {
servers = {
roc_ls = {
cmd = { "/path/to/roc/roc_language_server" },
filetypes = { "roc" },
root_dir = require("lspconfig").util.root_pattern(".git", "main.roc"),
settings = {},
},
},
},
},
}
for autoformat via conform: plugins/conform.lua
(replace /path/to/roc/
)
return {
"stevearc/conform.nvim",
dependencies = { "mason-org/mason.nvim" },
opts = {
formatters_by_ft = {
-- roc
roc = { "roc_format" },
},
formatters = {
roc_format = {
command = "/path/to/roc/roc",
args = { "format", "--stdin", "--stdout" },
stdin = true,
},
},
},
}
Last updated: Oct 18 2025 at 12:13 UTC