zjffun / vscode-snippets-manager

Create and edit snippets easily.
https://marketplace.visualstudio.com/items?itemName=zjffun.snippetsmanager
MIT License
36 stars 5 forks source link

Fix error with: $ #17

Closed datvq closed 1 year ago

datvq commented 1 year ago

Thank you very much for your excellent extension, it's remarkably useful. However, I encountered a problem when trying to create snippets for code snippets that contain the dollar sign ($), such as ${file} or $$(file). The dollar sign disappears or doesn't appear correctly in the generated code. I would greatly appreciate it if you could fix this. Thanks.

zjffun commented 1 year ago

To fix this, you can add \ before $, for example \${file}. Because $ has special purpose, like tabstops, placeholders or choice. See Grammar - Snippets in Visual Studio Code and Syntax - Snippets in Visual Studio Code. Thank you.

datvq commented 1 year ago

I understand that, but if we do that, the code template in the clipboard and the code input won't match. If there are multiple positions, manual editing won't be appropriate. Instead, I think it would be better if the parser from the snippets manager and the VS Code snippets file handle it implicitly. I apologize for the delayed response.

zjffun commented 1 year ago

I understand that, but if we do that, the code template in the clipboard and the code input won't match. If there are multiple positions, manual editing won't be appropriate. Instead, I think it would be better if the parser from the snippets manager and the VS Code snippets file handle it implicitly. I apologize for the delayed response.

Yes, this is more convenient. We added escape snippet body by default when create snippets from selection, and it's available in v0.2.0 🎉.

datvq commented 1 year ago

Thank you, welcome v0.2.0 🎉