<?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[&quot;Dot Notation&quot; Folding]]></title><description><![CDATA[<p dir="auto">I’m trying to get language folding for the below file format…</p>
<pre><code>O
.O
..O1=Value1
..O2=Value2
..O3=Value3
</code></pre>
<p dir="auto">The single dot within .O indicates that “O” is a member of “O”.<br />
The double dot within …O1 (etc.) indicates that “O1” is a member of “O.O”.</p>
<p dir="auto">So effectively there are three objects in the example, as below…</p>
<pre><code>O.O.O1
O.O.O2
O.O.O3
</code></pre>
<p dir="auto">How can I get the code to fold (using a custom language) such that collapsing “O” would hide everything below it until there was another letter without any dots preceding it?</p>
<p dir="auto">If I added “P” and the file became…</p>
<pre><code>O
.O
..O1=Value1
..O2=Value2
..O3=Value3
P
.X=Number1
.Y=Number2
.Z=Number3
</code></pre>
<p dir="auto">…then “collapsing” the first line/“O” should leave me showing…</p>
<pre><code>O (&lt;--- COLLAPSED)
P
.X=Number1
.Y=Number2
.Z=Number3
</code></pre>
<p dir="auto">Thanks if anyone can help with some hints.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/21211/dot-notation-folding</link><generator>RSS for Node</generator><lastBuildDate>Mon, 18 May 2026 18:07:41 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/21211.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 24 May 2021 13:27:38 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to &quot;Dot Notation&quot; Folding on Mon, 24 May 2021 15:04:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/daniel-mcmahon" aria-label="Profile: Daniel-McMahon">@<bdi>Daniel-McMahon</bdi></a> said in <a href="/post/66266">"Dot Notation" Folding</a>:</p>
<blockquote>
<p dir="auto">How can I get the code to fold (using a custom language) such that collapsing “O” would hide everything below it</p>
</blockquote>
<p dir="auto">If <code>O</code> were your only start keyword, then you could define your UserDefinedLanguage with Folding-in-Code-2 with START = <code>O</code> and something else (maybe <code>((A B C D E F G H I J K L M N O P Q R S T U V W X Y Z))</code>) as the close.</p>
<p dir="auto">Actually, using the <code>((A B C D E F G H I J K L M N O P Q R S T U V W X Y Z))</code> list shown for both open and close comes close, but not quite, because it’s seeing each one as a new nested open, rather than a close for the previous one.</p>
<p dir="auto">The User Defined Language feature is great for “simple” languages, where the folding is just pairs of OPEN/CLOSE keywords or symbols (with optional middle for “if-else-endif”-like situations)… but it’s not hard to find yourself straying beyond what it can handle.</p>
<p dir="auto">In theory, you could look at the FAQ section of this Forum, and see the FAQ Desk entry on creating official feature requests … but the UDL system hasn’t had much attention (really, not <em>any</em> attention) for a few years, and nothing is likely to come about from such a feature request, unfortunately.</p>
<p dir="auto">The first options at this point are <a href="https://npp-user-manual.org/docs/plugins/#building-a-lexer-plugin" rel="nofollow ugc">creating your own lexer plugin</a>, which would be able to implement the syntax highlighting and code folding according to whatever rules you want to program.</p>
<p dir="auto">The second option is that the scripting plugins like <a href="https://github.com/bruderstein/PythonScript" rel="nofollow ugc">PythonScript</a> have access to the underlying Scintilla <a href="https://www.scintilla.org/ScintillaDoc.html#Folding" rel="nofollow ugc">folding</a> commands – so you might be able to code up a script that will enable the folding you want; I don’t know if there are examples in the forum, but you could search for “pythonscript fold” or some such and see what you find.  (My guess in PythonScript is that <code>editor.setFoldLevel(line, level)</code> which implements <a href="https://www.scintilla.org/ScintillaDoc.html#SCI_SETFOLDLEVEL" rel="nofollow ugc">scintilla <code>SCI_SETFOLDLEVEL</code> message</a> is where you would start, which would define how many levels deep, and which line is the start of each fold block).</p>
]]></description><link>https://community.notepad-plus-plus.org/post/66267</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/66267</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Mon, 24 May 2021 15:04:46 GMT</pubDate></item></channel></rss>