https://github.com/mathijs-bakker/godot-lsp.nvim
Neovim plugin for Godot LSP & DAP. Supports GDScript with TreeSitter. Use Neovim as your Godot's external editor.
https://github.com/mathijs-bakker/godot-lsp.nvim
dap debugger gdscript godot lsp neovim neovim-plugin
Last synced: 9 months ago
JSON representation
Neovim plugin for Godot LSP & DAP. Supports GDScript with TreeSitter. Use Neovim as your Godot's external editor.
- Host: GitHub
- URL: https://github.com/mathijs-bakker/godot-lsp.nvim
- Owner: Mathijs-Bakker
- License: mit
- Archived: true
- Created: 2025-08-09T14:26:10.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2025-08-21T17:23:07.000Z (10 months ago)
- Last Synced: 2025-08-30T19:02:36.881Z (9 months ago)
- Topics: dap, debugger, gdscript, godot, lsp, neovim, neovim-plugin
- Language: Lua
- Homepage:
- Size: 269 KB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## This project is archived,
### there's a better solution here: [godotdev.nvim](https://github.com/Mathijs-Bakker/godotdev.nvim)
# godot-lsp.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.
## ๐ Table of Contents
- [โจ Features](#-features)
- [โ Requirements](#-requirements)
- [๐ฑ Why I Created This Plugin](#-why-i-created-this-plugin)
- [๐ Quick Start](#-quick-start)
- [โ๏ธ Setup](#%EF%B8%8F-setup)
- [๐ฆ Installation](#-installation)
- [๐ณ TreeSitter Parser](#-treesitter-parser)
- [๐ External Editor](#-external-editor)
- [๐ฎ Usage](#-usage)
- [๐ค Commands](#-commands)
- [๐ ๏ธ Configuration](#%EF%B8%8F-configuration)
- [๐ Debug Logging](#-debug-logging)
- [๐ชฒ DAP Debugging](#-dap-debugging)
- [๐ต๐ปโโ๏ธ Troubleshooting](#%EF%B8%8F-troubleshooting)
- [๐ค Contributing](#-contributing)
- [๐ License](#-license)
## โจ Features
- **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`).
## โ Requirements
- Neovim 0.9.0+
- `ncat` (e.g., `brew install ncat` on macOS, `apt install ncat` on Linux)
- Godot 4.3+ with `--lsp`
- [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig)
- [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter)
- Optional: [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim), [nvim-dap](https://github.com/mfussenegger/nvim-dap), [nvim-dap-ui](https://github.com/rcarriga/nvim-dap-ui)
## ๐ฑ Why I Created This Plugin
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?
## ๐ Quick Start
1. Install with **lazy.nvim**:
```lua
require("lazy").setup({ { "Mathijs-Bakker/godot-lsp.nvim" } })
```
```
:Lazy sync
```
1. Start Godot: `godot --editor --lsp --verbose`
1. Configure external editor (see Setup).
1. Open a `.gd` file in Neovim for LSP features.
## โ๏ธ Setup
### ๐ฆ Installation
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
```
### ๐ณ TreeSitter Parser
Install the `gdscript` parser:
```
:TSInstall gdscript
```
### ๐ External Editor
1. Create a launch script (e.g., `~/.local/bin/open-nvim-godot.sh`):
```bash
#!/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"
```
1. Make executable:
```bash
chmod +x ~/.local/bin/open-nvim-godot.sh
```
1. Add to PATH:
```bash
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc && source ~/.bashrc
```
1. Configure Godot: `Editor > Editor Settings > Text Editor > External` with full path and `"{file}" "{line}" "{col}"`.
### ๐ฎ Usage
- 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), `cd` (diagnostics), etc.
- **Autocommands**: Auto-attaches buffers, syncs with Godot.
- See [Commands](#-commands) and [Configuration](%EF%B8%8F-configuration) for more.
### ๐ค Commands
- `:GodotLspStart:` Start LSP manually.
- `:GodotLspStatus:` Check server status.
- `:GodotLspAttachAll:` Attach all buffers.
### ๐ ๏ธ Configuration
Customize via `setup`:
```lua
require("godot-lsp").setup({
cmd = { "ncat", "localhost", "6005" },
keymaps = { definition = "gd", hover = "K", format = nil },
})
```
You can find a complete setup example [here](docs/TROUBLESHOOTING.md#%EF%B8%8F-example-setup).
## ๐ Debug Logging
Enable with `debug_logging = true` for logs in `~/.cache/nvim/godot-lsp.log`.
## ๐ชฒ DAP Debugging
Enable with `dap = true` and `godot --remote-debug localhost:6006 --editor`.
Use:
- `` (continue),
- `` (breakpoint),
- etc.
# ๐ต๐ปโโ๏ธ Troubleshooting
Common Issues: LSP not starting, no syntax highlighting, DAP failures, plugin setup.
Details: See full [troubleshooting](docs/TROUBLESHOOTING.md) for steps and workarounds.
## ๐ค Contributing
Submit issues or PRs at github.com/Mathijs-Bakker/godot-lsp.nvim.
## ๐ License
[MIT License](LICENSE)