From 900b2d0b24f65d0f5fbf985582396bd164831449 Mon Sep 17 00:00:00 2001 From: Marco Date: Tue, 11 Jun 2024 10:55:54 +0200 Subject: [PATCH] chage gdscript setup and make hidden file searchable with telescope --- after/ftplugin/gdscript.lua | 23 +++++++++++++++++++++++ after/plugin/lsp/lsp-gdscript.lua | 12 ------------ after/plugin/lsp/lsp-html.lua | 8 +------- after/plugin/telescope.lua | 3 +++ 4 files changed, 27 insertions(+), 19 deletions(-) create mode 100644 after/ftplugin/gdscript.lua delete mode 100644 after/plugin/lsp/lsp-gdscript.lua diff --git a/after/ftplugin/gdscript.lua b/after/ftplugin/gdscript.lua new file mode 100644 index 0000000..f14e511 --- /dev/null +++ b/after/ftplugin/gdscript.lua @@ -0,0 +1,23 @@ +local port = os.getenv('GDScript_Port') or 6005 +local cmd = vim.lsp.rpc.connect('127.0.0.1', port) +local pipe = '/tmp/godot.pipe' + +vim.lsp.start({ + name = 'Godot', + cmd = cmd, + root_dir = vim.fs.dirname(vim.fs.find({ 'project.godot', '.git' }, { upward = true })[1]), + on_attach = function(client, bufnr) + print("gdscipt.lua on_attach") + vim.api.nvim_command('echo serverstart("' .. pipe .. '")') + end +}) + +vim.api.nvim_create_autocmd('BufWritePost', + { + pattern = '*.gd', + callback = function() + local file = vim.api.nvim_buf_get_name(0) + local job = vim.fn.jobstart({ "gdformat", file }) + vim.fn.jobwait({ job }) + end, + }) diff --git a/after/plugin/lsp/lsp-gdscript.lua b/after/plugin/lsp/lsp-gdscript.lua deleted file mode 100644 index a740adc..0000000 --- a/after/plugin/lsp/lsp-gdscript.lua +++ /dev/null @@ -1,12 +0,0 @@ -require("lspconfig").gdscript.setup {} - -vim.api.nvim_create_autocmd('BufWritePost', - { - pattern = '*.gd', - callback = function() - local file = vim.api.nvim_buf_get_name(0) - local job = vim.fn.jobstart({ "gdformat", file }) - vim.fn.jobwait({ job }) - vim.cmd(":e") - end, - }) diff --git a/after/plugin/lsp/lsp-html.lua b/after/plugin/lsp/lsp-html.lua index 81a58fa..07b85e0 100644 --- a/after/plugin/lsp/lsp-html.lua +++ b/after/plugin/lsp/lsp-html.lua @@ -1,7 +1 @@ ---Enable (broadcasting) snippet capability for completion -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities.textDocument.completion.completionItem.snippetSupport = true - -require 'lspconfig'.html.setup { - capabilities = capabilities, -} +require 'lspconfig'.html.setup {} diff --git a/after/plugin/telescope.lua b/after/plugin/telescope.lua index c8e2338..61b3984 100644 --- a/after/plugin/telescope.lua +++ b/after/plugin/telescope.lua @@ -8,6 +8,9 @@ vim.keymap.set('n', 'fs', builtin.lsp_dynamic_workspace_symbols); require("telescope").setup({ + pickers = { + find_files = { hidden = true } + }, extensions = { ["ui-select"] = { require("telescope.themes").get_dropdown {