-
-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pack): add typescript-tsserver-and-denols pack
- Loading branch information
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
lua/astrocommunity/pack/typescript-tsserver-and-denols/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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` |
41 changes: 41 additions & 0 deletions
41
lua/astrocommunity/pack/typescript-tsserver-and-denols/tsserver-and-denols.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}, | ||
} |