[Plugin update] An alternative auto completion for notepad++



  • Hello community,

    I don’t usually post updates of my plugin here; however, I think this release can potentially attract a wider audience.
    The plugin normally revolves only around a language called progress/open edge, you can learn everything about it here : http://jcaillon.github.io/3P.

    A replacement for the default auto completion

    In addition to the features targeting the openedge users, 3P now also include a new global feature :
    It can completely replace the default autocompletion of notepad++ (more precisely scintilla) by the one used in 3P.

    How does it look

    When typing in a simple text :

    image

    In a file known by notepad++ (i.e. with keywords defined) :

    image

    Why replacing the default autocompletion?

    Several reasons :

    • I’ve been using notepad++ for more than 10 years now, the autocompletion hasn’t changed a bit since the beginning. Don’t get me wrong, it is pretty ok (was even super cool when I started using notepad++), but I’ve used a lot a recent IDE (visual and every IDE from jetbrain) and I now find it pretty lackluster and not really enjoyable
    • Typing something in a big file with the autocompletion on slows down notepad++ by a lot (imho due to the usage of a simple scroll list in the scintilla autocompletion which has a lot of trouble displaying more than a thousand items)
    • And finally, because there are no normal ways of disabling the default autocompletion. So if you implement your own autocompletion, your user either has to deactivate the default autocompletion or bare 2 autocompletion each time he types something…

    What can be suggested?

    For now (v1.7.4), there are two types of words that can be suggested :

    1. **Words extracted from the current text : **
    • You can choose to extract numbers
    • You can choose the minimum length for words extracted
    • You can choose which characters are considered part of a word
      • it uses the notepad++ option in Delimiter -> Add your characters
      • and if you are on a file with an autocompletion xml (in plugins\APIs), it also uses the additionalWordChar field (see here for more info)
    1. **Keywords known by notepad++ : **
    • First it takes the keywords defined in the autocompletion xml for the current xml (in plugins\APIs)
    • Then it either takes the keywords from the lang.xml or the UserDefinedLang.xml, depending on the current language

    Options

    A noteworthy option is the ability to automatically insert the current suggestion when a non-word-character is typed. This is very similar to the autocompletion offered by the visual studio + resharper combo and allows to write code very quickly.

    image

    Screenshot of the available options (v1.7.3) :

    image
    Note : the screenshot is actually obsolete, find more options in the release.

    Future plan

    If this proves to be useful, I could extend the functionality by either using new config files (like the api .xml) or just enhancing the .xml files from the api to hold more information (maybe an html help/description of each keyword; adding “child” keywords for class liek keywords… I don’t know yet :))

    Anyway…
    I hope this can be useful to you guys; feedback is welcomed !
    ++



  • Damn, can’t edit my own post and I have to wait 1800s to post again ^^"
    Forgot the most important section :

    Try it

    Download the latest beta release here :
    https://github.com/jcaillon/3P/releases/tag/v1.7.4

    You can hide both side panels that are only useful to openedge programmers :)



  • @jcaillon - This looks great - Thanks!
    After installing and trying to use, I have the following comments:

    1. After selecting an item from the popup window, it inserts the selected word after what I already typed. if I type for instance low and choose lowercase from the list, I will end up with lowlowercase
    2. I have a high dpi monitor - the UI of the dropdown list is so tiny, I can hardly see it!
      here is a screenshot

    Another thing, is the autocomplete plugin tied together with the 3p plugin? Or can I install it without that?
    There were 2 files in the download, I placed both in the plugins folder.

    INFO:
    Notepad++ v7.3.3 (32-bit)
    Build time : Mar 8 2017 - 03:37:37
    Path : C:\Programs\Notepad++\notepad++.exe
    Admin mode : OFF
    Local Conf mode : ON
    OS : Windows 10 (64-bit)

    Thanks,
    David



  • Hi @DaveyD , thank you for the feedback.

    1. can you reproduce it everytime? I don’t have this issue on my end
    2. Ah, yes I’m aware of that issue #86; I’ve developped my own UI framework for this plugin and I’ve made the rookie mistake of ignoring dpi awareness ^^". That being said, the auto completion is entirely owner drawn so I will be able to make the font size an option in a later release

    Concerning your final question : yes, for now, this is tied to 3P. However, I plan to create a separate plugin with only this autocompletion feature once it is mature and stable enough inside 3P.

    Bye



  • @jcaillon - Thanks!

    1. I started testing again this morning - at first it wasn’t triggering at all! I restarted npp, still wasn’t triggering.
      It finally started triggering and this time it worked as expected and replaced the original text! (I will try to test this more to see why it wasn’t triggering and I’ll post back)
    2. Ok, optimistic news… I hope you can get to it sooner than later… :)
    3. Ok, that would be great because I don’t even know what Progress programming is… :)

    Thanks!
    David



  • @jcaillon - After a bunch of testing, I think I found the the problem of the triggering!

    Steps to reproduce:

    1. Open fresh npp
    2. Place cursor on a line that doesn’t have text
    3. Start typing - auto-complete does not trigger
    4. Now place cursor on a line with text
    5. Start typing - Autocomplete triggers as expected.

    I haven’t the slightest idea why this would be, but that was the results of my testing - I leave the rest up to you :)

    However, after testing some more, I realized another thing, If I open a new file and then go back to the original file, the autocomplete triggers as expected even on a line that has no text.

    Just to clarify: Once it triggers once, it continues to work correctly throughout the session in any place in the file. So, this is only a one time ‘setup’ per session (until you can figure out the cause and fix it… :) )

    Thanks,
    David



  • @DaveyD

    Thank you for taking the time to analyse this!

    I actually think that you are describing a expected behavior, let me explain :

    First thing to know is that there is an option that automatically hides the autocompletion if the text you type results in no matches in the list. This is enabled by default. (Plus, if there is absolutely nothing to suggest, e.i. you have no language selected and the text is empty, the list won’t automatically show up)

    1. Open fresh npp -> ok
    2. Place cursor on a line that doesn’t have text -> at this point, you are probably on a new file, not associated with a particular language and the text is empty -> hence the list is empty
    3. Start typing - auto-complete does not trigger -> since the list is empty, nothing happens when you type text (because of the option mentionned earlier) -> however you should be able to press CTRL+SPACE to show the empty list
    4. Now place cursor on a line with text -> I guess you changed file or added text -> now the list isn’t empty
    5. Start typing - Autocomplete triggers as expected. -> since the list isn’t empty, it shows the autocompletion

    Tell me if this makes sense :)



  • @jcaillon - Thanks for the response
    That default behavior is perfect!
    However, I don’t think I explained myself well enough:
    2. No, I was in a file with over 1500 lines of text, I had just placed my cursor on an empty line.
    And the file is associated with a UDL (by the way, when the autocomplete does trigger, it shows function params as well - nice!)
    3. I just tried again, list was empty (even though I was in large file) and ctrl+space opened a HUGE list of words (I guess all the words in the file)
    4. No, I just moved it up to the previous line that already had text

    Actually, now I received different behavior. There are a bunch of steps:

    1. Open fresh npp
    2. Place cursor on blank line - no autocomplete
    3. Place cursor on line with text - no autocomplete
    4. Place cursor on line right after text - autocomplete triggers!
    5. Press enter, now no autocomplete anywhere
    6. Open new file in npp and return to previous file - autocomplete everywhere and anywhere!

    I created a small screen recording to show you my testing, please download from here:
    Screencast on autocomplete issues

    I hope all this info is clear
    Thanks,
    David



  • This post is deleted!


  • @DaveyD
    Im so sorry, I see your problem in the video but I still can’t reproduce it!
    Do you have other plugins installed? Is your file special in any way? I’m clueless at this point ^^"

    If that’s not too much too ask, and if you use a portable version of npp, would you mind sending me a copy of your npp installation directory with a sample file of your language?



  • @jcaillon - after reading that you couldn’t reproduce it, I realized that it must be something on my end…
    I started debugging - I must have spent 2 hours debugging!
    This is my testing outcome:
    [Excuse me for writing all these steps… it’s just that after debugging for so long… I just have to write what I did! :) ]

    • Created a new portable npp and installed your plugin - everything worked.
    • Installed all my plugins, everything worked!??
    • Removed all plugins from my original install - it worked!
    • Began putting all back few by few… I found that it was the python plugin!
      • but that’s odd, because in my new portable npp, I also had python plugin installed and it worked!?
    • I went back to my new portable install, removed all plugins except python. It worked!??
      • If so, it must be something with my Python plugin in my installed version.
      • I checked it and it was up to date.
      • Maybe it’s one of my python scripts? (read on…)
    • I copied all my Python scripts from my install into my new portable npp - it still worked!!
    • I started going through the config folder file by file…

    Anyway, to make a long story short… the bug is due to a setting on Python script!
    When Python script is set to start startup scripts ATSTARTUP (instead of LAZY), we get this funny behavior.

    Steps to Reproduce: (You don’t have to follow these steps exactly, just have python plugin installed and set that setting to ATSTARTUP. I am just writing it this way to show that it is a pure conflict - not tied to anything on my machine.)

    1. Fresh install of npp
    2. Fresh install of Python plugin
    3. Go to Plugins>Python Script>Configuration, and set Initialisation to ATSTARTUP
    4. Close npp, reopen, the bug appears.
    5. The minute you change file and come back, it begins to work.

    However, I did realize that it doesnt behave this way with all files! I tried a python script, it worked fine. I tried a regular txt file, it worked fine. I has to do something with the text in my file.
    For testing purposes, I was able to reproduce this issue with a file of just a few lines.

    In order to help you find the problem, I am sending you the sample document. I am actually sending you 2 of the same docs with a slightly different name so you can see that immediately after moving to a new file, it begins to work even though the files are identical!
    If it’s more convenient for you, I also packaged the entire portable npp folder. If you go with this, everything will be setup already (files included, and they will open immediately because of the sesssion file).
    Set of 2 files for testing
    Npp portable - all included

    By the way, I tested this exact method on 2 different machines and got the same results.

    I hope this helps!
    David

    P.S. I also hope you plan to fix the tiny UI… :)



  • EDIT: (4/5/2017, 11:59 PM)
    The for the portable npp package was incorrect. Here is the updated link:
    Npp portable - all included

    Sorry about that,
    David



  • @DaveyD, thank you very much the time you spent on this issue!

    I’m glad we found the source, I am assuming that the python plugin modifies some scintilla options on startup; I’ll investigate ASAP. In the meantime, an easy workaround is to switch documents on startup :p

    I should be able to fix the DPI awareness for the next release; at least for the auto completion form (I have more complex issues in the main window).



  • @jcaillon, Ok, thanks!
    The workaround is definitely ok for me… :)
    Regarding the dpi issue, that sounds great for me! Thanks
    After you release that I will hopefully be able use it and to provide much better feedback on the actual plugin.

    Thanks and Good luck
    David



  • @jcaillon Great work! How did you disable the default auto completion feature?


Log in to reply