From 51824ef86bbbb0b186617d505241501eb15484a9 Mon Sep 17 00:00:00 2001 From: juancwu Date: Sat, 30 May 2026 01:20:23 +0000 Subject: [PATCH] (nvim) fix issues with ts-autotag --- nvim/lsp/postgres_lsp.lua | 15 +++++++++++++++ nvim/lua/plugins.lua | 23 +++++++++++++++++++++++ nvim/lua/treesitter.lua | 8 ++++++++ nvim/nvim-pack-lock.json | 3 ++- 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 nvim/lsp/postgres_lsp.lua diff --git a/nvim/lsp/postgres_lsp.lua b/nvim/lsp/postgres_lsp.lua new file mode 100644 index 0000000..94a2379 --- /dev/null +++ b/nvim/lsp/postgres_lsp.lua @@ -0,0 +1,15 @@ +---@brief +--- +--- https://pg-language-server.com +--- +--- A collection of language tools and a Language Server Protocol (LSP) implementation for Postgres, focusing on developer experience and reliable SQL tooling. + +---@type vim.lsp.Config +return { + cmd = { "postgres-language-server", "lsp-proxy" }, + filetypes = { + "sql", + }, + root_markers = { "postgres-language-server.jsonc" }, + workspace_required = true, +} diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua index 9b6aa38..475716e 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/plugins.lua @@ -214,6 +214,29 @@ vim.pack.add({ require("mini.pairs").setup() +-- auto closing tags +vim.pack.add({ + { + src = "https://github.com/windwp/nvim-ts-autotag", + version = "8e1c0a389f20bf7f5b0dd0e00306c1247bda2595", + }, +}) + +require("nvim-ts-autotag").setup({ + filetypes = { + "html", + "javascript", + "typescript", + "javascriptreact", + "typescriptreact", + "svelte", + "vue", + "xml", + "php", + "templ", + }, +}) + -- telescope vim.pack.add({ { diff --git a/nvim/lua/treesitter.lua b/nvim/lua/treesitter.lua index 39c6e5d..17c106c 100644 --- a/nvim/lua/treesitter.lua +++ b/nvim/lua/treesitter.lua @@ -21,6 +21,14 @@ local ensured_installed = { "typescript", "lua", "templ", + -- parsers for nvim-ts-autotag filetypes; without these + -- vim.treesitter.get_parser() returns nil on nvim 0.12 and + -- autotag crashes on InsertLeave + "html", + "tsx", + "svelte", + "vue", + "xml", } local already_installed = treesitter.get_installed() local parsers_to_install = vim.iter(ensured_installed) diff --git a/nvim/nvim-pack-lock.json b/nvim/nvim-pack-lock.json index a023a5a..83deb2e 100644 --- a/nvim/nvim-pack-lock.json +++ b/nvim/nvim-pack-lock.json @@ -101,7 +101,8 @@ }, "nvim-ts-autotag": { "rev": "8e1c0a389f20bf7f5b0dd0e00306c1247bda2595", - "src": "https://github.com/windwp/nvim-ts-autotag" + "src": "https://github.com/windwp/nvim-ts-autotag", + "version": "'8e1c0a389f20bf7f5b0dd0e00306c1247bda2595'" }, "nvim-ts-context-commentstring": { "rev": "6141a40173c6efa98242dc951ed4b6f892c97027",