From 58fe16c3d800f52e7a1d4279b773c69d3d7deac2 Mon Sep 17 00:00:00 2001 From: Tyler Hallada Date: Fri, 1 Dec 2023 15:26:00 -0500 Subject: [PATCH] Add typescript.nvim --- lua/install-plugins.lua | 6 ++++++ lua/plugins/lsp.lua | 9 +++++---- lua/plugins/null-ls-nvim.lua | 2 ++ lua/plugins/typescript-nvim.lua | 7 +++++++ 4 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 lua/plugins/typescript-nvim.lua diff --git a/lua/install-plugins.lua b/lua/install-plugins.lua index b7b9666..850869b 100644 --- a/lua/install-plugins.lua +++ b/lua/install-plugins.lua @@ -319,6 +319,12 @@ return require('packer').startup(function(use) require('plugins.rust-tools-nvim') end, } + use { + 'jose-elias-alvarez/typescript.nvim', + config = function() + require('plugins.typescript-nvim') + end, + } use { 'tzachar/cmp-tabnine', run = './install.sh', diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 99f9e4b..a60b762 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -15,10 +15,11 @@ require('lspconfig')['pyright'].setup({ on_attach = on_attach, flags = lsp_flags, }) -require('lspconfig')['tsserver'].setup({ - on_attach = on_attach, - flags = lsp_flags, -}) +-- Setup by typescript.nvim automatically +-- require('lspconfig')['tsserver'].setup({ +-- on_attach = on_attach, +-- flags = lsp_flags, +-- }) require('lspconfig')['jsonls'].setup({ on_attach = on_attach, flags = lsp_flags, diff --git a/lua/plugins/null-ls-nvim.lua b/lua/plugins/null-ls-nvim.lua index 63fc558..0240476 100644 --- a/lua/plugins/null-ls-nvim.lua +++ b/lua/plugins/null-ls-nvim.lua @@ -76,5 +76,7 @@ null_ls.setup({ -- Shells -- Git null_ls.builtins.code_actions.gitsigns, + -- Plugins + require('typescript.extensions.null-ls.code-actions'), }, }) diff --git a/lua/plugins/typescript-nvim.lua b/lua/plugins/typescript-nvim.lua new file mode 100644 index 0000000..ef60f5e --- /dev/null +++ b/lua/plugins/typescript-nvim.lua @@ -0,0 +1,7 @@ +local on_attach = require('plugins.lsp.on_attach') + +require('typescript').setup({ + server = { -- pass options to lspconfig's setup method + on_attach = on_attach, + }, +})