New UserDefinedLang - code fold must begin at margin
-
NPP version: 7.7.1
UDL ver 2.1.0.12I am creating a user-defined-language and am having trouble with the code-folding definitions. Most of the UDL is working great, but it would be great to get the subroutines folding, since I have over a hundred of them.
In this language, subroutines are defined as in this example:
:MySubTitle
code line here
code line here
code line here
ReturnI wish to fold between the : and the word Return (the subroutine’s title could be any string of chars). Problem: the concat character is also a colon (:) – and these can be found anywhere in the code. Also, the word Return could be found at other places within a subroutine. If either of these cases is true, the code folding goes completely bonkers – for example if a colon ( : ) character is encountered anywhere inside a subroutine (and since the colon is the concat character, this happens a lot). So basically, I cannot code fold the subroutines – see the screenshot at end of this message).
In this language, note that subroutine :Label / Return are always at the left margin (or indented one tab). In fact, it would be just fine if code-folding required the subroutine start/end to be found at the beginning of the line (not indented at all).
So, is it possible to tell NPP that the code-fold triggers are ONLY valid if found at the beginning of the line (or after some whitespace) ? If not, can this be made into a feature request? Note that I do not have a “Prefix Mode” checkbox anywhere in the “Folding in code N style” groups (“Folder & Default” tab) - see below screenshot.
Again, my version info is:
NPP version: 7.7.1
UDL ver 2.1.0.12
—
moderator fixed the image link so the image was embedded -
@gibberishbc said in New UserDefinedLang - code fold must begin at margin:
:MySubTitle
code line here
code line here
code line here
ReturnAfaik, jein, you can, if this is possible on your side, create multiple opens,
to be exact - for each letter an open folder tag like :A :B :C … and fake the
return statement with an added comment tag. This might work.To address feature requests, see here.
-
@Ekopalypse
Thanks - good suggestion.I don’t understand the closing suggestion, though. What do you mean “fake the
return statement with an added comment tag” ? What would that look like, or can you link me to another post that explains?Many thx !
PS - This question was created/posted yesterday, but I see it is timestamped Oct 7, 2019. Any idea what might have happened? ALSO, I responded (and am now editing) using the Brave browser - and it is working correctly (I see the SUBMIT button so it should save correctly). Ignore my comment from yesterday on my other post (will update)
-
This is indeed an older thread, your recent threads are others.
As for the fake return statement, assuming a language doesn’t have start and end tokens like
if
andendif
but does have comments, which is the case in most programming languages, you could use the start tokenif
and a end token like#endif
, where#
is actually a comment.
This way, the language itself is still happy when it is executed, and npp (or UDL) knows where to break.