Community
    • Login

    Function List for language with External Lexer

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    2 Posts 1 Posters 2.5k Views 1 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.
    • Stan MitchellS Offline
      Stan Mitchell
      last edited by

      In the past (6.x series npp), I have been able to use the FunctionList feature for a language parsed by the GedcomLexer plugin. This required using the langID=“nn” for the external lexer. At that time it wasn’t possible to associate a parser definition with the language’s file extension - and that appears to still be the case.

      My question is, how does an external lexer plugin determine its langID through the plugin/lexer interface? In general, its value should be L_EXTERNAL plus some offset, but the offset could be affected by loading multiple lexers and if Scintilla adds more languages in the future. The message NPPM_GETBUFFERLANGTYPE seems to do the trick but it requires a BufferID. You would think that the langID would be available somehow to the plugin as a constant.

      1 Reply Last reply Reply Quote 0
      • Stan MitchellS Offline
        Stan Mitchell
        last edited by

        So after digging into this, a solution did materialize. I’ll share it in case someone else may need it some day…

        The message NPPM_GETLANGUAGENAME can be sent to Npp to request the language name string for a value of the LangType enumeration. This enumeration ends with the value L_EXTERNAL which corresponds to the first external lexer. By iterating from L_EXTERNAL to the limit of external lexers (+15), the (non-localized) name of each external lexer is retrieved and compared to the desired lexer’s name - on finding a match the LangType (or langId) is known. If the supplied LangType value exceeds the range of defined lexers, the string “Normal text” is returned as the language name.

        NPPM_GETLANGUAGENAME was added to Npp in version 5.9.3

        1 Reply Last reply Reply Quote 0

        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