akcodeworks / react-emmet Goto Github PK
View Code? Open in Web Editor NEWGives you the ability to create React hooks with dot notation.
License: Other
Gives you the ability to create React hooks with dot notation.
License: Other
useState
and useEffect
SnippetsWhen generating snippets for useState
and useEffect
using the Actual React Emmet extension, it would significantly enhance the developer experience if the cursor were automatically positioned within the snippet's editable area. Specifically, for useState
, the cursor should be inside the parentheses to quickly set the initial value. For useEffect
, it should be inside the code block to immediately write the effect's logic.
useState
snippet (e.g., usestate.counter
), the cursor should be placed inside the parentheses of useState()
, allowing the user to immediately type the initial state value.useEffect
snippets, including both synchronous and asynchronous (e.g., useeffect.loadData
or useeffect.loadData.async
), the cursor should be placed inside the effect's function body, ready for the developer to start typing the logic.This feature request aims to streamline the coding workflow, reducing the need for additional keystrokes or mouse clicks to navigate to the correct position in the snippet. It aligns with the goal of the Actual React Emmet extension to enhance productivity and ease of use.
PS I know I am opening an issue on my own codebase...i just don't want to forget about this.
## Description
This is a follow-up for #3. Emmet supports different kinds of Nesting operators. It would be a match made in heaven to have this supported in this vs code extension as well!
fc.MyComponent>useState.firstName
would produce:
const MyComponent = () => {
const [firstName, setFirstName] = useState();
return (
<></>
);
}
fc.MyComponent>useState.firstName+useState.lastName
would produce:
const MyComponent = () => {
const [firstName, setFirstName] = useState();
const [lastName, setLastName] = useState();
return (
<></>
);
}
fc.MyComponent>useState.firstName^fc.AnotherComponent
would produce:
const MyComponent = () => {
const [firstName, setFirstName] = useState();
return (
<></>
);
}
const AnotherComponent = () => {
return (
<></>
);
}
## Description
I'd like to have a snippet where I can generate functional/class components.
cc.<ComponentName>[props]
Should generate the following structure:
In JS:
class <ComponentName> extends React.Component {
render() {
return null;
}
}
In TS:
type <ComponentName>Props = {
[...props]
}
class <ComponentName> extends React.Component<<ComponentName>Props> {
render() {
return null;
}
}
fc.<ComponentName>[props]
Should generate the following structure:
In JS:
const <ComponentName> = ({ [...props] }) => {
return null;
}
In TS:
type <ComponentName>Props = {
[...props]
}
const <ComponentName> = ({ [...props] }: <ComponentName>Props) => {
return null;
}
"actual-react-emmet.componentStyle": 'function' | 'const'
Whether the component should be written using const
or function
, e.g.
// using `function` as option
function MyComponent() {}
// using `const` as option
const MyComponent = () => {}
"actual-react-emmet.componentPropsStyle": 'interface' | 'type' | 'inline'
Whether it should use an interface
or type
for the component props, e.g.
// using `interface` as option
interface MyComponentProps { ... }
function MyComponent({...}: MyComponentProps) {}
// using `type` as option
type MyComponentProps = { ... }
const MyComponent = ({...}: MyComponentProps) => {}
// using `inline` as option
function MyComponent({ name }: {name: string}) {}
// Command
fc.MyComponent[name]
// Result
const <ComponentName> = ({ name }) => {
return null;
}
// Command
fc.Person[name: string; id: number; address?: { zip: number; street: string }]
// Result
type PersonProps = {
name: string;
id: number;
address?: {
zip: number;
street: string;
}
}
const Person = ({ name: string; id: number; address }): PersonProps) => {
return null;
}
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.