burkeholland / simple-react-snippets

Simple React Snippets for VS Code that you will actually use
206 stars 84 forks source link

Snippets work sporadically. #84

Open SaifuddinSaifee opened 1 year ago

SaifuddinSaifee commented 1 year ago

Hey folks! I m still facing this issue where I can't see the snippent. I m currently on version 1.2.7 image

But if I declare a variable of any kind, it works just fine, but it becomes quite pointless at that moment: image

Here's a clip that can explain this to you better: Simple React Snippets_Issue

Here are my file associations from my user settings: image

Thanks!

juanjavier1001 commented 1 year ago

@SaifuddinSaifee the same happens to me

gordianbahri commented 1 year ago

@SaifuddinSaifee @juanjavier1001 and to me.

martialarturo commented 1 year ago

I also am experiencing this issue.

emersoncavalcanti1972 commented 1 year ago

I believe it is related to the change "JavaScript React language label is now JavaScript JSX". The JavaScript React language mode has been renamed to JavaScript JSX to reflect that JSX syntax is used by more than just React. TypeScript React has also been renamed to TypeScript JSX.

From what I see in the images, it works when the file has the .js extension and stops working with files with the .jsx extension. Please @SaifuddinSaifee confirm us

SaifuddinSaifee commented 1 year ago

Hey folks, this may sound a bit weird, but ever since I posted this issue on GitHub, the snippets are now working perfectly fine, and surprisingly they work for both .js as well as for .jsx. But I'd like you to know that I haven't changed any of the settings (as of now). But from my previous tests, I can confirm that when the snippets decide not to work, they neither work for .js file nor for .jsx file. As I said it's sporadic, it's completely unpredictable when this issue appears again.

SaifuddinSaifee commented 1 year ago

Until we actually come up with a solution, I have found a workaround. It's a VS Code key-binding settings, that helps you trigger an entire album of snippets. and it's super simple and safe.

ezgif com-video-to-gif

Steps taken in the above video:

  1. Press Ctrl+k+s: This will open up the Key bindings settings
  2. Search for showSnippets in the top search bar, you should see a command as editor.action.showSnippets
  3. Click on the edit button (pencil icon).
  4. Set the key binding (I've set shift+k)

And Voila! now you can trigger snippets whenever and wherever you want, here you'll find every snippet that exists in your environment. All you have to do is now search for that snippet and hit enter. Do let me know if this works for you, or if you encounter any problem.

gordianbahri commented 1 year ago

@SaifuddinSaifee works for me for now, thanks! I can confirm that it either works or doesn't work at all, no matter if .js or .jsx.

SaifuddinSaifee commented 1 year ago

@Dotolox, I am glad it works for you now!