AX 2012 - xppSource Exposed: Inserting code snippets
Today, a peer of mine and fellow blogger Palle Agermark wrote a very interesting post, in which he reviews the new ability in AX 2012 X++, in which certain keywords, while coding, can have code snippets added. The purpose is to decrease the amount of typing needed to complete some code block.
His example shows that if switch is entered into the X++ editor and right after, you hit the Tab key, a code block similar to the following screen shot is automatically added for you.
This is pretty handy, and you can see that it places the cursor right to the next point in the code block in which you would want to start completing it. Palle finishes his post off, with the fact that in visual studio, you can add your own, but was not sure how to do this in AX 2012?
Well, let me explain, how this can be done! The secret to this, is contained within a little known AX 2012 class, called: xppSource
Here we see that we have our cases in which xppSource completion through the use of such code snippets is fired, and also, where you could possibly change this, and / or add your own.
For example, lets change the switch method, within the xppSource class, so that we see really easily that we can make use of this. As you can see below, I've added "IDB" to the first case, in the code snippet block.
In saving this, and compiling it, I went back to my previous method, that we see the output from the first screen shot in this post, and performed the switch + tab action. In doing so we now get what you see below.
That's it! For sure the tag line powerfully simple shows in such a neat little find, which shows giving the ability and flexibility of AX 2012, even for developer needs.
I would like to thank Palle Agermark for the challenge and post, as I think other might find this very useful and helpful. Till Next Time!
Labels: AX 2012, Developer, Dynamics AX, Dynamics AX 2012, How to, Microsoft, Spotlight, Tab Complete, Xpp, xppSource
1 Comments:
I've posted a specific example of how to add a template method for "find" on tables.
Check out the Code Snippets article on DAXMusings.
Post a Comment
<< Home