End being inserted for no good reason

(JohnMoshakis) #1

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

0 Likes

(JohnMoshakis) #2

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);
0 Likes

(marc hoffman) #3

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”

0 Likes

(JohnMoshakis) #4

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

0 Likes

(marc hoffman) #5

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

0 Likes

(JohnMoshakis) #6

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

0 Likes

(marc hoffman) #7

well, the “end” doesn’t match…

0 Likes