vscode-snippets

Transform and regex in Code Snippets in VSCode - Docs

…衆ロ難τιáo~ 提交于 2021-02-18 18:42:23
问题 I need list of transormations, like downcase, upcase, capitalize. Where is the list of such? Good documentation. 回答1: The official documentation is snippets grammar. It shows the transforms but only provides one example. The built-in transforms are /upcase or /downcase or /capitalize or /pascalcase /pascalcase was added by a commit on October 2, 2018 but hasn't made it into the documentation (as of June, 2019). It works to do this: some-file-name.js => SomeFileName // or another separator

How to extract a portion of TM_FILENAME_BASE

孤街浪徒 提交于 2021-02-10 14:19:55
问题 I'm trying to write a snippet to quickly/easily generate an interface for a repository. If I name the file IFooRepository I'd like the snippet to place the word Foo in a few areas. I'm assuming this can be achieved by transforming the TM_FILENAME_BASE variable provided out of the box, but am having a hard time figuring it out. 回答1: Figured it out. Man I suck at regular expressions and was thinking about this all wrong ${TM_FILENAME_BASE/I(.*)Repository/$1/} 来源: https://stackoverflow.com

When creating a VSCode snippet, how can I transform a variable to title-case (like TitleCase)?

江枫思渺然 提交于 2021-02-04 17:49:07
问题 https://code.visualstudio.com/docs/editor/userdefinedsnippets#_placeholdertransform My aim is to automatically set the class name within the context of the snippet being inserted. VSCode does not natively support class or method names, but it does support the file name. My file names closely mimic the class name: foo-bar.ts for class FooBar . Here is my current code snippet wherein I can transform "foo-bar" to "Foo-bar" using the native "capitalize" grammar provided by VSCode. TM_FILENAME

Keep $ for Powershell variable in VS code snippet

假装没事ソ 提交于 2020-12-25 18:53:52
问题 I’m able to save my code snippets with tabbed spacing in VS code for Powershell, but it keeps ignoring my variables by not displaying the $ for my variables when I call the snippet. It will just paste in the name and omit the $ . How do you get VS code to paste in the $ when you select your code snippet? Here is the VS Code JSON file I'm using for my "template" snippet { // Place your snippets for powershell here. Each snippet is defined under a snippet name and has a prefix, body and //

Recording a 'macro'? or a series of actions in Visual Studio Code?

与世无争的帅哥 提交于 2020-12-13 18:59:33
问题 I would need something like this. Once I create a folder within a project. A React Project for example. I could select that folder and run some kind of macro or series of actions that would do this. Provided that the name of the folder is Component for example, when the macro would be played it would do this: Create a file with the name, Component.js that would have some kind of snippet default content. Create a file with the name, Component.styled.js which again would have in it some kind of