react-hooks-snippets
react-hooks-snippets copied to clipboard
useState hook snippet doesn't properly capitalize when a specific vscode setting is turned off
Intro/Summary:
Hey so if you have a certain vscode setting turned off, and you try to use the use state hook snippet ('ush'), the 'setMyValue' part does not get properly capitalized. Case A and B here show the problem. Case C shows a workaround that will allow it to work. Sorry for the slow gifs. :(
Bug report:
Usually, when typing in a snippet, the autocomplete suggestions will be turned off by default (I assume this is because they can conflict). But I have autocomplete suggestions turned on while typing in a snippet because of convenience and in order to protect myself from spelling mistakes. This is my setting. You'll need to have it set to false like me to reproduce this error:
/* By default, this is true, which will mean that Intellisense / quick / dropdown suggestions
will not be triggered inside of a snippet. true here prevents the dropdown suggestions
from showing.
Note that having this setting be false will enable suggestions, which'll mean that
pressing tab will autocomplete the suggestion instead of moving to the next snippet
place. */
"editor.suggest.snippetsPreventQuickSuggestions": false,
Cases
Case A (not working) => Here I type out 'wordC' and then press the tab key (so that the word autocompletes). Then I press tab again to move the cursor to the useState argument. I then type the value and then keep pressing tab until the snippet is exited. Result: Not working. The w in word isn't capitalized.

Case B (not working) => Here I type out the entire word 'wordCount' and then press the tab key, which will autocomplete the word (it's pointless though because I already typed the entire word out and I'm just doing this to show the error still happens here). Then I press tab again to move the cursor to the useState argument. I then type the value and then keep pressing tab until the snippet is exited. Result: Not working. The w in word isn't capitalized.

Case C (working) => Here I type out the entire word 'wordCount' and then I press the escape key so that the autocomplete suggestions can go away. Then I press tab. And because I pressed the escape key earlier, the cursor will move to the useState argument (instead of autocompleting the word like in the other cases). I then type the value and then keep pressing tab until the snippet is exited. Result: Working. The w in word is capitalized. It works but the problem is that remembering to press the escape key is annoying. 😢

Hey @jaquinocode thanks for taking your time with this bug report.
I'm not sure of a solution off the top of my head.
I hope to have some time to work on the extension rewrite this weekend, so I will keep this issue in mind while I do!
Yeah no problem!
On Fri, Nov 5, 2021 at 9:15 AM Al Duncanson @.***> wrote:
Hey @jaquinocode https://github.com/jaquinocode thanks for taking your time with this bug report.
I'm not sure of a solution off the top of my head.
I hope to have some time to work on the extension rewrite this weekend, so I will keep this issue in mind while I do!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/alDuncanson/react-hooks-snippets/issues/17#issuecomment-962028357, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGXXPQYLOYIHP5KZ2RMKXLTUKQGMXANCNFSM5HNESLWA .