grace/dots

dotfiles/nix configs

git clone https://git.gae.moe/grace/dots

Grace Yoderhx and vcs changesddf0c79

idk
1.6 KiB60 linesraw
1local function connect_to_godot_server()
2  -- Check if project.godot exists in current directory
3  local project_file = vim.fn.getcwd() .. "/project.godot"
4  if vim.fn.filereadable(project_file) == 1 then
5    local pipe_path = vim.fn.getcwd() .. "/nvim_server.pipe"
6
7    -- Create the pipe if it doesn't exist, then connect
8    local success = vim.fn.serverstart(pipe_path)
9    if success then
10      print("Connected to Godot server via " .. pipe_path)
11    else
12      print("Failed to create/connect to Godot server pipe: " .. pipe_path)
13    end
14
15    local dap = require("dap")
16
17    dap.adapters.godot = {
18      type = 'server',
19      host = '127.0.0.1',
20      port = 6006,
21    }
22
23    dap.configurations.gdscript = {
24      {
25        type = 'godot',
26        request = 'launch',
27        name = 'Launch scene',
28        project = '${workspaceFolder}',
29        launch_scene = true,
30      },
31    }
32
33    dap.configurations.cs = {
34      {
35        type = 'godot',
36        request = 'launch',
37        name = 'Launch scene',
38        project = '${workspaceFolder}',
39        launch_scene = true,
40      },
41    }
42  end
43end
44
45-- Auto-connect when Neovim starts
46vim.api.nvim_create_autocmd("VimEnter", {
47  callback = connect_to_godot_server,
48  desc = "Auto-connect to Godot server if project.godot exists"
49})
50
51-- Optional: Also check when changing directories
52vim.api.nvim_create_autocmd("DirChanged", {
53  callback = connect_to_godot_server,
54  desc = "Auto-connect to Godot server when changing to Godot project directory"
55})
56
57-- Optional: Command to manually connect
58vim.api.nvim_create_user_command("GodotConnect", connect_to_godot_server, {
59  desc = "Manually connect to Godot server"
60})