Display Descriptions of A Selected Keyword

  • 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 ".

  • @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.

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

    Integer -32,768 to 32,767

    Are you looking for something like this


    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.

Log in to reply