mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-21 20:11:06 +00:00
feat(oxc): added oxc extra for oxfmt and oxlint
This commit is contained in:
parent
9029d928d2
commit
4e9eac57ab
1 changed files with 56 additions and 0 deletions
56
lua/lazyvim/plugins/extras/lang/typescript/oxc.lua
Normal file
56
lua/lazyvim/plugins/extras/lang/typescript/oxc.lua
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
local supported = {
|
||||||
|
"javascript",
|
||||||
|
"javascriptreact",
|
||||||
|
"typescript",
|
||||||
|
"typescriptreact",
|
||||||
|
"json",
|
||||||
|
"jsonc",
|
||||||
|
"vue",
|
||||||
|
"svelte",
|
||||||
|
"astro",
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
recommended = function()
|
||||||
|
return LazyVim.extras.wants({
|
||||||
|
root = {
|
||||||
|
".oxlintrc.json",
|
||||||
|
".oxlintrc.jsonc",
|
||||||
|
"oxlint.config.ts",
|
||||||
|
".oxfmtrc.json",
|
||||||
|
".oxfmtrc.jsonc",
|
||||||
|
"oxfmt.config.ts",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
---@type lspconfig.settings.oxlint
|
||||||
|
oxlint = {},
|
||||||
|
--- disable the oxfmt lsp server since we use conform for formatting
|
||||||
|
oxfmt = { enabled = false },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"mason-org/mason.nvim",
|
||||||
|
opts = { ensure_installed = { "oxfmt" } },
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"stevearc/conform.nvim",
|
||||||
|
optional = true,
|
||||||
|
---@param opts conform.setupOpts
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.formatters_by_ft = opts.formatters_by_ft or {}
|
||||||
|
for _, ft in ipairs(supported) do
|
||||||
|
opts.formatters_by_ft[ft] = opts.formatters_by_ft[ft] or {}
|
||||||
|
table.insert(opts.formatters_by_ft[ft], "oxfmt")
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue