Skip to content
This repository was archived by the owner on Aug 21, 2025. It is now read-only.

Neovim plugin for Godot LSP & DAP. Supports GDScript with TreeSitter. Use Neovim as your Godot's external editor.

License

Notifications You must be signed in to change notification settings

Mathijs-Bakker/godot-lsp.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project is archived,

there's a better solution here: 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

  • 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

🌱 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:
    require("lazy").setup({ { "Mathijs-Bakker/godot-lsp.nvim" } })
    :Lazy sync
    
  2. Start Godot: godot --editor --lsp --verbose
  3. Configure external editor (see Setup).
  4. 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):
    #!/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"
  2. Make executable:
    chmod +x ~/.local/bin/open-nvim-godot.sh
  3. Add to PATH:
    echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc && source ~/.bashrc
  4. 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), <leader>cd (diagnostics), etc.
  • Autocommands: Auto-attaches buffers, syncs with Godot.
  • See Commands and Configuration for more.

🤖 Commands

  • :GodotLspStart: Start LSP manually.
  • :GodotLspStatus: Check server status.
  • :GodotLspAttachAll: Attach all buffers.

🛠️ Configuration

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.

📋 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:

  • <F5> (continue),
  • <F9> (breakpoint),
  • etc.

🕵🏻‍♂️ Troubleshooting

Common Issues: LSP not starting, no syntax highlighting, DAP failures, plugin setup.
Details: See full troubleshooting for steps and workarounds.

🤝 Contributing

Submit issues or PRs at github.com/Mathijs-Bakker/godot-lsp.nvim.

📄 License

MIT License

About

Neovim plugin for Godot LSP & DAP. Supports GDScript with TreeSitter. Use Neovim as your Godot's external editor.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages