Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

297
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda