<?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[How do I create a custom fold in PowerShell]]></title><description><![CDATA[<p dir="auto">Is there a way to add a custom collapse option for PowerShell function Param() sections in the config file(s) for .psm1 files?</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/26479/how-do-i-create-a-custom-fold-in-powershell</link><generator>RSS for Node</generator><lastBuildDate>Sun, 06 Sep 2026 02:12:11 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/26479.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 19 Dec 2024 18:54:13 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How do I create a custom fold in PowerShell on Sun, 29 Dec 2024 20:55:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> Thanks, I’ll look into that.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98837</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98837</guid><dc:creator><![CDATA[David A. Stewart]]></dc:creator><pubDate>Sun, 29 Dec 2024 20:55:57 GMT</pubDate></item><item><title><![CDATA[Reply to How do I create a custom fold in PowerShell on Sun, 22 Dec 2024 04:04:42 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mpheath" aria-label="Profile: mpheath">@<bdi>mpheath</bdi></a> Thanks, that is what I have been doing so far, but it’s a band-aid, I do appreciate taking the time to respond. I have not dug into the Notepad++ options too much, except where I use them to write scripts.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98700</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98700</guid><dc:creator><![CDATA[David A. Stewart]]></dc:creator><pubDate>Sun, 22 Dec 2024 04:04:42 GMT</pubDate></item><item><title><![CDATA[Reply to How do I create a custom fold in PowerShell on Sun, 22 Dec 2024 03:59:28 GMT]]></title><description><![CDATA[<p dir="auto">@David-A-Stewart You could use <code>#region</code> and <code>#endregion</code> to do explicit folding in Powershell. These are case-sensitive so must be lowercase to be recognized by the Powershell lexer.</p>
<p dir="auto"><a href="https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_functions_advanced_parameters?view=powershell-7.4#valuefromremainingarguments-argument" rel="nofollow ugc">example1</a>  :</p>
<pre><code>function Test-Remainder {
    param(
        [Parameter(Mandatory, Position=0)]
        [string]$Value,

    [Parameter(Position=1, ValueFromRemainingArguments)]
        [string[]]$Remaining
    )

    "Found $($Remaining.Count) elements"

    for ($i = 0; $i -lt $Remaining.Count; $i++) {
        "${i}: $($Remaining[$i])"
    }
}
Test-Remainder first one,two
</code></pre>
<p dir="auto">can be edited to :</p>
<pre><code>function Test-Remainder {
    #region
    param(
        [Parameter(Mandatory, Position=0)]
        [string]$Value,

    [Parameter(Position=1, ValueFromRemainingArguments)]
        [string[]]$Remaining
    )
    #endregion

    "Found $($Remaining.Count) elements"

    for ($i = 0; $i -lt $Remaining.Count; $i++) {
        "${i}: $($Remaining[$i])"
    }
}
Test-Remainder first one,two
</code></pre>
<p dir="auto">There are no other explicit comments in the Powershell lexer like some lexers have, like <code>#{</code> and <code>#}</code> to cause extra folding.</p>
<p dir="auto">The folding options of the Powershell lexer are <code>fold.comment</code>, <code>fold.compact</code> and <code>fold.at.else</code> which can be changed by a scripting plugin. The  <code>fold.comment</code> option does affect the <code>region</code> comment folding and the value set is <code>1</code> to allow comment folding.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98699</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98699</guid><dc:creator><![CDATA[mpheath]]></dc:creator><pubDate>Sun, 22 Dec 2024 03:59:28 GMT</pubDate></item><item><title><![CDATA[Reply to How do I create a custom fold in PowerShell on Sat, 21 Dec 2024 23:18:49 GMT]]></title><description><![CDATA[<p dir="auto">@David-A-Stewart ,</p>
<blockquote>
<p dir="auto">so it sounds like a feature request is my best bet</p>
</blockquote>
<p dir="auto">Notepad++ uses a library called Lexilla to handle the lexing (syntax highlighting and folding and the like), so you’d have to check the <a href="https://github.com/ScintillaOrg/lexilla/issues/" rel="nofollow ugc">Lexilla Issues list</a> and see if such a request already exists, and if not, put it in there; once the feature is in Lexilla, then Notepad++ would have to update to the most recent version of Lexilla for a future release.  Good luck.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98696</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98696</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Sat, 21 Dec 2024 23:18:49 GMT</pubDate></item><item><title><![CDATA[Reply to How do I create a custom fold in PowerShell on Sat, 21 Dec 2024 21:53:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> Thanks, so it sounds like a feature request is my best bet, do you agree?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98693</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98693</guid><dc:creator><![CDATA[David A. Stewart]]></dc:creator><pubDate>Sat, 21 Dec 2024 21:53:40 GMT</pubDate></item><item><title><![CDATA[Reply to How do I create a custom fold in PowerShell on Thu, 19 Dec 2024 19:13:59 GMT]]></title><description><![CDATA[<p dir="auto"><em>moderator note: I re-created your post under a different name; something about the previous title used is triggering a weird forum bug.  Sorry to all the people who see, but cannot read, multiple copies with a similar name.  I will try to clean up the database.</em></p>
<p dir="auto"><em>update: I think I’ve cleaned up the database; sorry for any who were confused by the extra empty/unavailble posts</em></p>
]]></description><link>https://community.notepad-plus-plus.org/post/98663</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98663</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Thu, 19 Dec 2024 19:13:59 GMT</pubDate></item><item><title><![CDATA[Reply to How do I create a custom fold in PowerShell on Thu, 19 Dec 2024 19:13:06 GMT]]></title><description><![CDATA[<p dir="auto">@David-A-Stewart ,</p>
<p dir="auto">In general, where things fold is a function of the underlying lexer (from the Lexilla library that Notepad++ uses), and there isn’t customization available for that.</p>
<p dir="auto">I think you could use one of the scripting plugins like PythonScript to add a custom fold point using a notification-on-change callback, and some of the commands, but I don’t know how stable custom folds are when Notepad++/Lexilla is also trying to control folding.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/98662</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/98662</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Thu, 19 Dec 2024 19:13:06 GMT</pubDate></item></channel></rss>