Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

298
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda