|
Script Debugger provides features that help you enter, view, and select pairs of delimiters. Such delimiters are opening and closing double-quotes, parentheses, square brackets, and curly braces (and, much rarer, chevrons). Delimiter Entry (Auto-Pairing)Auto-pairing is a text entry feature where, when you type the first of a pair of delimiters, Script Debugger automatically enters the second of the pair for you. Auto-pairing is turned on through an Editor preference:
To test auto-pairing, make a new script and type a quotation mark. A second quotation mark is created for you, and the insertion point is positioned between them, ready for you to type the contents of a literal string. Auto-pairing is intelligent. When you have finished typing the contents of the string, so that your insertion point is positioned up against the closing quotation mark, like this…
…try typing a quotation mark. Script Debugger does not enter a new closing quotation mark; it understands that the closing quotation mark you are typing is the one that already exists, and it behaves as if you had just typed that quotation mark, moving the insertion point beyond it. Another convenient feature of auto-pairing is its behavior when text is selected. Normally, if text is selected and you type a key, the character entered by that key replaces the selected text. But if auto-pairing is turned on, then if text is selected and you type an opening delimiter, the opening and closing delimiters surround the selected text. Thus, for example, if
Delimiter Checking As You TypeWith this feature (independent of auto-pairing), when you type a right (closing) delimiter, Script Debugger looks backwards to make sure that it matches a corresponding left (opening) delimiter. If so, Script Debugger highlights the earlier delimiter momentarily. If not, Script Debugger beeps. This feature is turned on through an Editor preference:
Delimiter Selection (Balance)To select everything within a pair of delimiters, click or select anywhere between the delimiters and choose Edit > Balance. An Editor preference determines whether the delimiters themselves will be included in the selection:
The Balance command also considers a comment to be delimited thing. Thus, if you choose Edit > Balance when the selection is within a single-line or multi-line comment, the entire comment will be selected. This is actually the same feature used for block selection. If you choose Edit > Balance repeatedly, Script Debugger will select everything within delimiters, then everything within any delimiters surrounding those, and so on; then it selects the containing AppleScript code block, then the block containing that, and so on.
|
|||||||||||||||||