All Questions
Tagged with code-snippets regex
50 questions
-1
votes
2
answers
207
views
How to build complex vs code snippet variable transforms?
I'm trying to write a code snippet for vs code that takes a given file name, removes a piece of the name and capitalizes the first letter. For example
Input:
example.model.js
Output:
Example
Output im ...
2
votes
2
answers
355
views
Cannot join two regex into one to produce a code snippet to use in VSCode
I am struggling with regular expressions and how to use them in snippets in VSCode and I could really use some help (I am a beginner in that area).
I have two regexp:
the first one is here to remove ...
1
vote
1
answer
1k
views
Vscode snippet: tranform filename to Capitalize sentence with a regex
I want to tranform filename-with-dashes.md to Filename with dashes in a Vscode snippet
To be precise, I want to populate the field "title" in this snippet, from a filename similar to firt-...
2
votes
2
answers
925
views
Replace and upper case in a snippet with vscode
I'd like to replace Context in myAppContext and upper case on tab pressing, so the end result should be MyApp.
I would rather do it all at once. Here's where I started.:
To remove 'Context' I can do $...
0
votes
2
answers
743
views
VS Code snippet regex for relative path
I'm coding in Elixir/Phoenix Framework using VS Code and trying to transform the following relative path
lib/shop_web/live/product_live/index.ex
into
ShopWeb.Live.ProductLive.Index
using snippets.
...
2
votes
2
answers
556
views
Regex Statement in VSCode snippet for removing file extension
I'd like to create a VS-Code snippet for importing css into a react component. If I'm using the snippet in "MyComponent.tsx", then I'd like the snippet to import the associated css file for ...
0
votes
2
answers
517
views
VS Code Snippets Multiple Transforms on a single variable
Was reading VS Code snippet with multiple transforms and I tried very hard, but was unable to parse how it's being done.
I have a requirement to use ${TM_FILEPATH} and snip out everything preceding a ...
0
votes
0
answers
74
views
Sublime Text 3 : Creating Snippet using simple regex
I tried to create a simple snippet that check if there is a 's' and print me the result
${1:s} ${1/(^s$)/(?1yes:no)/}
When there is only an s it should print me "s yes"
else it should ...
3
votes
3
answers
2k
views
VSCODE snippet PHP to fill namespace automatically
I'm trying to create a VSCODE CODE SNIPPET for PHP that automatically put the namespace (based on folder path).
The idea is make a substitution on the directory of the current document, considering ...
2
votes
1
answer
468
views
Snippets VS Code Regex
I need your help, I am building a snippets, but I need to transform the path of the file which is this:
D:\Project\test\src\EnsLib\File\aaa\bbb
and I need it to be like this:
EnsLib\File\aaa\bbb
...
1
vote
1
answer
650
views
How to use Regex to return a directory from TM_FILEPATH in vscode user snippets?
I am looking for a way to create a user snippet to grab the core directory from a project. Here is the sample path that I am using:
C:dev/Pseudope/Unreal/Cubicle/Source/CubicleCore/Private
When ...
1
vote
1
answer
353
views
vscode snippet transform file name regex
I'm trying to transform file-name.dto.ts to FileName in a snippet.
${TM_FILENAME_BASE/^(.*)([^.*]).*/${1:/pascalcase}$2/}
However, I'm not quite sure how to transform the second capture group or third....
2
votes
1
answer
213
views
Is it possible to add a a variable within a placeholder transform in Visual Studio Code?
I am looking to write an visual studio code user snippet like this:
"Surround With Div": {
"prefix": "sdiv",
"body": ["${1/(.*)/<div class=\&...
3
votes
1
answer
326
views
How to apply more than on transform on visual studio code snippets?
Hopefully you have some experience with visual studio code snippet writing if you have opened this and you can help me.
I am trying to get better at writing visual studio code snippets.
This is one I ...
1
vote
2
answers
295
views
How to use Regex to 'capitalize and replace' in Visual Studio Code's snippets?
I want to create a snippet on Visual Studio Code .
I tried to manually join the Regex but it never worked like my expect:
input:
idss-static-frame.spec
expected result:
IdssStaticFrame
my Regex:
${...