NppPlugin.NET v0.6

  • UFO

    UFO - 2011-03-25


    this package update goes out to all VB.NET and/or SharpDevelop users.
    If you're using Visual Studio and C#, you don't need this update - nothing changed for you since v0.5.

    1) Templates:
         . Visual Studio 2005 (C# and VB.NET)
         . Visual Studio 2008 (C# and VB.NET)
         . Visual Studio 2010 (C# and VB.NET)
         . SharpDevlop 2.x    (C# and VB.NET)
         . SharpDevlop 3.x    (C# and VB.NET)
         . SharpDevlop 4.x    (C# and VB.NET)

    2) Demo:
         . Visual Studio 2005 (C#)
         . Visual Studio 2008 (C#)
         . Visual Studio 2010 (C#)


    PS: There's a very small issue with the VB.NET templates for Visual Studio.
    Right after creating a new project you have to delete the root namespace in
    the project settings, else you can't compile it. Seems there's no way to provide
    a VS VB.NET template with empty root namespace :S


  • CFrank

    CFrank - 2011-03-25

    Hi UFO,

    thank you very much. That's brilliant.


  • Anonymous - 2011-04-23

    Why don't you reference the RGiesecke.DllExport.DllExportAttribute.dll from VB.Net?
    That way you do not have to recreate the attribute in Vb.Net with its creepy namespace messing-up.
    It is not a requirement to distribute this assembly along the final plugin, because my task searches for this very assembly name and removes its reference from the output assembly.

    The advantage is, that Vb.Net users can use the default namespace like they are used to, and there's no catch for a new project.

  • UFO

    UFO - 2011-04-24

    thx for the hint, I will revise that for the next package version

  • Judd Gledhill

    Judd Gledhill - 2011-05-14


    I just found your template and demo. Thanks for them. When I load up the demo in VSE 2010 and just hit the run button, I get:

    Error 1 The type or namespace name 'Point' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Judd\Desktop\NppPlugin.NET.v0.6\Demo\NppManagedPluginDemo\NppPluginNETHelper.cs 2108 67 NppManagedPluginDemo.VS2010

    Its this line:

            public static extern bool ClientToScreen(IntPtr hWnd, ref Point lpPoint);

    In this file:  NppPluginNETHelper.cs

    I am guessing this is my issue, but just in case it is not.

    Also, when I drop the templates in, should I be unzipping that folder? On my machine I end up with the following path…

    C:\Users\MyName\Documents\Visual Studio 2010\Templates\ProjectTemplates\Visual C#\NppPlugin\*

    All of your files, in their unzipped glory, are under that folder. Is that correct?



  • UFO

    UFO - 2011-05-14

    thx for reporting.. somehow the "using System.Drawing;"
    at the top of "NppPluginNETHelper.cs" got lost while packaging :\

  • UFO

    UFO - 2011-05-14

    ahh.. and you gotta drop the template ZIPs as they come.
    No need to unpack them!

  • Judd Gledhill

    Judd Gledhill - 2011-05-14

    One other, but potentially lengthy, question… The docs on making a template are not great and C++ is gobbledy gook to me… How do the plugins work? Like what is the mental model for them? So they just call out and run your code? Even the C# in your demo is pretty significant. I am looking for a "for dummies, but not just an example" thing. Something that breaks the steps down for us n00bs.



  • cchris

    cchris - 2011-05-16

    The model is the one every Windows application follows: a plugin receives notifications and messages, and acts upon them.

    The big difference between Notepad++ and a plugin is that N++ getsmost  messages from the outside world, while a plugin gets most of its notifications and messages from N++. Granted, this line blurs when the plugin creates handles and proces stuff directed to them, but that's how basically the system works.

    Did you check ? Perhaps this could help you.And if you got ideas about making the page more useful, please report that back.


  • UFO

    UFO - 2011-05-16

    I guess this is more like a general question.. how do plug-ins usually work?
    Sry, I don't feel like answering it in-depth, since I'm still too much of a n00b myself.

    On the one side there are callbacks/events (call em whatever you like) fired by the
    host: N++. Let's say by the host"s": N++ and Scintilla. Things like "hullo plug-in,
    N++ just started, what do you wanna do now?" or "hullo plug-in, N++ just opened
    a document, what do you wanna do with it now?"
    Mostly you get a 'context' from the host when you handle one of its events, for
    instance the document path, when the document got opened.

    On the other side there are the GUI elements which you can 'register'. Things like
    a button "Analyze selected text", which directly executes your plug-in code.

    Then there are the APIs of N++ and Scintilla, which you will use in your code.
    Well, the latter one is well documented:
    I don't know if the one of N++ needs to be documented better than it is right now,
    since the names/symbols mostly speak for theirselves…

  • Judd Gledhill

    Judd Gledhill - 2011-05-17

    I will read the URL and report back ;-)

    I guess that since I am not a C guy its quite difficult to interpret some of the code with all the wndPtrs and all that.

  • Judd Gledhill

    Judd Gledhill - 2011-05-17

    Ok, I think I am getting it a little bit.

    You have a file that "maps" from the scary C API messages out to C#. It does this with some complex looking behaviors that really just point at the NPP Api call and map it back, in some cases, to functions that get called when something gets selected in the plugin menu.

    I am most interested in the dockable dialog part of your code, as that is pretty much what I am trying to do here. I will poke at that more and try and build and deploy your plugin to my npp setup and see the correlation.

  • Chris McGrath

    Chris McGrath - 2013-01-17

    Having trouble getting this to work in Visual Studio 2012. I simply get an error "The system cannot find the file specified" Doesn't mention what the file is.

    From my testing it seems to have something to do with NppPlugin.DllExport.targets
    Removing the Import line in the project makes it build (but obviously not work in npp) but if you change the import line to an file which doesn't exist the project refuses to load.

    So this tells us that it is finding NppPlugin.DllExport.targets but there's an error inside it.

    Any help would be great.

    Last edit: Chris McGrath 2013-01-17