Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Display Descriptions of A Selected Keyword

    General Discussion
    3
    3
    85
    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.
    • Long Chang
      Long Chang last edited by

      How can I add a method to show some descriptions when user select a keyword? e.g. when user select keyword “int”, there could be a textbox below shows "Integer -32,768 to 32,767 ".

      PeterJones 1 Reply Last reply Reply Quote 0
      • PeterJones
        PeterJones @Long Chang last edited by

        @Long-Chang ,

        There is no option in native Notepad++ to do this.

        One could write a plugin to do it. Or one could use a scripting plugin, like PythonScript, to do it. But the one who wrote the plugin or script would have to supply all the data (the map of keywords to information about the keyword).

        I don’t know how to make a popup in the scripting languages, and have never written a plugin, so I cannot help you with either of those.

        However, in the past I have shared scripts like this one that change the status bar to show information based on the current selection: you could alias a script similar to that one to the keyboard shortcut of your choice, and have it perform a lookup for keyword=>description, then change the status bar to the description.

        1 Reply Last reply Reply Quote 0
        • Ekopalypse
          Ekopalypse last edited by Ekopalypse

          @Long-Chang said in Display Descriptions of A Selected Keyword:

          Integer -32,768 to 32,767

          Are you looking for something like this

          88b12277-2915-4d05-b1ef-b363d59efce0-image.png

          from Npp import editor, SCINTILLANOTIFICATION, UPDATE
          
          suggestion_dict = {'int': 'Integer -32,768 to 32,767'}
          
          def on_select(args):
              if args['updated'] & UPDATE.SELECTION:
                  x = suggestion_dict.get(editor.getCurrentWord(), None)
                  if x: editor.callTipShow(editor.getCurrentPos(), x)
          
          # editor.clearCallbacks([ SCINTILLANOTIFICATION.UPDATEUI ])
          editor.callbackSync(on_select, [ SCINTILLANOTIFICATION.UPDATEUI ])
          

          Needs the pythonscript plugin to be installed.

          1 Reply Last reply Reply Quote 3
          • First post
            Last post
          Copyright © 2014 NodeBB Forums | Contributors