Community
    • Login

    Any tips on how to actually process Text Editor text? haha

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    3 Posts 2 Posters 565 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.
    • William AshlandW
      William Ashland
      last edited by William Ashland

      Hello, I am new to creating Notepad++ plugins although I do have some background with C++, HTML, JavaScript, BASIC and a few other languages.

      My goal is to create a Npp plugin which can be ran, which will scan the open document for bits of text which match a certain format. This is to help with my job / help my coworkers in writing software in a language we use at work.

      In the language we use, boolean registers are represented as ‘S’ registers, short for “status” registers. These registers have the format of an ‘S’ followed by one to three numbers. For example, “S7”, “S32”, and “S100” are all good examples of registers we would use this way. Each one represents a boolean status in the program we are working in, corresponding to some certain description / purpose which is held in a separate text file.

      The plugin I am writing will be able to scan the open document in the text editor window, and highlight all S# / S## / S### instances, and the user can mouseOver any one of them and it will populate information about that specific Sxxx register in a tooltip window.

      So far I have been able to load the descriptions of these S registers into an array, such that “S32 - Pump 1 Running Status” would be stored in a string array element, called status[32] for example. I also was able to make a C# program which has the tooltip (in Visual Studio), I just don’t know how to apply this to the actual document in notepad++.

      I just need to figure out the part where the document gets scanned and any instance of ‘S’ followed by numbers will be targeted, and searched against my array to see if an entry exists for that specific element.

      Anyway, if anyone has any good hints / shortcuts as to how I can accomplish the text highlighting / formatting side I would sure appreciate it. I will continue to hunt in the meantime!

      Thanks friends, enjoy the rest of 2019.

      • Will
      EkopalypseE 1 Reply Last reply Reply Quote 2
      • EkopalypseE
        Ekopalypse @William Ashland
        last edited by Ekopalypse

        @William-Ashland

        First of all, this site gives all the needed information when it comes to
        manipulate the text from within npp.

        Now, your plugin could be developed in two ways.

        1st way would be to write a lexer.
        You would chose this one if your current source code highlighting
        doesn’t involve a lexer already.
        Pros: you have full control over what you want to do
        Cons: You need to write everything yourself

        2nd way would be to write a semi-lexer, meaning, you have already
        a lexer but want to enhance this one with additional functionality
        Pros: much less to code
        Cons: You cannot interfere with current lexer but have to workaround it.
        For example, marking text would need to involve indicators as normal
        styling functions are most likely used by the current lexer.

        Here I have posted an example as python script how one might be able to implement the 2nd way.

        Concerning the tooltip functionality I would say listen to scintilla notifications
        like DWELLSTART and DWELLEND could be used to trigger it by using calltips.

        1 Reply Last reply Reply Quote 2
        • EkopalypseE
          Ekopalypse
          last edited by

          Just in case you aren’t aware, here the link how to develop a npp plugin.

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