Last active
October 7, 2024 16:20
-
-
Save effinsky/b8f76cb832d457379311dabf0375b26e to your computer and use it in GitHub Desktop.
condensed gleam setup for neovim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local capabilities = vim.lsp.protocol.make_client_capabilities() | |
local on_attach = require("user.lsp.handlers").on_attach | |
local on_attach = function(client) | |
if client.name == "gleam" then | |
client.server_capabilities.documentFormattingProvider = true | |
end | |
-- lsp_keymaps() loads my lsp handler keymaps, not gleam specific and you should | |
-- have this handled somehow if other lsp work for you | |
lsp_keymaps() | |
local status_ok, illuminate = pcall(require, "illuminate") | |
if not status_ok then | |
return | |
end | |
illuminate.on_attach(client) | |
end | |
-- gotta have lspconfig imported with you pmanager, I reckon | |
local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig") | |
if not lspconfig_status_ok then | |
return | |
end | |
lspconfig.gleam.setup({ | |
cmd = { "gleam", "lsp" }, | |
filetypes = { "gleam" }, | |
root_dir = lspconfig.util.root_pattern("gleam.toml", ".git"), | |
on_attach = on_attach, | |
capabilities = require("user.lsp.handlers").capabilities, | |
}) | |
-- try https://github.com/gleam-lang/gleam.vim as well but has nothing to do | |
-- with lsp, I don't think |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment