Skip to content

Commit

Permalink
feat(pack): Add purescript pack (#1222)
Browse files Browse the repository at this point in the history
* feat(pack): added purescript pack

* feat: finish nvimmer-ps

* feat(pack): added purescript pack -> fix suggestions

* Update lua/astrocommunity/pack/purescript/init.lua

Co-authored-by: Uzair Aftab <[email protected]>

* feat: default keymap configuration

* feat: default keymap configuration

---------

Co-authored-by: Uzair Aftab <[email protected]>
  • Loading branch information
srghma and Uzaaft authored Nov 18, 2024
1 parent 9170837 commit aaaa844
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lua/astrocommunity/pack/purescript/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# purescript Language Pack

This plugin pack does the following:

- Adds `purescript` Treesitter parsers
- Adds `purescript-language-server` language server
- Adds `purs-tidy` formatter
83 changes: 83 additions & 0 deletions lua/astrocommunity/pack/purescript/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
return {
{
"srghma/nvimmer-ps",
opts = {}, -- if nil - M.setup wont be called
},
{
"AstroNvim/astrocore",
---@type AstroCoreOpts
opts = {
filetypes = {
extension = { purs = "purescript" },
},
},
},
{
"nvim-treesitter/nvim-treesitter",
optional = true,
opts = function(_, opts)
if opts.ensure_installed ~= "all" then
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "purescript" })
end
end,
},
{
"williamboman/mason-lspconfig.nvim",
optional = true,
opts = function(_, opts)
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "purescriptls" })
end,
},
{
"jay-babu/mason-null-ls.nvim",
optional = true,
opts = function(_, opts)
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "purs-tidy" })
end,
},
{
"WhoIsSethDaniel/mason-tool-installer.nvim",
optional = true,
opts = function(_, opts)
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, {
"purescript-language-server",
"purs-tidy",
})
end,
},
{
"stevearc/conform.nvim",
optional = true,
opts = {
formatters_by_ft = {
purescript = { "purs-tidy" },
},
},
},
{
"AstroNvim/astrolsp",
---@type AstroLSPOpts
opts = {
---@diagnostic disable: missing-fields
config = {
purescriptls = {
flags = {
debounce_text_changes = 150,
},
-- root_dir fixes
-- "Problem running build: Reading Spago workspace configuration...\n\n✘ Your spago.yaml doesn't contain a workspace section."
-- when language server is being run in a monorepo (lot of spago.yaml files, but only the top one has "workspace section")
root_dir = function(_) return vim.fn.getcwd() end,
on_attach = function(...) require("nvimmer-ps").setup_on_attach(...) end,
on_init = function(...) require("nvimmer-ps").setup_on_init(...) end,
settings = {
purescript = {
formatter = "purs-tidy",
addSpagoSources = true,
},
},
},
},
},
},
}

0 comments on commit aaaa844

Please sign in to comment.