Welcome to the Learning Center

The Guide | Knowledge Base | FAQ

Browse it all or refine your selection using the filters below on the left.

XMP Snippets for VS Code!

Quickly scaffold or create and edit XMP Forms and Templates in Visual Studio Code with this complete set of snippets for VS Code.

By: Steve Krantzman On: 02/13/2019

Link to this Article
https://dnndev.com/Learn/Guide/Article/XMP-Snippets-for-VS-Code!

 

XMP-Snippets for Visual Studio Code.

Recently, I found myself in the position of needing to create two complete web applications back to back on DNN sites with XMP. Because both time and keystrokes are valuable commodities to coders, I wanted to rely on my code editor of choice – VS Code. Out of that desire was born XMP-Snippets.

 

XMP-Snippets

XMP-Snippets is a free snippet extension for VS Code. It allows you to quickly scaffold your XMP projects, or to fully code your forms and templates. In addition, I added support so that you can create and edit XMP's .ascx files directly.  This has many benefits such as:

  • Edit in Code and preview side by side in your browser.
  • Better versioning control.
  • Ease of backing up your XMP files.
  • IntelliSence style snippets – start typing and hit enter.
  • Multiple Undos.  Even undo past saved points as long as you have not closed the file.
  • Tab to placeholders within inserted code to quickly change properties.
  • Easier troubleshooting/fixing code errors.

Non Power Users

Non Power Users, (those who want to copy and paste from VS Code to the XMP editor), the snippets are broken down into three categories.

  1. xt for XMP template controls
  2. xf for XMP form controls
  3. fx for Form.X controls

non power user snippets

 

Power Users

Power Users, If you open any of the .ascx files created with the built-in editor, in a standalone code editor, you will realize that there is more code under the hood than what you normally see in the built-in editor.  Most of the template controls have runat="server". 3rd party control registration and token processing are also written differently. I have accounted for this with Power User snippets. When working in .ascx files, simply start your snippet with an underscore*.

  1. _xt for XMP template controls
  2. _xf for XMP form controls
  3. _fx for Form.X controls

* WARNING: you should have a solid understanding of working in .ASCX files if you choose to use this method.  If you are going to use this method to edit existing XMP forms, templates, or feeds, take precaution and backup your files first!

 

 Snippet Templates

With some of the included snippet templates, quickly go from a few key strokes to a complete form (in the case below) or template scaffold.  From there you can quickly build out the form or template with the individual form and template control snippets.!

 

How To Get Them

In VS Code under Extensions, search for XMP-Snippets and click on the install button. Alternatively download and install them here: https://marketplace.visualstudio.com/items?itemName=SteveKrantzman.xmp-snippets. If you don't have VS Code and would like to give it a try, you can download it here: https://code.visualstudio.com/

I hope you enjoy using XMod-Snippets, as much as I enjoyed creating them. If you have any ideas to improve XMP-Snippets, or find bugs that need fixing, send me a message with your suggestions

Steve

XMod Pro Snippets