0

I have recently switched from Atom to VScode and is looking for a feature that I am not able to find.

In Atom, if I start writing fore (to start a foreach loop) in a php file it suggests foreach, and hitting enter outputs this:

<?php foreach ($variable as $key => $value): ?>
  
<?php endforeach; ?>

If I write <?php fore and hits enter on the suggestion it outputs me this:

<?php foreach ($variable as $key => $value) {
  // code...
}

In VScode, writing fore only returns the word "foreach" when outputting the suggestion. However if I write <?php fore it suggests a foreach loop and that gives me this output:

<?php foreach ($variable as $key => $value) {
  # code...
} 

Is there any way to obtain the first solution from Atom in VScode core or with an extension?

  • You can do it with custom user snippet: https://stackoverflow.com/questions/29995863/how-to-add-custom-code-snippets-in-vscode – ZecKa Jun 09 '21 at 07:48
  • Okay - I assume that will work - just thought there might be some setting somewhere to make this work for foreach, for, if etc. statements :) – user2969934 Jun 11 '21 at 07:31

0 Answers0