My IDE is nvim im using nvchad nvim as the config file. in that when i save my .jsx file it doesn't auto indent the code. but in mean time there are .js files where auto indenting is happening.
Now it is no time for me to convert to ts or js can anyone help me
My jsx code
import React from "react";
import { getRoles } from "../../../utils/api";
import { Box } from "@mui/material";
const AdminRoles = () => {
console.log('test');
React.useEffect(() => {
(async() => {
console.log('test2');
const response = await getRoles();
console.log('response ', response)
})()
}, []);
return <Box
sx={{
display: 'flex',
flexWrap: 'wrap',
'& > :not(style)': {
m: 1,
width: 128,
height: 128,
},
}}>AdminRoles</Box>;
};
export default AdminRoles;
My plugins.lua file
local overrides = require "custom.configs.overrides"
---@type NvPluginSpec[]
local plugins = {
-- Override plugin definition options
{
"neovim/nvim-lspconfig",
-- dependencies = {
-- -- format & linting
-- {
-- "jose-elias-alvarez/null-ls.nvim",
-- config = function()
-- require "custom.configs.null-ls"
-- end,
-- },
-- },
config = function()
require "plugins.configs.lspconfig"
require "custom.configs.lspconfig"
end, -- Override to setup mason-lspconfig
},
-- override plugin configs
{
"williamboman/mason.nvim",
opts = overrides.mason,
},
{
"nvim-treesitter/nvim-treesitter",
opts = overrides.treesitter,
},
{
"nvim-tree/nvim-tree.lua",
opts = overrides.nvimtree,
},
-- Install a plugin
{
"max397574/better-escape.nvim",
event = "InsertEnter",
config = function()
require("better_escape").setup()
end,
},
{
"rcarriga/nvim-dap-ui",
event = "VeryLazy",
dependencies = "mfussenegger/nvim-dap",
config = function()
local dap = require("dap")
local dapui = require("dapui")
require("dapui").setup()
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end
end
},
{
"mfussenegger/nvim-dap",
config = function()
require "custom.configs.dap"
require("core.utils").load_mappings("dap")
end
},
{
"mhartington/formatter.nvim",
event = "VeryLazy",
opts = function()
return require "custom.configs.formatter"
end
},
{
"mfussenegger/nvim-lint",
event = "VeryLazy",
config = function()
require "custom.configs.lint"
end
},
{
"maxmellon/vim-jsx-pretty"
}
-- To make a plugin not be loaded
-- {
-- "NvChad/nvim-colorizer.lua",
-- enabled = false
-- },
-- All NvChad plugins are lazy-loaded by default
-- For a plugin to be loaded, you will need to set either `ft`, `cmd`, `keys`, `event`, or set `lazy = false`
-- If you want a plugin to load on startup, add `lazy = false` to a plugin spec, for example
-- {
-- "mg979/vim-visual-multi",
-- lazy = false,
-- }
}
return plugins
Mason languageservers
M.mason = {
ensure_installed = {
-- lua stuff
"lua-language-server",
"eslint-lsp",
"stylua",
-- web dev stuffs
"css-lsp",
"html-lsp",
"typescript-language-server",
"deno",
"prettier",
-- c/cpp stuff
"clangd",
"clang-format",
"js-debug-adapter",
"javascriptreact",
},
}
any help why?
founded the solution need to update formatter.lua like below