From b22f882b6866209ba02fd69e00e2d32c96a6a949 Mon Sep 17 00:00:00 2001 From: mathijs-bakker Date: Wed, 20 Aug 2025 18:07:10 +0200 Subject: [PATCH] Update readme. cleaned up health --- README.md | 72 ++++++++++++++++++++++++++++++++++++++++- lua/godotdev/health.lua | 3 -- 2 files changed, 71 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1661de0..2201fb9 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,72 @@ # godotdev.nvim -Godot development tools for Neovim + +A Neovim plugin for connecting to the Godot editor LSP server to provide code navigation, diagnostics, and LSP features for GDScript projects. Supports Windows, macOS, and Linux. + +## Features + +- Connect to a running Godot editor's TCP LSP server. +- LSP-based code navigation for GDScript (`gd`/`gdscript`). +- Diagnostics, hover documentation, workspace symbols, and more. +- Healthcheck to validate editor LSP and required tools. +- OS-aware handling for TCP connection (`ncat` required on Windows). + +## Requirements + +- Neovim 0.11+ +- Godot editor with TCP LSP server enabled (Editor Settings → Network → Enable TCP LSP server). +- **Windows:** `ncat` must be installed (via Scoop or Chocolatey). +- **macOS/Linux:** optional `nc` for port check; otherwise assumed reachable. + +## Installation + +Using [Lazy.nvim](https://github.com/folke/lazy.nvim): +```lua +`return { + 'Mathijs-Bakker/godotdev.nvim', + lazy = false, + config = function() + require("godotdev").setup { + editor_port = 6005, -- optional, default is 6005 + editor_host = "127.0.0.1" -- optional, default is localhost + } + end +} +``` + +Quickstart + +1. Open your Godot project and ensure the TCP LSP server is enabled. +1. Open Neovim and edit a `.gd` or `.gdscript` file. +1. The plugin automatically attaches the LSP client. +1. Run healthcheck if needed: + ``` + `:checkhealth godotdev` + ``` +1. Use LSP keymaps: + - `gd` → Go to definition + - `gD` → Go to declaration + - `gy` → Type definition + - `gi` → Go to implementation + - `gr` → List references + - `K` → Hover documentation + - `rn` → Rename symbol + - `f` → Format buffer + - `gl` → Show diagnostics + - `[d` / `]d` → Navigate diagnostics + +## Configuration Options +```lua +`require("godotdev").setup { + editor_host = "127.0.0.1", -- default + editor_port = 6005, -- default +}` +``` + +## Notes + +- The plugin does **not** start a Godot instance automatically; the Godot editor must be running with TCP LSP enabled. +- On Windows, `ncat` is required for the TCP LSP connection. On macOS/Linux, the plugin assumes the port is reachable. + +## License + +MIT License diff --git a/lua/godotdev/health.lua b/lua/godotdev/health.lua index 2fcfd76..e067428 100644 --- a/lua/godotdev/health.lua +++ b/lua/godotdev/health.lua @@ -18,7 +18,6 @@ local function port_open(host, port) vim.fn.system(cmd) return vim.v.shell_error == 0 else - -- On macOS/Linux, attempt nc if available; otherwise assume reachable if vim.fn.executable("nc") == 1 then local cmd = string.format("nc -z -w 1 %s %d 2>/dev/null", host, port) vim.fn.system(cmd) @@ -31,7 +30,6 @@ end function M.check() health.start("Godotdev.nvim") - -- only check ncat on Windows if is_windows then if vim.fn.executable("ncat") == 1 then health.ok("'ncat' is installed") @@ -42,7 +40,6 @@ function M.check() end end - -- Godot editor LSP port check local port = M.opts.editor_port if port_open("127.0.0.1", port) then health.ok("Godot editor LSP detected on port " .. port)