<?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 to integrate external lexer with NPP?]]></title><description><![CDATA[<p dir="auto">I’ve made an external lexer that performs as expected if I send an SCI_SETLEXER msg to the nppData._scintillaMainHandle to set SCLEX_CONTAINER.</p>
<p dir="auto">I’ve integrated it with the <a href="https://github.com/npp-plugins/plugintemplate" rel="nofollow ugc">standard CPP plugintemplate</a> and exported GetLexerFactory, GetLexerStatusText, GetLexerName &amp; GetLexerCount.</p>
<p dir="auto">How do I now make it appear in NPP Languages menu and Settings -&gt; Style Configurator menu?</p>
<p dir="auto">Thanks.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/19523/how-to-integrate-external-lexer-with-npp</link><generator>RSS for Node</generator><lastBuildDate>Fri, 11 Sep 2026 00:50:45 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/19523.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 06 Jun 2020 17:56:12 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to integrate external lexer with NPP? on Mon, 15 Feb 2021 17:51:33 GMT]]></title><description><![CDATA[<p dir="auto"><a href="https://github.com/notepad-plus-plus/notepad-plus-plus/issues/9516" rel="nofollow ugc">Issue 9516 opened</a></p>
]]></description><link>https://community.notepad-plus-plus.org/post/62911</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/62911</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Mon, 15 Feb 2021 17:51:33 GMT</pubDate></item><item><title><![CDATA[Reply to How to integrate external lexer with NPP? on Mon, 15 Feb 2021 17:33:19 GMT]]></title><description><![CDATA[<p dir="auto">It probably became a bug recently when <em>None (Normal Text)</em> was moved out of the <em>N</em> 's and up to the top.</p>
<p dir="auto">Wasn’t I the one that said that change shouldn’t negatively impact anything (to <a class="plugin-mentions-user plugin-mentions-a" href="/user/guy038" aria-label="Profile: guy038">@<bdi>guy038</bdi></a>)?  :-)</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ekopalypse" aria-label="Profile: Ekopalypse">@<bdi>Ekopalypse</bdi></a> Yea, it seems like you should put a bug report in on it.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/62909</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/62909</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 15 Feb 2021 17:33:19 GMT</pubDate></item><item><title><![CDATA[Reply to How to integrate external lexer with NPP? on Mon, 15 Feb 2021 16:58:42 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/62900">How to integrate external lexer with NPP?</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/moon6969" aria-label="Profile: moon6969">@<bdi>moon6969</bdi></a><br />
I think I have found it. It is a “feature”.<br />
When the name of the lexer comes before the “normal text” lexer, from the alphabetical point of view, it appears before “normal text”, but when it comes after that, it appears below it, but inside the Builtin lexers. Hmm.</p>
</blockquote>
<p dir="auto">I’d recommend pointing that out as a bug.  I don’t know if they’ll fix it, but it should be officially documented.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/62903</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/62903</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Mon, 15 Feb 2021 16:58:42 GMT</pubDate></item><item><title><![CDATA[Reply to How to integrate external lexer with NPP? on Mon, 15 Feb 2021 16:52:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/moon6969" aria-label="Profile: moon6969">@<bdi>moon6969</bdi></a><br />
I think I have found it. It is a “feature”.<br />
When the name of the lexer comes before the “normal text” lexer, from the alphabetical point of view, it appears before “normal text”, but when it comes after that, it appears below it, but inside the Builtin lexers. Hmm.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/62900</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/62900</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Mon, 15 Feb 2021 16:52:17 GMT</pubDate></item><item><title><![CDATA[Reply to How to integrate external lexer with NPP? on Thu, 11 Feb 2021 13:51:29 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/moon6969" aria-label="Profile: moon6969">@<bdi>moon6969</bdi></a> ,</p>
<p dir="auto">how are you, I hope good.<br />
One question, did you follow up on your lexer plugin?<br />
If so, one question, where does your lexer appear in the language menu?</p>
<p dir="auto">What I see so far is that external lexers appear since 7.?? above the builtin lexers.</p>
<p dir="auto"><img src="/assets/uploads/files/1613051404700-7df1548d-3031-4224-a813-5c2ea7b962cb-image.png" alt="7df1548d-3031-4224-a813-5c2ea7b962cb-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Like here the nim lexer.<br />
What is strange is that my VLang lexer does not do this.<br />
I just can’t figure out what I’m missing. Do you have any ideas?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/62733</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/62733</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Thu, 11 Feb 2021 13:51:29 GMT</pubDate></item><item><title><![CDATA[Reply to How to integrate external lexer with NPP? on Sat, 06 Jun 2020 22:29:54 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> Cool! It gave me expected count, but no name - I will investigate further tomorrow.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/54756</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/54756</guid><dc:creator><![CDATA[moon6969]]></dc:creator><pubDate>Sat, 06 Jun 2020 22:29:54 GMT</pubDate></item><item><title><![CDATA[Reply to How to integrate external lexer with NPP? on Sat, 06 Jun 2020 21:25:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/moon6969" aria-label="Profile: moon6969">@<bdi>moon6969</bdi></a></p>
<p dir="auto">I don’t know if you are using PS, probably not but in case you do,<br />
here a little script which would check if your plugin has the exports<br />
and do act correctly.</p>
<pre><code class="language-py">import ctypes
from ctypes import wintypes

external_lexer = ctypes.WinDLL(r'D:\temp\GedcomLexer\GedcomLexer.dll')

GetLexerCount = external_lexer.GetLexerCount
GetLexerName = external_lexer.GetLexerName
GetLexerName.argtypes = [wintypes.UINT, 
                         wintypes.LPCSTR,
                         wintypes.INT]
GetLexerStatusText = external_lexer.GetLexerStatusText
GetLexerStatusText.argtypes = [wintypes.UINT,
                               wintypes.LPCWSTR,
                               wintypes.INT]

GetLexerFactory = external_lexer.GetLexerFactory  # ??

MAX_EXTERNAL_LEXER_NAME_LEN = 16 #+1
MAX_EXTERNAL_LEXER_DESC_LEN = 32 #+1

numLexers = GetLexerCount()
print('Lexers:{}'.format(numLexers))
lexName = ctypes.create_string_buffer(MAX_EXTERNAL_LEXER_NAME_LEN)
lexDesc = ctypes.create_unicode_buffer(MAX_EXTERNAL_LEXER_DESC_LEN)

for x in range(numLexers):
    GetLexerName(x, lexName, MAX_EXTERNAL_LEXER_NAME_LEN)
    print(lexName.value)
    GetLexerStatusText(x, lexDesc, MAX_EXTERNAL_LEXER_DESC_LEN)
    print(lexDesc.value)
</code></pre>
<p dir="auto">Testing with Gedcom lexer returns</p>
<pre><code class="language-z">Lexers:1
GEDCOM
GEDCOM file
</code></pre>
<p dir="auto">and a Npp pop saying that the GedcomLexer.xml is missing.</p>
<p dir="auto"><img src="/assets/uploads/files/1591478546478-a3898e13-d916-4ebe-b276-3855455c5267-image.png" alt="a3898e13-d916-4ebe-b276-3855455c5267-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Not a surprise as I just loaded the dll but did not install the plugin at all.</p>
<p dir="auto">Note, the GetLexerFactory is missing in the script.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/54754</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/54754</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Sat, 06 Jun 2020 21:25:04 GMT</pubDate></item><item><title><![CDATA[Reply to How to integrate external lexer with NPP? on Sat, 06 Jun 2020 20:07:54 GMT]]></title><description><![CDATA[<p dir="auto">Thanks again - will be able to try some more based on highlighted NPP source.</p>
<p dir="auto">The issue is probably my imperfect understanding of C++  - especially exports etc!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/54753</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/54753</guid><dc:creator><![CDATA[moon6969]]></dc:creator><pubDate>Sat, 06 Jun 2020 20:07:54 GMT</pubDate></item><item><title><![CDATA[Reply to How to integrate external lexer with NPP? on Sat, 06 Jun 2020 19:13:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/moon6969" aria-label="Profile: moon6969">@<bdi>moon6969</bdi></a></p>
<p dir="auto">looks like this is added when your plugin is identified<br />
as an lexer plugin. See <a href="https://github.com/notepad-plus-plus/notepad-plus-plus/blob/6b51bb464a559d2654828460af797b406252b0c4/PowerEditor/src/MISC/PluginsManager/PluginsManager.cpp#L184" rel="nofollow ugc">here</a>.</p>
<p dir="auto">Edit: you need to provide an xml file which describes your lexer.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/54752</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/54752</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Sat, 06 Jun 2020 19:13:31 GMT</pubDate></item><item><title><![CDATA[Reply to How to integrate external lexer with NPP? on Sat, 06 Jun 2020 18:56:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/moon6969" aria-label="Profile: moon6969">@<bdi>moon6969</bdi></a></p>
<p dir="auto">looks like I’m wrong, there is a way, npp knows something about <a href="https://github.com/notepad-plus-plus/notepad-plus-plus/blob/905feb8dd830696e43822d3aabcebd355c22dbfa/PowerEditor/src/menuCmdID.h#L519" rel="nofollow ugc">external lexers</a>.</p>
<p dir="auto">Edit: and <a href="https://github.com/notepad-plus-plus/notepad-plus-plus/blob/fa51c2af6e3a162ea4c9b26c9c5422b8fffccb62/PowerEditor/src/Notepad_plus.cpp#L452" rel="nofollow ugc">this</a>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/54751</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/54751</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Sat, 06 Jun 2020 18:56:31 GMT</pubDate></item><item><title><![CDATA[Reply to How to integrate external lexer with NPP? on Sat, 06 Jun 2020 18:44:19 GMT]]></title><description><![CDATA[<p dir="auto">Putting it into the menu isn’t the problem.<br />
I assume it is calling InsertMenu(A/W) at some point and is hooking<br />
the message queue to receive the click event.</p>
<p dir="auto">The problem starts when you want to appear it in the settings dialog and want npp to interact with it.</p>
<p dir="auto">All in all, you can make it work if you start subclassing everything npp offers.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/54750</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/54750</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Sat, 06 Jun 2020 18:44:19 GMT</pubDate></item><item><title><![CDATA[Reply to How to integrate external lexer with NPP? on Sat, 06 Jun 2020 18:25:12 GMT]]></title><description><![CDATA[<p dir="auto">Thanks, but I wonder then how the <a href="https://community.notepad-plus-plus.org/topic/13105/plugin-update-gedcomlexer-v0-3-3-r100">Gedcom plugin</a> lexer manages it!?</p>
<p dir="auto">I’ve been looking through it’s source, but I can’t figure out how it does it yet…<br />
<img src="https://i.imgur.com/HRUx7i9.png" alt="NPP Language menu showing GEDCOM" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/54748</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/54748</guid><dc:creator><![CDATA[moon6969]]></dc:creator><pubDate>Sat, 06 Jun 2020 18:25:12 GMT</pubDate></item><item><title><![CDATA[Reply to How to integrate external lexer with NPP? on Sat, 06 Jun 2020 18:02:29 GMT]]></title><description><![CDATA[<p dir="auto">Afaik only if it would be added within npp source code.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/54747</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/54747</guid><dc:creator><![CDATA[Ekopalypse]]></dc:creator><pubDate>Sat, 06 Jun 2020 18:02:29 GMT</pubDate></item></channel></rss>