Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>Magento 2 SnippetsNew to Visual Studio Code? Get it now.
Magento 2 Snippets

Magento 2 Snippets

Jerry Lopez

|
28,862 installs
| (0) | Free
A collection of Magento 2 snippets
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Magento 2 Snippets

A nice start to a collection of Magento 2 code snippets for Visual Studio Code!

Table of Contents

Layouts

Instructions
  • Scaffold
  • Block
  • Block Wrap
  • Container
  • Container Wrap
  • Reference Block
  • Reference Container
  • Move
  • Remove
  • Update
  • Arguments
  • Argument
Attributes
  • Translate
  • xsi:type
  • Handle
  • Destination
  • Element
  • htmlId
  • htmlClass
  • htmlTag
  • Output
  • Label
  • As
  • Template
  • Class
  • Name
  • Before
  • After
  • Cacheable
  • Display
  • Remove

Layouts

Instructions

Scaffold

Trigger: m2.layout

Output:

<?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> </body> </page> 

Block

Trigger: m2.layout.block

Output:

<block class="" name="" as="" template="" /> 

Block Wrap

Trigger: m2.layout.blockWrap

Output:

<block class="" name="" as="" template="" /> </block> 

Container

Trigger: m2.layout.container

Output:

<container name="" label="" output="0" htmlTag="" htmlId="" htmlClass="" /> 

Container Wrap

Trigger: m2.layout.containerWrap

Output:

<container name="" label="" output="0" htmlTag="" htmlId="" htmlClass=""> </container> 

Reference Block

Trigger: m2.layout.refBlock

Output:

<referenceBlock name=""> </referenceBlock> 

Reference Container

Trigger: m2.layout.refContainer

Output:

<referenceContainer name=""> </referenceContainer> 

Move

Trigger: m2.layout.move

Output:

<move element="" destination="" /> 

Remove

Trigger: m2.layout.remove

Output:

<remove src="" /> 

Update

Trigger: m2.layout.update

Output:

<update handle=""/> 

Arguments

Trigger: m2.layout.args

Output:

<arguments> </arguments> 

Argument

Trigger: m2.layout.argument

Output:

<argument name="" xsi:type=""></argument> 

Attributes

Translate

Trigger: m2.layout.attr.translate

Output:

translate="" 

xsi:type

Trigger: m2.layout.attr.xsi:type

Output:

xsi:type="" 

Handle

Trigger: m2.layout.attr.handle

Output:

handle="" 

Destination

Trigger: m2.layout.attr.destination

Output:

destination="" 

Element

Trigger: m2.layout.attr.element

Output:

element="" 

htmlId

Trigger: m2.layout.attr.htmlId

Output:

htmlId="" 

htmlClass

Trigger: m2.layout.attr.htmlClass

Output:

htmlClass="" 

htmlTag

Trigger: m2.layout.attr.htmlTag

Output:

htmlTag="" 

Output

Trigger: m2.layout.attr.output

Output:

output="" 

Label

Trigger: m2.layout.attr.label

Output:

label="" 

As

Trigger: m2.layout.attr.as

Output:

as="" 

Template

Trigger: m2.layout.attr.template

Output:

template="" 

Class

Trigger: m2.layout.attr.class

Output:

class="" 

Name

Trigger: m2.layout.attr.name

Output:

name="" 

Before

Trigger: m2.layout.attr.before

Output:

before="" 

After

Trigger: m2.layout.attr.after

Output:

after="" 

Cacheable

Trigger: m2.layout.attr.cacheable

Output:

cacheable="" 

Display

Trigger: m2.layout.attr.display

Output:

display="" 

Remove

Trigger: m2.layout.attr.remove

Output:

remove="" 
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft