diff --git a/nvim/.config/nvim/after/ftplugin/purescript.lua b/nvim/.config/nvim/after/ftplugin/purescript.lua index aa20136..13ee5c6 100644 --- a/nvim/.config/nvim/after/ftplugin/purescript.lua +++ b/nvim/.config/nvim/after/ftplugin/purescript.lua @@ -1,2 +1,14 @@ vim.bo.textwidth = 0 vim.bo.wrapmargin = 0 + +local lsp_utils = require('lsp-utils') +local puresls_config = lsp_utils.pursls_config() + +vim.lsp.start(puresls_config) + +vim.api.nvim_create_autocmd({ "BufReadPre", "BufWinEnter" }, { + pattern = { "*.spago/*" }, + callback = function() + vim.bo.buflisted = false + end, +}) diff --git a/nvim/.config/nvim/lua/lsp-utils.lua b/nvim/.config/nvim/lua/lsp-utils.lua index 251a820..72d9ddc 100644 --- a/nvim/.config/nvim/lua/lsp-utils.lua +++ b/nvim/.config/nvim/lua/lsp-utils.lua @@ -211,6 +211,24 @@ function M.jedi_config() } end +function M.pursls_config() + local root_files = { 'bower.json', 'psc-package.json', 'spago.dhall' } + local root_directory = get_root_directory(root_files) + + return { + name = "purescriptls", + cmd = { 'purescript-language-server', '--stdio' }, + root_dir = root_directory, + filetypes = { 'purescript' }, + single_file_support = false, + settings = { + purescript = { + formatter = 'purs-tidy', + } + }, + } +end + function M.ra_config() local root_files = { "Cargo.toml" } local root_directory = get_root_directory(root_files)