Updated ts-tools to use node modules bin if there

Updated neovim project back to main repo
This commit is contained in:
2024-03-25 15:58:32 +01:00
parent 1fef045f35
commit fd4133ff85
2 changed files with 16 additions and 11 deletions

View File

@@ -6,12 +6,7 @@ return {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
"hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-nvim-lsp",
}, },
ft = { event = { "BufReadPre", "BufNewFile" },
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
},
config = function() config = function()
local typescript_tools = require("typescript-tools") local typescript_tools = require("typescript-tools")
local cmp_nvim_lsp = require("cmp_nvim_lsp") local cmp_nvim_lsp = require("cmp_nvim_lsp")
@@ -20,6 +15,16 @@ return {
local capabilities = cmp_nvim_lsp.default_capabilities() local capabilities = cmp_nvim_lsp.default_capabilities()
local augroup = vim.api.nvim_create_augroup("Typescript_tools", {}) 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({ typescript_tools.setup({
capabilities = capabilities, capabilities = capabilities,
on_attach = function(client, bufnr) on_attach = function(client, bufnr)
@@ -32,8 +37,12 @@ return {
vim.lsp.buf.format({ async = false }) vim.lsp.buf.format({ async = false })
end, end,
}) })
if cmd == "typescript-language-server" then
print("Using global tsserver")
end
end, end,
settings = { settings = {
cmd = { cmd, "--stdio" },
tsserver_file_preferences = { tsserver_file_preferences = {
includeCompletionsForModuleExports = true, includeCompletionsForModuleExports = true,
quotePreference = "auto", quotePreference = "auto",

View File

@@ -1,10 +1,6 @@
--- @type LazyPluginSpec --- @type LazyPluginSpec
return { return {
-- "coffebar/neovim-project", "coffebar/neovim-project",
"TakenMC/neovim-project",
branch = "projetloadcommand",
-- "neovim-project",
-- dir = "~/git/neovim-project",
priority = 100, priority = 100,
dependencies = { dependencies = {
{ "nvim-lua/plenary.nvim" }, { "nvim-lua/plenary.nvim" },