From fd4133ff85c1099ab88c289b4fb42b2c8cfbf36c Mon Sep 17 00:00:00 2001 From: Taken Date: Mon, 25 Mar 2024 15:58:32 +0100 Subject: [PATCH] Updated ts-tools to use node modules bin if there Updated neovim project back to main repo --- lua/taken/plugins/lsp/ts-tools.lua | 21 +++++++++++++++------ lua/taken/plugins/sessionmanager.lua | 6 +----- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/lua/taken/plugins/lsp/ts-tools.lua b/lua/taken/plugins/lsp/ts-tools.lua index ce32a9a..dfc98a4 100644 --- a/lua/taken/plugins/lsp/ts-tools.lua +++ b/lua/taken/plugins/lsp/ts-tools.lua @@ -6,12 +6,7 @@ return { "neovim/nvim-lspconfig", "hrsh7th/cmp-nvim-lsp", }, - ft = { - "javascript", - "javascriptreact", - "typescript", - "typescriptreact", - }, + event = { "BufReadPre", "BufNewFile" }, config = function() local typescript_tools = require("typescript-tools") local cmp_nvim_lsp = require("cmp_nvim_lsp") @@ -20,6 +15,16 @@ return { local capabilities = cmp_nvim_lsp.default_capabilities() local augroup = vim.api.nvim_create_augroup("Typescript_tools", {}) + local cwd = vim.fn.getcwd() + local tsserver_path = cwd .. "/node_modules/.bin/tsserver" + + local cmd = "" + if vim.loop.fs_stat(tsserver_path) then + cmd = tsserver_path + else + cmd = "typescript-language-server" + end + typescript_tools.setup({ capabilities = capabilities, on_attach = function(client, bufnr) @@ -32,8 +37,12 @@ return { vim.lsp.buf.format({ async = false }) end, }) + if cmd == "typescript-language-server" then + print("Using global tsserver") + end end, settings = { + cmd = { cmd, "--stdio" }, tsserver_file_preferences = { includeCompletionsForModuleExports = true, quotePreference = "auto", diff --git a/lua/taken/plugins/sessionmanager.lua b/lua/taken/plugins/sessionmanager.lua index ca7c218..ccf46b2 100644 --- a/lua/taken/plugins/sessionmanager.lua +++ b/lua/taken/plugins/sessionmanager.lua @@ -1,10 +1,6 @@ --- @type LazyPluginSpec return { - -- "coffebar/neovim-project", - "TakenMC/neovim-project", - branch = "projetloadcommand", - -- "neovim-project", - -- dir = "~/git/neovim-project", + "coffebar/neovim-project", priority = 100, dependencies = { { "nvim-lua/plenary.nvim" },