Skip to content

Commit

Permalink
🎉 (lsp.lua, moonbit_lsp.lua) Add monnbit-lsp support.
Browse files Browse the repository at this point in the history
  • Loading branch information
Comamoca committed Oct 6, 2024
1 parent c32ec7c commit 0adad1a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
10 changes: 7 additions & 3 deletions config/nvim/lua/configs/lsp.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
local lspconfig = require("lspconfig")
local server_config = require('lspconfig.configs')
-- local mason = require("mason")
-- local mason_lspconfig = require("mason-lspconfig")

require("lazydev").setup()

require("ddc_source_lsp_setup").setup()
local capabilities = require("ddc_source_lsp").make_client_capabilities()

local lspconfig = require("lspconfig")

local util = lspconfig.util

server_config.moonbit = require "configs/moonbit_lsp"

lspconfig.moonbit.setup({})
lspconfig.metals.setup({})

-- when find `gleam.toml` in project root, start gleam lsp server.
Expand Down Expand Up @@ -37,6 +40,7 @@ local servers = {
"ruby_lsp",
"gopls",
"denols",
"moonbit"
}

-- Auto start language servers.
Expand Down
18 changes: 18 additions & 0 deletions config/nvim/lua/configs/moonbit_lsp.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
local util = require 'lspconfig.util'

return {
default_config = {
cmd = { 'moonbit-lsp' },
filetypes = { "moonbit" },
root_dir = util.root_pattern 'moon.mod.json',
},
docs = {
description = [[
The moonbit language server.
```sh
npm install -g @moonbit/moonbit-lsp
```
]],
},
}

0 comments on commit 0adad1a

Please sign in to comment.