Using FunctionList 220.127.116.11, I'm trying to add a new language to it. So, since it's not possible using the function list parser dialogue, I've modified the xml file. But I don't see my new language appearing in the left column.
Anyone any idea how to add a new language?
Ok, shortly after writing this email, I found out how to do this. Looking at the source code of FunctionList, there's a fixed number of languages defined in the file FunctionList.h. So, you can't add a new language here in a dynamically way…
To add a new language, you have to click the button "User defined language" and add your new language over there. Once the language is "known" (don't forget to also indicate the typical extension!), FunctionList will pick up this one and you can start adding your rules for the language.
The rules you've defined for your new language, will become part of the FunctionListRules.xml, wich is read each time you start NPP.
Hoped to help others with this very same issue…
However… When filling in some parser rules and click the "try" button for the new language, I don't see the scanning indication on top of the Function List box. And nothing happens too…
So, I'm still puzzled how this new language parser is triggered… Hope to get a bit further in due time, but if someone else has gone through the same, pls. share…
I've added a custom language called 'Umajin' (extension .u) using the View->User-Defined Dialogue, and I can see the entry in the listing under Plugins->Function List->Language Parsing Rules but every time I try to add a rule, Notepad++ crashes…
I can add rules by going into the XML file (I have the 'portable' install, so I'm not digging around in %APPDATA%), and they are visible in the list for Umajin, but the parsing on the language doesn't occur.
By contrast, if I overwrite the rules for Python with the rules for Umajin, and then select Language->P->Python, the listing works - but without my highlighting! Does anyone have any ideas?
Thank you for this post geertvc, but your information is somewhat incomplete. I struggled with the same problem with NPP v5.8.2 for hours, until I found the right information when digging through the source code. You are correct in stating that there is a set limit to the number of supported languages. The code uses an enum to determine which language you are using, and as such the language list is not dynamic. When it is loading a user-defined language, therefore, it has to look at the menu to see which language is selected. Here's the code:
if (_langType == L_USER || _langType >= L_EXTERNAL)
HMENU hMenu = (HMENU)::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0);
for (UINT i = 0; i < vMenuInfo.size(); i++)
if (::GetMenuState(hMenu, vMenuInfo[i].id, MF_BYCOMMAND) & MF_CHECKED)
doesLangExist = LangPreferences::GetParseData(parseData, vMenuInfo[i].name);
This would work great except for one thing: it is looking for the menu item to be "checked", which does not seem to be happening in NPP 5.8.2. This means that FunctionList has no way of knowing what language is being used.
The problem is with the compact language menu, so in order to fix it you need to go back to using the default menu. To do this, open Settings > Preferences and click on the "Language Menu/Tab Settings" tab. Uncheck the box labeled "Make language menu compact" and click "Close". When you open the language menu now, you will see the whole list of languages, and the current language should have a dot beside it. This is how FunctionList currently determines the language you are using.