End being inserted for no good reason

Hi,

I have this piece of code

property frameOfPresentedViewInContainerView: CGRect read begin
    exit CGRectMake(0,self.containerView.bounds.size.height/2,containerView.bounds.size.width, containerView.bounds.size.height/2);
  end;  override;

And if I put my cursor at the end of read begin and press enter I get this

property frameOfPresentedViewInContainerView: CGRect read begin
  
end;
    exit CGRectMake(0,self.containerView.bounds.size.height/2,containerView.bounds.size.width, containerView.bounds.size.height/2);
  end;  override;

Cheers,
John

There is also this one, Im not if its the same

  navigationController.presentViewController(controller) animated(true) completion(method begin        
    end);

enter after begin and I get

  navigationController.presentViewController(controller) animated(true) completion(method begin
    
  end;
    
    end);

well, the end that’s there doesn’t match, so it inserts a new one. smart-end isn’t super smart. it just goes by indentation. it skips all code that’s indented as that’s assumed to be part of the body. when it finds the dots line that matches in indent, it checks if the present keyword is valid (eg end, or require, for a method begin), else adds “end”. if it finds a line that’s indented less, instead, it also adds the “end”

It will get smarter ? Its pretty annoying at the moment.

Not anytime soon; it will rely on properly formatted code.

It looked property formatted to me :slight_smile: I’ll have a look later to see how I need to change it

well, the “end” doesn’t match…