zachgawlik / vscode-convert-object-to-jsx Goto Github PK
View Code? Open in Web Editor NEWVS Code extension to convert between object entries and jsx props
License: MIT License
VS Code extension to convert between object entries and jsx props
License: MIT License
The extension unfortunately has issues with regex parsing tabs for checking consistent indentation. Pretty much everything I tried failed, but if you'd like a simple case, this will cause an error.
status: STATUS.SUCCESS
I was looking for an extension that converts jsx props to object (e.g. when hoisting props into useMemo or a callback or factory function).
Doesn't seem to be one out there, perhaps you'd want to upgrade this one to do both?
Thanks for the great tool!
I noticed that when making multiple selections of jsx props in different components, the tool only converts the first selection. It would save so much time and effort if it could convert all selections at once.
Hey @ZachGawlik I'm excited to use your extension, but for some reason it isn't working. Here is a video of what's happening when I'm trying to convert the following jsx props:
toggleOrButton = (
<EnhancedSwitch
data-test={type}
didMount={() => {
hook && hook(!!(that.state || {})[type]);
}}
checked={(that.state || {})[type]}
label={label ? <span>{label}</span> : type}
style={{ margin: "0px 30px", marginTop: 4 }}
onChange={() => {
hook && hook(!(that.state || {})[type]);
that.setState({
[type]: !(that.state || {})[type]
});
}}
/>
);
It looks like the string is coming into your extension correctly:
But the getProps
function isn't breaking it up into props correctly:
All the props are on a single line of the array!
Let me know if I can you need more info from me or if you're able to reproduce with the snippet I sent you. Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.