Code folding help
-
So Im trying to use code folding. I’m not sure what language I am working with so I am trying to create my own language setting. My open line in the code looks like “Macro XXXXXXX” my end code is just “End”. So my open fold is just “Macro”.
|Macro XXXXXX
|mid
|mid
|EndThe issue I’m having is within the code there is “Attribute End” and “End Object” which is hanging up the end fold. How do I specify my closing fold as just “End” by itself with a new line afterwards?
-
Unfortunately, as far as I know, you cannot do that by itself.
The logic for determining the folding is pretty simple, and cannot handle restricted cases such as that. (It was more designed with simple pairs like
if / endif
in mind, where there is no ambiguity.)However, if you can nest something like
"attribute begin" / "attribute end"
inside, then you could set
OPEN ="attribute begin" macro
CLOSE ="attribute end" end
then this textblah macro attribute begin attribute end end blah
will fold as:
… so theattribute begin / attribute end
is a nested fold inside of the otherBut that requires that anything with “end” in it be able to be added in the list (and the one that’s just-plain-“end” has to be the last version in the list).
-
Thanks Ill take a look at that.
-
So I took a look at the code and it has as an example
Macro XXXXX Begin Object XXX Attributes Beg Attributes End End Object XXX End
So In the folding in code 2 style I have
Macro “Begin Object” “Attributes Beg”In close I have
“End Object” “Attributes End” EndDoes this look right? It seems to work.
-
If it works for you, that’s the important thing. I always keep the pairs in the same order, so I would have said OPEN =
"begin object" "attributes beg" macro
and CLOSE ="end object" "attributes end" end
so that the object-pair were the first tokens in each, the attributes-pair were the second tokens in each, and the macro-pair were the third tokens in each. But that doesn’t seem to be required.