Community
    • Login

    How to set a lexer from a plugin?

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    4 Posts 2 Posters 427 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • dailD
      dail
      last edited by

      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 use SCI_SETILEXER however a plugin can’t call CreateLexer() 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?

      dinkumoilD 1 Reply Last reply Reply Quote 1
      • dinkumoilD
        dinkumoil @dail
        last edited by

        @dail

        You could use NPPM_SETBUFFERLANGTYPE <BufferId> <LanguageCode> to set a lexer for a specific tab. LanguageCode is a constant from enum LangType in file Notepad_plus_msgs.h.

        1 Reply Last reply Reply Quote 1
        • dailD
          dail
          last edited by

          @dinkumoil

          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.

          dinkumoilD 1 Reply Last reply Reply Quote 3
          • dinkumoilD
            dinkumoil @dail
            last edited by

            @dail

            Ah, OK. Now I understand why YOU asked that question. ;-)

            1 Reply Last reply Reply Quote 1
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors