Skip to content

Commit

Permalink
feat(pack): add typescript-tsserver-and-denols pack
Browse files Browse the repository at this point in the history
  • Loading branch information
owittek committed Apr 7, 2023
1 parent ce6c7b9 commit ca102a7
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lua/astrocommunity/pack/typescript-tsserver-and-denols/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# TypeScript Node.js + Deno Language Pack

This plugin pack does the following:

- Adds `typescript`, `javascript`, and `tsx` Treesitter parsers
- Adds `tsserver` language server for projects with a `package.json`
- Adds `denols` language server for projects with a `deno.json`
- Adds `prettierd` formatter for projects with a `prettierrc` file or `package.json`
- Adds [JSON language support](../json)
- Adds [nvim-dap-vscode-js](https://github.com/mxsdev/nvim-dap-vscode-js) for debugging
- Adds [typescript.nvim](https://github.com/jose-elias-alvarez/typescript.nvim) for language specific tooling
- Adds [deno-nvim](https://github.com/sigmasd/deno-nvim) for language specific tooling
- Adds [package-info.nvim](https://github.com/vuki656/package-info.nvim) for project package management
- Handles file imports on rename or move within neo-tree for `tsserver`
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
return {
{ import = "astrocommunity.pack.typescript-tsserver" },
{ import = "astrocommunity.pack.typescript-denols" },
{
"jose-elias-alvarez/typescript.nvim",
opts = function()
local tsserver = require("astronvim.utils.lsp").config "tsserver"
tsserver.root_dir = require("lspconfig.util").root_pattern "package.json"
return { server = tsserver }
end,
},
{
"sigmasd/deno-nvim",
opts = function()
local denols = require("astronvim.utils.lsp").config "denols"
denols.root_dir = require("lspconfig.util").root_pattern("deno.json", "deno.jsonc")
return { server = denols }
end,
},
{
"jay-babu/mason-null-ls.nvim",
config = function(_, opts)
local mason_null_ls = require "mason-null-ls"
local null_ls = require "null-ls"

mason_null_ls.setup(opts)
mason_null_ls.setup_handlers {
prettierd = function()
null_ls.register(null_ls.builtins.formatting.prettierd.with {
condition = function(utils)
return utils.root_has_file "package.json"
or utils.root_has_file ".prettierrc"
or utils.root_has_file ".prettierrc.json"
or utils.root_has_file ".prettierrc.js"
end,
})
end,
}
end,
},
}

0 comments on commit ca102a7

Please sign in to comment.