<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[User Defined language more folding in code styles]]></title><description><![CDATA[<p dir="auto">I have writen a user defined Language highligher using the built in editor<br />
Language &gt; User Defined Language &gt; Define your language</p>
<p dir="auto">how do you do more than two folding code styles and one comment folding style ?</p>
<p dir="auto">My language has at least 3 if, foreach and switch  and has a multiline comment fold style</p>
<p dir="auto">I have tried editing the xml and adding in<br />
&lt;Keywords name=“Folders in code3, open”&gt;Switch:&lt;/Keywords&gt;<br />
&lt;Keywords name=“Folders in code3, middle”&gt;Case:&lt;/Keywords&gt;<br />
&lt;Keywords name=“Folders in code3, close”&gt;EndSwitch:&lt;/Keywords&gt;<br />
but that just gets ignored / removed</p>
<p dir="auto">Additionally how do you add more than one middle ?<br />
e.g.<br />
if / elsif / else / endif<br />
switch / case / default / endswitch</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/24074/user-defined-language-more-folding-in-code-styles</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Apr 2026 21:20:08 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/24074.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 29 Jan 2023 17:36:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to User Defined language more folding in code styles on Wed, 15 Feb 2023 16:47:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/3841">@PeterJones</a> Thank you, just what I was looking for.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/84176</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/84176</guid><dc:creator><![CDATA[denwitham]]></dc:creator><pubDate>Wed, 15 Feb 2023 16:47:31 GMT</pubDate></item><item><title><![CDATA[Reply to User Defined language more folding in code styles on Sun, 29 Jan 2023 21:30:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/27477">@denwitham</a> said in <a href="/post/83713">User Defined language more folding in code styles</a>:</p>
<blockquote>
<p dir="auto">I have tried editing the xml and adding in …</p>
</blockquote>
<p dir="auto">You cannot just add new structures in the UDL XML definition and hope that Notepad++ would just magically understand what you meant.</p>
<blockquote>
<p dir="auto">how do you do more than two folding code styles and one comment folding style</p>
</blockquote>
<p dir="auto">You can mix multiple fold structures of the same type in the same boxes.</p>
<p dir="auto">Folding in Code 1 is meant for things that fold that don’t require spaces surrounding it – so the c-style <code>{</code> … <code>}</code> folding would be a primary use case for FiC1.</p>
<p dir="auto">Folding in Code 2 is meant for things that fold that do require spaces, like words, so that it will fold on “if” but not “gif” or “iffy”.  So <code>if</code> / <code>else elsif</code> / <code>endif</code> would be one such set.</p>
<p dir="auto"><img src="/assets/uploads/files/1675027531507-6dfc8cc0-2e34-4bd5-aa54-04eb58199010-image.png" alt="6dfc8cc0-2e34-4bd5-aa54-04eb58199010-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Folding in Comments is intended as a way to add a prompt inside a comment that will do folding.  for example, <code>=begin</code> and <code>=end</code> as FoldingInComment with comment prefix of <code>#</code>:<br />
<img src="/assets/uploads/files/1675027204439-ed3deb6b-1b44-4947-b268-cf76aa8a02d3-image.png" alt="ed3deb6b-1b44-4947-b268-cf76aa8a02d3-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">With multiple in the same box, like the if and switch constructs, you could technically trick N++ into doing folding on invalid combinations, like <code>if / case / endswitch</code> or <code>switch / else / endif</code> .   So it’s imperfect, but N++ UDL isn’t meant as a code validator, and won’t enforce valid syntax.</p>
<p dir="auto"><img src="/assets/uploads/files/1675027415917-b200eee8-e37c-4562-bb66-b0961c405315-image.png" alt="b200eee8-e37c-4562-bb66-b0961c405315-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">But since most languages require fully nested, most combinations will fold the way you expect:</p>
<p dir="auto"><img src="/assets/uploads/files/1675027641874-a95db7b2-18ec-47b0-86d0-74d016717fc6-image.png" alt="a95db7b2-18ec-47b0-86d0-74d016717fc6-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">You will notice that I earlier had a space between the <code>default</code> and the <code>:</code>, because in FoldingInCode2, spaces are required.  If you moved it over to FoldingInCode1, then you wouldn’t need that space:</p>
<p dir="auto"><img src="/assets/uploads/files/1675026609684-9141e0d3-690a-46fa-b334-fd41b95bd00c-image.png" alt="9141e0d3-690a-46fa-b334-fd41b95bd00c-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/83718</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/83718</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Sun, 29 Jan 2023 21:30:52 GMT</pubDate></item></channel></rss>