there's a better solution here: godotdev.nvim
A Neovim plugin to integrate Godot's LSP for GDScript, providing features like go-to-definition, hover documentation, diagnostics, and completion across multiple buffers. Supports TreeSitter syntax highlighting and experimental DAP debugging.
- ✨ Features
- ❗ Requirements
- 🌱 Why I Created This Plugin
- 🚀 Quick Start
- ⚙️ Setup
- 🎮 Usage
- 🕵🏻♂️ Troubleshooting
- 🤝 Contributing
- 📄 License
- LSP Integration: Autocompletion, definitions, references, and diagnostics via Godot’s LSP.
- Multi-Buffer Support: Syncs LSP across all GDScript buffers.
- TreeSitter: Enhanced syntax highlighting.
- Custom Keymaps: Configurable shortcuts for LSP actions.
- DAP Debugging: Experimental debugging support (unstable).
Full Feature Details
- Connects to Godot’s LSP server via
ncat
on port 6005. - Supports go-to-definition, hover documentation, renaming, and workspace symbols.
- Automatic buffer attachment and TreeSitter highlighting on
.gd
file open. - Experimental DAP with breakpoints and step-through (requires
nvim-dap
).
- Neovim 0.9.0+
ncat
(e.g.,brew install ncat
on macOS,apt install ncat
on Linux)- Godot 4.3+ with
--lsp
- nvim-lspconfig
- nvim-treesitter
- Optional: telescope.nvim, nvim-dap, nvim-dap-ui
I built this to use Neovim as my Godot external editor, frustrated by ineffective setups and plugins. It’s macOS-focused, uses Ghostty, but runs on Linux too. No Windows support yet—contributions welcome! Ooh did I mentioned experimental DAP debugging?
- Install with lazy.nvim:
require("lazy").setup({ { "Mathijs-Bakker/godot-lsp.nvim" } })
:Lazy sync
- Start Godot:
godot --editor --lsp --verbose
- Configure external editor (see Setup).
- Open a
.gd
file in Neovim for LSP features.
Use lazy.nvim:
luarequire("lazy").setup({
{ "Mathijs-Bakker/godot-lsp.nvim", config = function() require("godot-lsp").setup() end },
{ "neovim/nvim-lspconfig" },
{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" },
})
Then run:
:Lazy sync
Install the gdscript
parser:
:TSInstall gdscript
- Create a launch script (e.g.,
~/.local/bin/open-nvim-godot.sh
):#!/bin/bash FILE="$1" LINE="$2" COL="$3" /Applications/Ghostty.app/Contents/MacOS/ghostty -- nvim "$FILE" +"$LINE:$COL" # Linux: gnome-terminal -- nvim "$FILE" +"$LINE:$COL"
- Make executable:
chmod +x ~/.local/bin/open-nvim-godot.sh
- Add to PATH:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc && source ~/.bashrc
- Configure Godot:
Editor > Editor Settings > Text Editor > External
with full path and"{file}" "{line}" "{col}"
.
- Start Godot with
godot --editor --lsp --verbose
. - Open
.gd
files for LSP and TreeSitter features. - Use keymaps (see Configuration).
Advanced Usage
- Keymaps:
gd
(definition),K
(hover),<leader>cd
(diagnostics), etc. - Autocommands: Auto-attaches buffers, syncs with Godot.
- See Commands and Configuration for more.
:GodotLspStart:
Start LSP manually.:GodotLspStatus:
Check server status.:GodotLspAttachAll:
Attach all buffers.
Customize via setup
:
require("godot-lsp").setup({
cmd = { "ncat", "localhost", "6005" },
keymaps = { definition = "gd", hover = "K", format = nil },
})
You can find a complete setup example here.
Enable with debug_logging = true
for logs in ~/.cache/nvim/godot-lsp.log
.
Enable with dap = true
and godot --remote-debug localhost:6006 --editor
.
Use:
<F5>
(continue),<F9>
(breakpoint),- etc.
Common Issues: LSP not starting, no syntax highlighting, DAP failures, plugin setup.
Details: See full troubleshooting for steps and workarounds.
Submit issues or PRs at github.com/Mathijs-Bakker/godot-lsp.nvim.