<?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[Notepad++ Language List]]></title><description><![CDATA[<p dir="auto">I have a plugin where I need to know the Notepad++ language list.  I see “Notepad_plus_msgs.h” which is part of the template plugin has:</p>
<pre><code>enum LangType {L_TEXT, L_PHP , L_C, L_CPP, L_CS, L_OBJC, L_JAVA, L_RC,\

</code></pre>
<p dir="auto">And that would work if there was some way to get the enum “name” from the LangType array (and then just strip the “L_”).  Other thoughts are to just create an array of strings and (pseudo-code follows):</p>
<pre><code>for i = (0 .. 85) {
    langArray[i] = NPPM_GETLANGUAGENAME (i)
}
</code></pre>
<p dir="auto">But I’m using 85 because I “know” there are 86 elements in the languages enum.  In fact, if I ask NPP for language 86, it replies with “Normal Text” (which is language 0) so a proper while loop returning “i” until <code>NPPM_GETLANGUAGENAME (i)</code> returns a NULL wouldn’t work.  Is there a NppGetNumberOfLanguages() call I’m not familiar with?</p>
<p dir="auto">As you can probably tell, C++ isn’t my “first language” so it’s quite possible I’m missing something obvious.  Currently, I’m just defining my own array of strings and “hardcoding” the <code>enum LangType</code> “names” sans the “L_”.  I was hoping to have something a bit more dynamic like the <code>for</code> loop example above.</p>
<p dir="auto">Cheers.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/19058/notepad-language-list</link><generator>RSS for Node</generator><lastBuildDate>Sat, 16 May 2026 17:31:20 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/19058.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 16 Mar 2020 20:44:18 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Notepad++ Language List on Tue, 17 Mar 2020 17:38:12 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/michael-vincent" aria-label="Profile: Michael-Vincent">@<bdi>Michael-Vincent</bdi></a> said in <a href="/post/51465">Notepad++ Language List</a>:</p>
<blockquote>
<p dir="auto">I may “borrow” that :-)</p>
</blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dinkumoil" aria-label="Profile: dinkumoil">@<bdi>dinkumoil</bdi></a></p>
<p dir="auto">It’s in Pascal!  argh!  I converted your recommendation into C++ (i think):</p>
<pre><code>    TCHAR langName[MAX_PATH];
    lang_menu.clear();
    do
    {
        SendMessage( nppData._nppHandle, NPPM_GETLANGUAGENAME, i, ( LPARAM ) langName );
        lang_menu.push_back( wstrtostr( langName ));
        i++;
    } while ( strcmp( wstrtostr( langName ).c_str(), "External" ) != 0 );
    lang_menu.push_back( "GLOBAL" );
</code></pre>
<p dir="auto">This way no dependence on L_EXTERNAL or the Notepad_plus_msgs.h file.</p>
<p dir="auto">Thanks for taking the time to recommend that!</p>
<p dir="auto">Cheers.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51466</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51466</guid><dc:creator><![CDATA[Michael Vincent]]></dc:creator><pubDate>Tue, 17 Mar 2020 17:38:12 GMT</pubDate></item><item><title><![CDATA[Reply to Notepad++ Language List on Tue, 17 Mar 2020 17:06:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dinkumoil" aria-label="Profile: dinkumoil">@<bdi>dinkumoil</bdi></a> said in <a href="/post/51464">Notepad++ Language List</a>:</p>
<blockquote>
<p dir="auto">I solved the same problem in my AutoCodepage plugin by querying language names in a repeat…until loop, that terminates if the returned language name equals to External</p>
</blockquote>
<p dir="auto">I may “borrow” that :-)</p>
<p dir="auto">Thanks!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51465</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51465</guid><dc:creator><![CDATA[Michael Vincent]]></dc:creator><pubDate>Tue, 17 Mar 2020 17:06:02 GMT</pubDate></item><item><title><![CDATA[Reply to Notepad++ Language List on Tue, 17 Mar 2020 16:41:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/michael-vincent" aria-label="Profile: Michael-Vincent">@<bdi>Michael-Vincent</bdi></a></p>
<p dir="auto">The disadvantage of your method is that you have to update your <em>Notepad_plus_msgs.h</em> file and recompile and redistribute your plugin everytime a new programming language is added to Notepad++.</p>
<p dir="auto">I solved the same problem in my <em>AutoCodepage</em> plugin by querying language names in a <em>repeat…until</em> loop, that terminates if the returned language name equals to <code>External</code>. This way I don’t need to recompile and redistribute my plugin only because of extended programming language support of Notepad++.</p>
<p dir="auto"><strong>Additional hint:</strong> My loop doesn’t process <code>L_USER</code> and <code>L_JS</code>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51464</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51464</guid><dc:creator><![CDATA[dinkumoil]]></dc:creator><pubDate>Tue, 17 Mar 2020 16:41:49 GMT</pubDate></item><item><title><![CDATA[Reply to Notepad++ Language List on Mon, 16 Mar 2020 22:38:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ekopalypse" aria-label="Profile: Ekopalypse">@<bdi>Ekopalypse</bdi></a> said in <a href="/post/51441">Notepad++ Language List</a>:</p>
<blockquote>
<p dir="auto">what about something like this pseudo code</p>
</blockquote>
<p dir="auto">Here is the actual code I used:</p>
<pre><code>vector&lt;string&gt; lang_menu;

std::string wstrtostr( const std::wstring &amp;wstr )
{
    // Convert a Unicode string to an ASCII string



[...]
    lang_menu.clear();
    for ( int i = 0; i &lt;= L_EXTERNAL; i++ )
    {
        TCHAR langName[MAX_PATH];
        SendMessage( nppData._nppHandle, NPPM_GETLANGUAGENAME, i, ( LPARAM ) langName );
        lang_menu.push_back( wstrtostr( langName ));
    }
[...]
</code></pre>
<p dir="auto">Thanks a million!</p>
<p dir="auto">Cheers.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51443</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51443</guid><dc:creator><![CDATA[Michael Vincent]]></dc:creator><pubDate>Mon, 16 Mar 2020 22:38:40 GMT</pubDate></item><item><title><![CDATA[Reply to Notepad++ Language List on Mon, 16 Mar 2020 21:24:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ekopalypse" aria-label="Profile: Ekopalypse">@<bdi>Ekopalypse</bdi></a> said in <a href="/post/51441">Notepad++ Language List</a>:</p>
<blockquote>
<p dir="auto">L_EXTERNAL should be always the last entry in LangType</p>
</blockquote>
<p dir="auto">In fact you’re correct:</p>
<p dir="auto">"Notepad_plus_msgs.h”:</p>
<pre><code>			   // The end of enumated language type, so it should be always at the end
			   L_EXTERNAL};
</code></pre>
<p dir="auto">So your code makes perfect sense and it was something obvious I was missing!  Thanks!</p>
<p dir="auto">SOLVED!</p>
<p dir="auto">Cheers.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51442</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51442</guid><dc:creator><![CDATA[Michael Vincent]]></dc:creator><pubDate>Mon, 16 Mar 2020 21:24:04 GMT</pubDate></item><item><title><![CDATA[Reply to Notepad++ Language List on Mon, 16 Mar 2020 21:04:34 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/michael-vincent" aria-label="Profile: Michael-Vincent">@<bdi>Michael-Vincent</bdi></a></p>
<p dir="auto">what about something like this pseudo code</p>
<pre><code>enum LangType {L_TEXT, L_PHP , L_C, ... L_EXTERNAL};

for ( int i=0; i&lt;LangType.L_EXTERNAL; i++ )
{
   langArray[i] = NPPM_GETLANGUAGENAME (i)
}
</code></pre>
<p dir="auto">L_EXTERNAL should be always the last entry in LangType</p>
]]></description><link>https://community.notepad-plus-plus.org/post/51441</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/51441</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Mon, 16 Mar 2020 21:04:34 GMT</pubDate></item></channel></rss>