From 58ad4a05690cf492f692d23092b3a316af3eb588 Mon Sep 17 00:00:00 2001 From: lenitain Date: Tue, 7 Apr 2026 13:02:02 +0800 Subject: [PATCH] feat(moonbit): add MoonBit language extra --- lua/lazyvim/plugins/extras/lang/moonbit.lua | 49 +++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 lua/lazyvim/plugins/extras/lang/moonbit.lua diff --git a/lua/lazyvim/plugins/extras/lang/moonbit.lua b/lua/lazyvim/plugins/extras/lang/moonbit.lua new file mode 100644 index 00000000..6e4c7f84 --- /dev/null +++ b/lua/lazyvim/plugins/extras/lang/moonbit.lua @@ -0,0 +1,49 @@ +return { + recommended = function() + return LazyVim.extras.wants({ + ft = { "moonbit", "mbt" }, + root = { "moon.mod.json" }, + }) + end, + + { + "nvim-treesitter/nvim-treesitter", + opts = { ensure_installed = { "moonbit" } }, + }, + + -- TODO: Enable once moonbit LSP is available in mason registry + -- https://github.com/mason-org/mason-registry + -- { + -- "mason-org/mason.nvim", + -- optional = true, + -- opts = function(_, opts) + -- opts.ensure_installed = opts.ensure_installed or {} + -- vim.list_extend(opts.ensure_installed, { "moonbit-lsp" }) + -- end, + -- }, + + { + "neovim/nvim-lspconfig", + opts = { + servers = { + moonbit = { + cmd = { "moonbit-lsp" }, + filetypes = { "moonbit", "mbt" }, + root_dir = function(fname) + return require("lspconfig.util").root_pattern("moon.mod.json")(fname) + end, + }, + }, + }, + }, + + { + "stevearc/conform.nvim", + optional = true, + opts = { + formatters_by_ft = { + moonbit = { "moonfmt" }, + }, + }, + }, +}