Dev Tip: Mastering Block Selection in OutSystems Service Studio

Efficiently editing and formatting your code is crucial for maintaining readability and ease of maintenance. OutSystems Developer Kean Amper shares a handy trick for performing block selection in OutSystems Service Studio, which can significantly improve your coding workflow.

Why Use Block Selection?

Block selection allows you to highlight and manipulate multiple lines of code simultaneously, making it easier to format and align your code. This feature is especially useful when dealing with complex queries, CSS, and JavaScript, ensuring your code remains neat and organised.

Step-by-Step Guide to Block Selection

  1. Highlighting Code Normally:
    • Typically, you highlight code by clicking and dragging your mouse over the lines you want to select. This works fine for single lines or continuous blocks but can be limiting when you need to adjust multiple lines at once.
  2. Using Block Selection:
    • To perform a block selection, hold down the Alt and Shift keys together.
    • While holding these keys, click and drag your mouse to highlight the specific block of code you want to select.
    • This allows you to select a rectangular area of text, enabling you to highlight multiple lines and columns simultaneously.
  3. Aligning Code Blocks:
    • If your lines of code are misaligned, such as lines 2, 3, 4, 5, and 6, you can use block selection to quickly align them.
    • Hold Alt and Shift, click and drag to select the block, and then press Tab to align all the selected lines.
  4. Applying Block Selection in CSS and JavaScript:
    • This block selection trick is not just limited to queries; it also works in your CSS and JavaScript files.
    • Select the code block using Alt and Shift, and then use Tab or other formatting commands to adjust the block as needed.

Practical Example

Kean demonstrates this technique by first selecting and aligning a block of SQL query code. Initially, the lines are not aligned, but by using block selection and the Tab key, all lines are quickly brought into alignment. He also shows the same method applied to a stylesheet and a JavaScript file, highlighting its versatility across different coding contexts.

Benefits of Block Selection

  • Improved Readability: Ensures your code is neatly formatted and aligned, making it easier to read and maintain.
  • Efficiency: Saves time by allowing you to manipulate multiple lines of code simultaneously.
  • Consistency: Helps maintain consistent code formatting across different sections of your project.

Conclusion

Mastering block selection in OutSystems Service Studio can greatly enhance your coding efficiency and help maintain clean, readable code. This simple yet powerful trick is applicable across queries, CSS, and JavaScript, making it an essential tool in your development toolkit.

Want to learn more valuable Dev Tips?  Sign up for our newsletter and stay updated with the latest insights! Also, don’t forget to check out our upcoming OutSystems courses to scale your career.

A selection from our recent work