feat(lsp): Move LSP config for godot and rust for 0.11
This commit is contained in:
parent
2cc2998907
commit
8460677953
17
lsp/gdscript.lua
Normal file
17
lsp/gdscript.lua
Normal file
@ -0,0 +1,17 @@
|
||||
local port = os.getenv 'GDScript_Port' or '6005'
|
||||
local cmd = vim.lsp.rpc.connect('127.0.0.1', tonumber(port))
|
||||
|
||||
return {
|
||||
default_config = {
|
||||
cmd = cmd,
|
||||
filetypes = { 'gd', 'gdscript', 'gdscript3' },
|
||||
root_markers = { '.git', 'project.godot' },
|
||||
},
|
||||
docs = {
|
||||
description = [[
|
||||
https://github.com/godotengine/godot
|
||||
|
||||
Language server for GDScript, used by Godot Engine.
|
||||
]],
|
||||
},
|
||||
}
|
21
lsp/rust-analyzer.lua
Normal file
21
lsp/rust-analyzer.lua
Normal file
@ -0,0 +1,21 @@
|
||||
return {
|
||||
cmd = { 'rust-analyzer' },
|
||||
filetypes = { 'rust' },
|
||||
root_markers = { '.git', 'cargo.toml' },
|
||||
settings = {
|
||||
imports = {
|
||||
granularity = {
|
||||
group = "module",
|
||||
},
|
||||
prefix = "self",
|
||||
},
|
||||
cargo = {
|
||||
buildScripts = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
procMacro = {
|
||||
enable = true
|
||||
},
|
||||
}
|
||||
}
|
33
lua/lsp.lua
33
lua/lsp.lua
@ -137,37 +137,6 @@ mason_lspconfig.setup_handlers {
|
||||
}
|
||||
|
||||
-- [[ System LSPs ]]
|
||||
local lspconfig = require('lspconfig')
|
||||
servers = {
|
||||
rust_analyzer = {
|
||||
["rust-analyzer"] = {
|
||||
imports = {
|
||||
granularity = {
|
||||
group = "module",
|
||||
},
|
||||
prefix = "self",
|
||||
},
|
||||
cargo = {
|
||||
buildScripts = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
procMacro = {
|
||||
enable = true
|
||||
},
|
||||
}
|
||||
},
|
||||
gdscript = {},
|
||||
}
|
||||
|
||||
for server_name, server_settings in pairs(servers) do
|
||||
lspconfig[server_name].setup {
|
||||
capabilities = capabilities,
|
||||
settings = server_settings,
|
||||
filetypes = (servers[server_name] or {}).filetypes,
|
||||
}
|
||||
end
|
||||
|
||||
local setup_godot_dap = function()
|
||||
local dap = require("dap")
|
||||
|
||||
@ -190,6 +159,6 @@ local setup_godot_dap = function()
|
||||
end
|
||||
|
||||
vim.diagnostic.config({ virtual_text = true })
|
||||
vim.lsp.enable({ "ltex_plus" })
|
||||
vim.lsp.enable({ "ltex_plus", "rust-analyzer", "gdscript" })
|
||||
|
||||
setup_godot_dap()
|
||||
|
Loading…
x
Reference in New Issue
Block a user