Hi! This is a work-in-progress LSP for GDScript.
Right now this project provides basic autocomplete for gdscript variables and functions, since the official LSP doesn't seem to work right for autocomplete in neovim.
Disclaimer: I've only tried to set this up with the lazyvim package manager, but if you know what you're doing, you should be able to get this to work with other setups as well.
-
rustup v1.26.0 or higher
-
cargo v1.74.1 or higher
-
neovim v0.10.0 or higher
-
lazyvim package manager - maybe? read the disclaimer above
-
Clone the repo.
-
Compile the project with
cargo build
. -
In your neovim config directory, add the following structure:
- nvim/
- lua/
- custom/
- plugins/
- godot_lsp.lua
- plugins/
- custom/
- lua/
- nvim/
-
In your godot_lsp.lua file add the following code:
local client = vim.lsp.start_client {
name = 'godot-lsp-test',
cmd = { '<path-to-cloned-project>/target/debug/godot-lsp' },
}
if not client then
vim.notify 'the test client failed'
return
end
vim.api.nvim_create_autocmd('FileType', {
pattern = 'gdscript',
callback = function()
vim.lsp.buf_attach_client(0, client)
end,
})
return {}
-
Replace
path-to-cloned-project
with the correct path. -
Make sure the godot_lsp plugin is loaded. My lazyvim config is set up so everything in the plugins folder is automatically loaded. This will probably be different depending on your vim package manager, but in lazyvim this is what I did (in
init.lua
):
require('lazy').setup({
{ import = 'custom.plugins' },
})