Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

296
Views
Is there a way to create a code snippet with an arbitrary prefix? (VScode)

I'm looking to create a VScode snippet that would execute on an arbitrary prefix. I'm not exactly sure if a snippet is the right term for it, but here's what I'm thinking:

myFunction();
// Autofill this block
call(myFunction);
//

myFunctionNamedBob();

// Autofill this block
call(myFunctionNamedBob);
//

Is it possible to insert call(anyFunction) any time I hit enter after anyFunction();?

Thanks in advance.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

the extension Snippet Generator does a good creating snippets, else you can create user snippets by :

  • clicking on cmd+shift+p
  • type snippets
  • select configure user snippets
  • new user snippets and there you go you can create it and it links to the snippet by file name more infos provided in vs code documentation: docs
about 4 years ago · Juan Pablo Isaza Report

0

You can create a vscode snippet to do this but you would have to trigger it manually - it won't happen automatically. In your snippets file:

In your snippets file:

"call function": {
  "prefix": "();",
  "body": [
    "();\ncall(${TM_CURRENT_LINE/\\s*([^(]+)\\(\\);/$1/});"
  ]
}

With this after typing the trailing (); you have to hit Ctrl+Space to bring up the suggestions and select this one. Demo:

call function snippet


You can get automatic triggering with the extension HyperSnips. After installing it and following its setup instructions this "snippet" will do what you want:

snippet `(.*)\(\);` "call function" A
``
rv=m[0]+ '\n' + 'call(' + m[1] + ');'
``
endsnippet

HyperSnips automatic insertion of a snippet

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!