Attribute incorrectly added for opening JSX tag
ericsj opened this issue · 6 comments
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version: 1.63.0
- OS Version: Ubuntu 20.04.1
Steps to Reproduce:
- Create a functional React component
- Inside the element's return create a React Fragment
- Inside the fragment's scope type "<" and start typing a html element name until intellisense suggests some. Type tab or enter. Instead of "button" for example, it will place "button={}"
@armanio123 @RyanCavanaugh This looks like a potential candidate for the TS recovery build. Even when you set "javascript.preferences.jsxAttributeCompletionStyle": "none"
, the =
still ends up being inserted
@mjbvz good catch, this is annoying as heck
namespace JSX {
export interface IntrinsicElements {
button: any;
div: any;
}
}
function fn() {
return <>
<butto
</>;
}
Bring up completion and tab-complete at butto
, the new text is
<button={}
when it should be (as was in 4.4)
<button
Even when you set "javascript.preferences.jsxAttributeCompletionStyle": "none", the = still ends up being inserted
I can't reproduce that bit; are you in a tsx
, which instead works on "typescript.preferences.jsxAttributeCompletionStyle"
(note the "typescript")? The new snippet code does check the preference explicitly.
In any case, I've sent #47096; what was happening was that in this broken AST, it looks like an attribute, when in fact it's the tag name. 4.4 didn't have JSX attribute snippets, so never had to care about this detail.
Thanks for taking a look @jakebailey! The VS Code recovery build will go our Tuesday. Would it be possible to get this into a published TS 4.5.4 by then?
Yes, I think we can do a cherry-pick/build.