SolidJS JSX support
SolidJS uses class instead of className.
Preact can also be configured to use class instead of className. It would be nice if this could be configured.
I'll check this week
Doesn't this fix the issue?
require("lvim.lsp.manager").setup("emmet_ls", {
filetypes = {
"astro",
"css",
"eruby",
"html",
"javascriptreact",
"less",
"sass",
"scss",
"svelte",
"typescriptreact",
"vue",
},
init_options = {
jsx = {
options = {
["markup.attributes"] = { className = "class" },
},
},
},
})
This should convert className attributes to class and it should work with jsx/tsx files.
Forgot to note on this. As @olrtg commented, it is possible with init_options.
Here's another example with mason
require("mason-lspconfig").setup_handlers({
function(server_name) -- default handler (optional)
lspconfig[server_name].setup()
end,
["emmet_ls"] = function()
lspconfig.emmet_ls.setup {
init_options = {
jsx = {
options = {
["markup.attributes"] = { className = "class" },
},
},
}
}
end,
})
Problem is that as solidjs file extension is just 'tsx', 'jsx'. It requires some custom additional logics that can detect that it is solidjs project.
I'm not sure how it should be implemented.
- check package.json to see if it's solidjs project?
- introduce new configuration file like
.emmet-ls.json?
I'm not professional frontend developer. Is there any good example to follow?
Thanks for the comment by the way @olrtg .
@aca I like the first option far better. I think that maybe we can check in the package.json for a solidjs dependency. Is kind of hard anyway to ensure that's always the case because you can have an Astro project using react and solidjs a the same time and now solidjs takes precedence (but it's kind of a edge case).
AFAIK vscode doesn't handle this for you.. so I wonder if we should just let this up to the user.