|Create Procedure / Publisher / HandlerFunction
||There are code actions to create a missing procedure inside the same object or even of another object. The return type is identified in most cases directly if it's used as a parameter of another procedure call as example. If the procedure name starts with 'On', then you can also create an Integration Event instead (AppSourceCopPrefix could be placed before that 'On'). Furthermore it's possible to create missing handler functions. If you would like to add to the new procedure directly OnBefore or OnAfter publishers or would like to place the procedure at a specific position in the document, then check out the advanced code action. Demos: Create Procedure, Create Publisher Events, Create Handler Functions
|Add Parameter(s) to existing procedure
||If there is an existing procedure with one parameter, but you call that with more variables, then you can now declare these variables as parameters of that existing procedure. Demo
|Create overload of existing procedure
||If there is an existing procedure with one parameter, but you call that with more variables, then you can create an overload of that procedure and you're asked if you directly want to obsolete the old one. Demo
|Add OnBefore/OnAfter Publisher
||You can add OnBefore/OnAfter Publishers to an existing procedure. Then, while creating the publisher, you're able to select the parameters you wish to have inside and go ahead. In addition you can add a return variable on the fly, if you wish. Just "enter" it away, if you don't want to add it. Demo (not in demo-section as this one is a video)
||Select some code and extract it to a new procedure. It checks which local variables and parameters are needed inside the selected text and hands them over as parameter or adds them as local variables. For the moment the parameters are always var-Parameters, but I'm considering to improve it to check if the "var" is necessary. After the new procedure is created you can rename it directly. Before showing this feature in action in the demo section at the end of this file I would like to thank Andrzej for his support. Demo
||With the Modern Action Bar Experience we have more power about how we want to promote our actions, but it is also more time-consuming to promote an action now. This action helps you with it. Demo
|Extract to Label
||If you're inside a method or trigger and there's a string literal you can extract that one directly to a label. In case the label should be locked, then there's also a second code action that does it directly for you. Furthermore there's a config which allows you to explain placeholders if there are any in the text to be extracted. And last but not least: If there are further occurences of the same string literal then you're asked if they should be replaced as well directly. Demo
|Refactor to Validate
||You can refactor a single assignment statement to a validate statement by selecting the '
:=' operator or by selecting the range of the assignment statement. And you can refactor multiple assignment statements to validate statements if all assignments are underneath each other. Demo
|Refactor Option to Enum
||With this you're able to convert an option table field or an option variable to an enum. If it was a table field, the values in the OptionCaption property become the caption of the enum values. If you're working with the extension 'Xliff Sync' or 'AL Language Tools' to maintain your translations in the comments, these translations are considered as well. Demo
|Make variable global
||With this code action you can make your local variable to a global one. The variable is ordered by type correctly. Demo
|References to HandlerFunctions
||The AL language does not provide references or definitions for handler functions yet which is why you can't jump between these with F12 or Shift+F12. This extension fixed it to improve your daily test writing. demo
|References to Built in functions
||If you want to know what gets triggered if you call Customer.Insert() then this feature will guide you to the OnInsert-Trigger of the base table. That's a benefit as such, but from there you can furthermore use the "Find related"-feature explained below, to find related OnBefore-/OnAfterInsert Event Subscribers and all OnBefore-/OnAfter-/OnInsert-Triggers of the TableExtensions you developed. Demo
|Definition to IntegrationEvent
||On developing an EventSubscriber you specify the IntegrationEvent above the procedure declaration. You can now execute the "Go to Definition" on the IntegrationEvent you're subscribing to. It leads to the declaration of that IntegrationEvent. If AL Studio is installed as well, then this definition provider is deactivated, as AL Studio provides the same functionality and Marton and me don't want to provide you two providers.
|Fix Cop Warnings
||This command fixes some warnings. You are asked which one you want to fix with this run.
|- AA0206 (Assigned, but unused variables)
||This fix removes assignments that are safe to delete, e.g.
a := b. Assignments with function calls like
a := myProcedure() won't be deleted as it could change the business logic if something happens inside
|- AA0137 (Remove unused variables)
||This removes all unused local and global variables and return values. Parameters, which are also part of this code cop won't be deleted yet.
|- AA0008 (Missing Parentheses)
||This adds parentheses to all places where they're missing currently.
|Find related (Context menu)
||In the context menu (right-click-menu) on "OnInsert"-TableTriggers there's a new group "Find related". With that you can find related event subscribers, table extension triggers or related calls that are triggering this trigger (Insert(true)). This works currently just in the workspace you've opened. It does not check the symbols yet. Furthermore the Find Calls only work on tableExtension-OnInsert Triggers yet. Modify, Delete and Field-Validate triggers are supported as well. Demo