Community
    • Login

    How to set a lexer from a plugin?

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    4 Posts 2 Posters 929 Views 2 Watching
    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 Offline
      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 Offline
        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 Offline
          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 Offline
            dinkumoil @dail
            last edited by

            @dail

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

            1 Reply Last reply Reply Quote 1

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors