Feature or Bug: New 'end' inserted after entering new line from end of function definition

When I set the cursor to the end of a function definition and press return

a new ‘end’ is inserted for me

Is this a feature or a bug?


Hey Michael,

It’s a feature.


An unwanted feature :grinning_face_with_smiling_eyes:

Playing around a bit I find that:

If a commented out unmatched parentheses is anywhere above a handler, function, repeat, … which is compiled and the cursor is placed at the end of its said definition and return pressed an extra end is inserted.

An extra end will be inserted doing the above in the following script

  set cat to "meow"

but not in the following

  set cat to "meow"

@alldritt, @ShaneStanley?

It’s an imperfect feature. The problem is that in the cases where it fails, it’s impossible to guess the user’s ultimate intent.

If you find it annoying, it’s easy enough to go to Preferences -> Editor and turn off Auto-close AppleScript blocks.

1 Like

If an open parentheses is in a comment is there any need for it to act on the code below it?

That doesn’t work for me.
Same behavior.