Prevent autocomplete for some file extensions



  • I’m using np++ to edit grading files for a class I TA for. I would like to avoid having autocomplete active for these files. Is there a way to accomplish that currently?



  • Hello Ben-Frey,

    natively, no. What could be done is using a python script.
    But this is a bit of a hack as this script would set all chars
    you define as a stop char. But this means also you need to install
    the python script plugin. Instructions how to setup are here.

    The script would look like this

    import os
    
    ext = '.txt' # extension which shouldn't have autocompletion
    charset = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_' # chars which should prevent autocompletion
    
    def callback_BUFFERACTIVATED(args):
        filename, extension = os.path.splitext(notepad.getBufferFilename(args["bufferID"]))
        if extension == ext:
            editor.autoCStops(charset)
    
    notepad.clearCallbacks([NOTIFICATION.BUFFERACTIVATED])    
    notepad.callback(callback_BUFFERACTIVATED, [NOTIFICATION.BUFFERACTIVATED])
    

    Cheers
    Claudia


Log in to reply