How to set a lexer from a plugin?
-
Previously I used
SCI_SETLEXER
from a plugin so that a scintilla instance would be lexed appropriately.Since that message is gone I need to call
CreateLexer()
and useSCI_SETILEXER
however 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.LanguageCode
is a constant fromenum LangType
in 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. ;-)