JamesRitchie / language-matlab

MATLAB/Octave language support for Atom
15 stars 9 forks source link

Functions without optional end keyword don't fold #24

Open ndrewtl opened 8 years ago

ndrewtl commented 8 years ago

MATLAB functions are usually denominated by the function keyword and end like so:

function result = fone(arg1,arg2,arg3)
  % code here
  result = return_value;
end

However, the end key is technically optional, so the above could be written:

function result = ftwo(arg1,arg2,arg3)
% code here
result = return_value;

function another_result = fthree(arg1,arg2,arg3)
...

The first example fone() folds fine, but ftwo(), for lack of a defined termination (aside from the beginning of the next function) does not fold.

Usually it's simple to write functions using the end keyword and avoid all this, but in sizable files, especially large, computer-generated ones like those used by GUIDE, adding the end key and cleaning up indentation can be a hassle.

Is there a way you could make functions like this fold properly? I'm on Atom 1.9.7.

Best,

Andrew Lee