#03 VISUAL STUDIO CODE: TAKING ADVANTAGES OF FIND & REPLACE
Visual Studio Code is a modern IDE that is used by developers of many other programming languages apart from AL. We can, and should, learn about this IDE that allows us to take our way of programming to the next level. A cool and powerful tool that is much easier to use in VS Code than it was in C/SIDE is Find and Replace. Using Regular Expressions in Find and Replace, we can now do things that we could only dream of with C/SIDE.
Examples
- Adding missing ApplicationArea to Pages and Page Extensions controls:
- Find: (action|part|systempart|field)(\()((.)*(\s)*(\n)*(\{))[\s]*((?![^{0}]*ApplicationArea[^{0}]*\})[^{0}]*)(\})
- Replace: $1$2$3ApplicationArea = Basic, Suite;$8$9
- Use Regular Expression: Yes
- Files to Include: Your Page and Page Extension project directories.
2. Adding missing DataClassification to Table and Table Extension Fields:
- Find: (field)(\()((.)*(\s)*(\n)*(\{))[\s]*((?![^{0}]*DataClassification[^{0}]*\})[^{0}]*)(\})
- Replace: $1$2$3DataClassification = CustomerContent;$8$9
- Use Regular Expression: Yes
- Files to Include: Your Table and Table Extension project directories.
3. Removing [Scope(Internal)] from procedures:
- Find: [Scope(‘Internal’)]
- Replace: (empty)
4. Switch Report RDLC or WordLayout path:
- Find: (RDLCLayout|WordLayout)( = )(.)*\/
- Replace: $1=’src/Report/Layout/
- Use Regular Expression: Yes
5. Removing ID’s from procedures, parameters and variables when copying from txt file exported from C/SIDE.
- Find: (@(\d+))
- Replace: (empty)
- Use Regular Expression: Yes