Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pack): add Moonbit language support #1224

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lua/astrocommunity/pack/moonbit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Moonbit Language Pack

Requires:

- [Moonbit CLI tools](https://www.moonbitlang.com/download/#moonbit-cli-tools)
- [moonbit-lsp](https://www.npmjs.com/package/@moonbit/moonbit-lsp)

This plugin pack does the following:

- Adds [`moonbit.nvim`](https://github.com/tonyfettes/moonbit.nvim) plugin which adds
- Adds `moonbit` Treesitter parser
- Adds `moonbit-lsp` language server
36 changes: 36 additions & 0 deletions lua/astrocommunity/pack/moonbit/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
return {
{
"tonyfettes/moonbit.nvim",
ft = "moonbit",
-- uncomment when mason support added to make sure command is available
-- dependencies = {
-- { "williamboman/mason.nvim", optional = true },
-- },
opts = function(_, opts)
-- only enable treesitter if the plugin is available
if not require("astrocore").is_available "nvim-treesitter" then opts.treesitter = { enabled = false } end
-- only enable the LSP if the lsp command is executable
if vim.fn.executable "moonbit-lsp" == 1 then
local astrolsp_avail, astrolsp = pcall(require, "astrolsp")
if astrolsp_avail then opts.lsp = astrolsp.lsp_opts "moonbit" end
else
opts.lsp = false
end
end,
},
-- uncomment if/when moonbit-lsp is added to lspconfig and mason-lspconfig
-- {
-- "williamboman/mason-lspconfig.nvim",
-- opts = function(_, opts)
-- opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "harper-ls" })
-- end,
-- },
-- uncomment when merged upstream: https://github.com/mason-org/mason-registry/pull/7350
-- {
-- "WhoIsSethDaniel/mason-tool-installer.nvim",
-- optional = true,
-- opts = function(_, opts)
-- opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "moonbit-lsp" })
-- end,
-- },
}
Loading