Are there any plugins which demostrate true pop-up code completion tips (i.e. Intellisense?)

  • Steve Perkins

    Steve Perkins - 2014-02-26

    The Go programming language has a code analysis utility called "gocode". If you pass that executable a file and a character offset position, then it will return a list of code-completion tips for that point in the file. This goes beyond the normal Notepad++ concept of autocompletion, based on a fxed XML list of keywords. It instead is true code completion that offers options based on analysis of the code... like Intellisense in Visual Studio, or code completion in most other IDE's.

    I would like to develop a plugin which uses the "gocode" executable, to offer true IDE-style code completion for Go in Notepad++. With the plugin enabled, you could hit [Ctrl]-[Space] (or some other hotkey) in a Go file, and see a pop-up list of hints to choose from at that point.

    The problem is that my C++ is rusty, and what experience I do have is on UNIX-like platforms. I was able to install Visual Studio Express, download the sample Notepad++ plugin template, and create a basic "Hello world" level plugin. However, I'm not sure where to begin as far as registering a hotkey, or causing an Intellisense-style box to pop up over a cursor point in the Scintilla editor.

    Are there any open-source Notepad++ plugins out there which do anything remotely comparable (i.e. pop-up a selection box at the current cursor point), that I might reference as a guide? Most of the actual logic for my plugin would come from the "gocode" executable, so I'm optimistic that I can pick up enough C++ to handle the UI portion. However, I have no qualms about using C# or even VB if there are easier examples and I could get the same result (my primary language is Java).


  • cchris

    cchris - 2014-02-26

    OTOH I'd go inspetct the code of DSpellCheck, the spell checking plugin that ships with N++. Yours could be a cross bread between this and N++ own brand of word completion (based on the words of the current document). Specially in <hatever\trunk\PowerEditor\src\ScitillaComponent\AutoCompletion.cpp


  • Steve Perkins

    Steve Perkins - 2014-02-27

    Thanks! I've made a substantial amount of progress over the past 24 hours, although I did end up using the C# template rather than C++ due to the more gentle learning curve for outsiders to both languages. Integration with the "gocode" executable basically works now, I just need to render its output in the UI.

    I looked at the DSpellCheck plugin, but there are a couple of obstacles. For one thing, unless I'm completely missing something, it doesn't seem to support being activated by hotkey. It seems to be invoked by right-clicking on a misspelled word with the mouse. I could figure out on my own how to add a hotkey binding, but I suspect that the pop-up would appear at the mouse position rather than the cursor position in the text.

    More importantly, DSpellCheck activates a standard STATIC right-click menu. I could settle on this for now, especially for the first version of my plugin. However, what I eventually want is an Intellisense-style dynamic widget. Once the pop-up appears, if the user keeps typing then the options inside the widget are further refined to match the updating text. I might be able to simulate this by redrawing the right-click menu repeatedly, but I'm wondering if some widget that more closely resembles the Intellisense pop-up already happens to exist in the NPP or Scintilla codebase.

  • cchris

    cchris - 2014-02-27

    How about ACCPC?


    • dail8859

      dail8859 - 2014-02-27

      I don't believe the source code for ACCPC is available anywhere. Is it? I was also curious to look at its code for pop-ups.

      Last edit: dail8859 2014-02-27
    • Steve Perkins

      Steve Perkins - 2014-02-27

      PERFECT! Thanks for pointing this out. Since it doesn't seem to be available through the main NPP plugin manager, I might never have stumbled across it otherwise.

      It looks like the author wanted to clean up his source code before releasing it publicly, and never got around to it. I just reached out via email to see if he would be willing to let me take a look. It's Delphi rather than C#, so I wouldn't be able to use it directly anyway... but it would be extremely helpful to see the lower-level API calls that it makes.

      Once my Go plugin is in a basically functional state, I'll make my code available on GitHub and/or SourceForge for anyone else who is curious.

      • Steve Perkins

        Steve Perkins - 2014-02-28

        The ACCPC guys just released source code for their plugin today:

        In the meantime, I had been exploring the CCompletion plugin's source code, recommended to me in another thread. That plugin is C++ based, and generates its pop-up using a classic Win32 approach that is not well supported in C#. C# pushes WinForms as a newer alternative.

        The ACCPC plugin seems to use some sort of Delphi wrapper around WinForms. Or maybe Delphi wraps a lower-level API, and exposes it as a higher-level API analogous to WinForms. I am primarily a server-side Java guy, so all three of these languages (as well as Windows desktop development in general) are new and alien to me.

        However, my C# comfort level is coming along quickly. 24-hours ago, I had never heard of WinForms... but by last night I had my plugin generating a proper pop-up, with no border or windows controls, which closes upon hitting the Escape key. Beyond the UI, it's heartening to see most of my newbie assumptions validated in other plugins as well.

  • tike

    tike - 2014-03-06

    Hi Steve,

    since you've turned to C# it is probably to late right now, but I've a project going that is working on achiving exactly what you have in mind (plus some more).

    I don't know, if you were aware of it, but you are kindly invited to join forces with me and Mateusz.

    Check out the code at

    PS: I'm no C++ guru either, so no worries about that ;-)

    • Steve Perkins

      Steve Perkins - 2014-03-06

      I saw your announcement of GOnpp, but I believed that GoAutocomplete goes hand-in-hand with it rather than competing with it.

      It looks like you're integrating Notepad++ with the Go compiler and toolchain. Adding toolbar buttons to compile the current file, etc... but not doing source code autocomplete. I am working on source code autocomplete, but have no plans to integrate with the compiler in any way (my plugin doesn't even care if you have Go installed).

      I imagined that if people wanted both features, they could install both plugins... and end up with a Notepad++ environment that nearly resembles LiteIDE. When your project is fully released, I planned to add a reference to it in my "Help" docs. It might actually make sense to keep the features separate, as many people may only want one or the other (if you want both, why not just use LiteIDE?). Be advised that because my GoAutocomplete bundles the "gocode.exe" executable with it, my plugin is already around 10 MB.

      I'm not COMPLETELY opposed to our plugins converging at some point, especially if others have the time and energy to maintain it. My main motivation in writing my plugin is that I wanted the "true" Go autocomplete available for Vim and Emacs, and it didn't exist yet. But I'm an older guy with a busy career and family, so my free time for side projects comes in spurts. I happen to have to free time right now to knock out this plugin, but then it might be a month or two before I'm able to touch it again. So I may not be the best collaborator in the world. I chose C# because it's similar enough to Java... I don't know that I'll ever have the time or motivation to scrape a decade-and-a-half worth of rust off my old C++ skills.

      Anyway, let me know if you are planning to fully integrate the "gocode" executable and autocomplete into your plugin, or if I was correct about the two projects being complimentary rather than competitive. I expect to have GoAutocomplete ready for public beta testing this weekend... the only thing left to add first is a "Help / About" dialog box, and writing up some docs.

  • cchris

    cchris - 2014-03-06

    As you all noticed, plugins can be written in any language you can produce a dll with, since a plugin is /just/ a dll with the proper interface or contract.

    Since N++ is written in plain C++ - no obfuscation and bloat from various frameworks needed so far -, there is an advantage in writing it in C++, because you can reuse any part of the N++ code seamlessly and free of charge. Using a different language entails translating all C/C++ constructs, and specially structs, to the language. Including types and API calls from the Win32 API that you need. It has been done, but it is extra work. Perhaps the dedicated sections in can help - that was their purpose.

    N++ relays a number of notifications and messages to plugins, the notifications landing in your beNotified routine. If you wish to react to text changes, listen for SCN_CHARADDED, SCN_UPDATEUI or SCN_MODIFIED, depending on what you want to achieve. Now you know what is going on, but not where. Popping up an autocomplete or user list box is handled by Scintilla, who knows where to display it -your job is just to tell it what's the list and what's the current position there.

    If you cannot get the signals you are interested in, there is a brute force approach consisting in subclassing the Scintilla or Notepad++ windows. The pluin knows their handles, so it can be done. At that point you can monitor all of the communications and events, and can monitor or tweak anything you like. You may be interested in, even though the plugin isn't as useful as it used to be, and it is C++.



Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks