Reputation: 294
Hello I use latest Sublime Text 4 with Emmet and reactjs source with build in Syntax -> Javasript > JSX
and it work.
I change default emmet setting "jsx_prefix": true,
to false, and it work - now I can expand tags without <
.
But i want change default expand Component/
-> <Component>
to <Component />
I try change "markup_style": "html",
to xhtml or xml but it not work.
And in emmet setting i can see this param, which maybe can solve my problem:
// See `GlobalConfig` interface for supported properties: https://github.com/emmetio/emmet/blob/master/src/config.ts
// Example:
// "config": {
// "markup": {
// "snippets": {
// "foo": "foo.bar>baz"
// },
// "options": {
// "output.selfClosingStyle": "xhtml"
// }
// }
// }
"config": {},
Because I don't know TS, I can't read source in GitHub to solve this, can anyone know how to use this config
param not for one snippet as in example, but for JSX with "output.selfClosingStyle": "xhtml"
?
I try write something like this(but not work):
"config": {
"markup": "jsx",
"options": {
"output.selfClosingStyle": "xhtml"
}
}
Help me to use JSX self closing tags with emmet in ST4 pls.
Upvotes: 1
Views: 234
Reputation: 2691
In Sublime Text, you can specify config either globally for syntax type (markup
or stylesheet
) or for specific syntax.
Syntaxes are listed in syntax_scopes
option of Emmet config, which is a mapping of syntax name to Sublime Text internal scope (you can create your own syntaxes like this as well).
In your case, you should specify config for jsx
syntax, like this:
{
"config": {
"jsx": {
"options": {
"output.selfClosingStyle": "xhtml"
}
}
}
}
Upvotes: 1