intellij-ts-react-livetemplates
intellij-ts-react-livetemplates copied to clipboard
Feature request: allow prefix of `React.`
Is your feature request related to a problem? Please describe.
I don't like to have to deal with imports at that the top of my file before using these live templates. For example, if I use the live template of usee
, it means I also have to go to the top of my file and update import React from 'react'
to import React, { useEffect } from 'react'
.
Describe the solution you'd like
It'd be nice if I did (e.g.) rusee
that it'd put React.useEffect(() => ...)
. Another nice thing about this is that if I remove the React.useEffect(() => ...)
, I don't have to go remove the { useEffect }
from the import.
Describe alternatives you've considered
Another angle of the solution would be to have options in the plugin. Perhaps a checkbox option that says "Prefix uses where additional imports would otherwise be necessary, such as React.useEffect". If it's checked, then I still type usee
, rather than the suggestion I gave above of rusee
.
The only other solution I can think of for me is to have a linter to add/remove the { useEffect }
as needed from the import automatically. But that requires a second tool.
Additional context I have no additional context. Hopefully it's a straight-forward request.