Home

Awesome

nvimmer-ps

a neovim plugin for PureScript that supplements the built-in purescript-language-server

HOW TO INSTALL

-- lazy.nvim
{
  "srghma/nvimmer-ps",
  dependencies = {
    "nvim-lua/plenary.nvim",     -- Add plenary.nvim as a dependency
    "nvim-telescope/telescope.nvim", -- Add telescope.nvim as a dependency
  },
  config = function()
    -- or require("nvimmer-ps").setup({ keymaps = { ... } })
    require("nvimmer-ps").setup()
    
		local nvim_lsp = require("lspconfig")
		nvim_lsp.purescriptls.setup({
			on_attach = function(client, bufnr)
				require("nvimmer-ps").setup_on_attach(client, bufnr)
			end,
			on_init = function(client)
				require("nvimmer-ps").setup_on_init(client)
			end,
			flags = {
				debounce_text_changes = 150,
			},
			settings = {
				purescript = {
					formatter = "purs-tidy",
					addSpagoSources = true,
				},
			},
		})
  end,
}

OR check https://github.com/AstroNvim/astrocommunity/pull/1222

OR check ./nvim-config-test.lua (can be run with nvim --clean -u ./nvim-config-test.lua ~/projects/purescript-pathy-node/src/Pathy/Node/OS.purs)

Commands

KeystrokeCommand FunctionDescription
<space>amadd_import()Show list of available modules from spago, enter to add import
<space>aeadd_explicit_import()Will get current symbol, show modules that contain it, enter to add import
<space>asisearch_pursuit()Search identifier under cursor, all 3 types (declarations, packages, modules), enter to open in browser, ctrl+i to add import statement (but if package - open in browser)
<space>asmsearch_pursuit_modules()Search modules in Pursuit, like search_pursuit, but filters only modules, and shows different UI, same keybindings
<space>accase_split()Case split (TODO: doesnt work in vscode too)
<space>aaadd_clause()Add clause (generate function from a type of function)
<space>albbuild()Build
<space>alsstart()Start
<space>altstop()Stop
<space>alrrestart()Restart

Intercepted

Also, it intercepts purescript.typedHole command FROM purescript-language-server:

Example: You have code leftSide _ = ?asdf, You apply code action from lsp (<leader>la in astronvim), You choose Apply typed hole suggestion - This plugin will render telescope picker with list of typed hole suggestions and you can select one to apply.

IMAGE ALT TEXT HERE

Contribute

./spec tests dont work yet