astro-nvim/lua/plugins/typescript.lua

91 lines
2.4 KiB
Lua

return {
"AstroNvim/astrocommunity",
{ import = "astrocommunity.pack.json" },
{ import = "astrocommunity.lsp.nvim-lsp-file-operations" },
{
"nvim-treesitter/nvim-treesitter",
optional = true,
opts = function(_, opts)
if opts.ensure_installed ~= "all" then
opts.ensure_installed =
require("astrocore").list_insert_unique(opts.ensure_installed, { "javascript", "typescript", "tsx", "jsdoc" })
end
end,
},
{
"williamboman/mason-lspconfig.nvim",
opts = function(_, opts)
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "tsserver", "eslint" })
end,
},
{
"jay-babu/mason-nvim-dap.nvim",
optional = true,
opts = function(_, opts)
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, { "js" })
end,
},
{
"WhoIsSethDaniel/mason-tool-installer.nvim",
optional = true,
opts = function(_, opts)
opts.ensure_installed = require("astrocore").list_insert_unique(
opts.ensure_installed,
{ "typescript-language-server", "eslint-lsp", "js-debug-adapter" }
)
end,
},
{
"vuki656/package-info.nvim",
dependencies = { "MunifTanjim/nui.nvim" },
opts = {},
event = "BufRead package.json",
},
{
"dmmulroy/tsc.nvim",
cmd = "TSC",
opts = {},
},
{
"mfussenegger/nvim-dap",
optional = true,
config = function()
local dap = require "dap"
dap.adapters["pwa-node"] = {
type = "server",
host = "localhost",
port = "${port}",
executable = {
command = "node",
args = {
require("mason-registry").get_package("js-debug-adapter"):get_install_path()
.. "/js-debug/src/dapDebugServer.js",
"${port}",
},
},
}
local js_config = {
{
type = "pwa-node",
request = "launch",
name = "Launch file",
program = "${file}",
cwd = "${workspaceFolder}",
},
{
type = "pwa-node",
request = "attach",
name = "Attach",
processId = require("dap.utils").pick_process,
cwd = "${workspaceFolder}",
},
}
if not dap.configurations.javascript then
dap.configurations.javascript = js_config
else
require("astrocore").extend_tbl(dap.configurations.javascript, js_config)
end
end,
},
}