How to set a lexer from a plugin?
-
Previously I used
SCI_SETLEXERfrom a plugin so that a scintilla instance would be lexed appropriately.Since that message is gone I need to call
CreateLexer()and useSCI_SETILEXERhowever a plugin can’t callCreateLexer()since it is implemented in SciLexer.dll.Does a new Notepad++ message need to be created to have Notepad++ call
CreateLexer()on behalf of a plugin? Am I missing something? -
You could use
NPPM_SETBUFFERLANGTYPE <BufferId> <LanguageCode>to set a lexer for a specific tab.LanguageCodeis a constant fromenum LangTypein file Notepad_plus_msgs.h. -
I’m using NPPM_CREATESCINTILLAHANDLE to create a couple of instances not managed by Notepad++. E.g. LuaScript has an instance in the console that highlights Lua.
NPPM_SETBUFFERLANGTYPE won’t work in this case.
-
Ah, OK. Now I understand why YOU asked that question. ;-)