For… some-odd years now, I have repeatedly mispelled the word "local". The most common mistake for me is "lcoal".
Is there a trick, a tip, a plugin for VSCode that would see a specific word I give it (lcoal) and immediately replace with "local"? I use this as a scope (local.x) constantly in my language of choice.
I don’t want a "bad underline", or syntax throw up, or even an alert. I just want VSCode to replace it immediately. I don’t want to have to search and replace. And this language doesn’t have any kind of pre-processor before running.
Is there anything like that? My Googling and searching extensions didn’t turn up anything useful.
(I think I was able to do this in Sublime before I ever switched to VSCode.) And yes, I should just learn to spell it correctly. I get that. And 99% of the time I do, but that 1% is a killer for me.
3
Answers
Have you tried the Auto correct Extension.
I tried it out and it works for your usecase. The only pain is that you have to setup the words manually in your
settings.json
file if they are not in theuseLargeList
that is deactivated per default.Go to:
File/Code -> Preferences -> Settings -> User:Extensions:Auto Correct Configuration ->
Edit in settings.json
Paste the following configuration or add the
"auto-correct.dictionary"
entry, save and restartNow
lcoal
will be automatically changed tolocal
Navigate to search icon then press
cont + shift + h
then enter search term and replace term.. now you can easily find all occurrence of your word and replace them easilyAnother possibility is the HyperSnips extension. It is fairly easy to set up. Remember to
HyperSnips: Reload Snippets
if you make any changes.You would make a "snippet" like this, in your
<language>.hsnips
file:The
A
at the end makes it "automatic" – you could add the.
to snippet prefix if you wish – so that it is not triggered until you type the.
:This:
automatically replaces
lc
=>local.