<?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[add block comments in langs.xml?]]></title><description><![CDATA[<p dir="auto">The default NP++ batch script highlighting correctly identifies two types of comments: <code>REM</code> and <code>::</code>.  However, all of NP++'s commenting shortcuts (CTRL+K, CTRL+Q, and CTRL+SHIFT+Q) work with <code>REM</code>.</p>
<p dir="auto">Based on the content in langs.xml, this makes sense: the section for <strong>Batch</strong> only has a definition for <code>commentLine</code>.  However, the sections for other languages (like <strong>ActionScript</strong>) have additional definitions for <code>commentStart</code> and <code>commentEnd</code>.  Based on simple tests, these seem correspond to the <strong>Block Comment</strong> shortcut.</p>
<p dir="auto">Some of the <code>comment*</code> definitions for other sections are empty (i.e. <code>commentEnd=""</code>), so I would expect that adding <code>commentStart="::" commentEnd=""</code> to the <strong>Batch</strong> section would change its CTRL+SHIFT+Q shortcut to the <code>::</code> comment style.  Unfortunately, this does not seem to work for me when I try it.  Is there another step I’m missing, or am I looking in the wrong place altogether?</p>
<p dir="auto"><strong>note</strong>: I’m sure I could implement this with a UDL, but that seems like an extreme solution.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/22448/add-block-comments-in-langs-xml</link><generator>RSS for Node</generator><lastBuildDate>Sun, 11 Oct 2026 14:08:44 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/22448.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 27 Jan 2022 19:55:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to add block comments in langs.xml? on Thu, 27 Jan 2022 20:29:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mathlete2" aria-label="Profile: mathlete2">@<bdi>mathlete2</bdi></a> ,</p>
<p dir="auto">It’s not working because commentEnd must be non-blank if you want commentStart to work.  If I set it to <code>&lt;Language name="batch" ext="bat cmd nt" commentLine="REM" commentStart="::" commentEnd="::REM"&gt;</code>, save, exit, reload, then load a file in Batch, the Ctrl+Shift+Q will block-mode, where it puts <code>::</code> at the beginning of the current selection and <code>::REM</code> at the end of the current selection; but if I set <code>commentEnd=""</code>, it will instead just use the commentLine for the block-comment commands as well, ignoring both commentStart and commentEnd.  I tried some experiments, and even if you did something as simple as <code>commentEnd=" "</code> (where it uses a single space in the attribute value), it will use <code>::</code> for the beginning and a space for the end.</p>
<p dir="auto">But please note, if you do get it working that way: block comments are meant to allow for multi-line, and abusing cmd.exe’s label syntax (which is <em>actually</em> what <code>::</code> is for) to be a pseudo-comment will not create a multi-line comment in cmd.exe syntax.  It would just put <code>::</code> at the beginning of the selection and whatever non-empty text you chose for the commentEnd at the end.  Which means, if you have more than one line selected, only the first line would be commented out.</p>
<p dir="auto">If you want to use <code>::</code> as your line comment, then you should just change <code>commentLine="::"</code>, and then line-comment will always use that (and block comments will instead apply the line-comment individually to all selected lines).  But you cannot set it up in a way soas to have two different single-line comment syntaxes, as that is not how the comment-feature was designed.</p>
<p dir="auto">(we literally <a href="https://github.com/notepad-plus-plus/npp-usermanual/commit/a4acde8f370a323198c591d488935a41c53efacd" rel="nofollow ugc">just added</a> the text <code>These attributes can only define one type of line and block comments; if your language has multiple types of either, you will have to choose the _one_ type that you'd like Comment/Uncomment to work with.</code> to the user manual: it hasn’t even had time to be released to the website yet.  but it will be in the next revision of the website.)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/73403</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/73403</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Thu, 27 Jan 2022 20:29:20 GMT</pubDate></item></channel></rss>