Skip to content
This repository was archived by the owner on Jan 13, 2024. It is now read-only.

.Net package to install into visual studio to make plugins for Notepad++

License

Notifications You must be signed in to change notification settings

kbilsted/NotepadPlusPlusPluginPack.Net

Repository files navigation

NppPlugin .NET package for VS2015 and beyond...

What is this? Its a simple template for very fast and easy building plugins for Notepad++ in C#/.Net

This is a fork of UFO's plugin package updated for VS2015

Build status License Stats Stats

Getting started

  1. Download a release
  2. Place the visual studio project template (the NppPlugin.zip) in the visual studio path (typically "My Documents\Visual Studio 2015\Templates\ProjectTemplates\Visual C#\")
  3. Ensure you have installed Visual C++ from the visual studio installer otherwise your project wont build
    install CPP
  4. Create a new project inside Visual studio using file -> new -> project -> visual C# -> Notepad++ project
  5. Build (building will copy the dll to the Notepad++/plugins folder)
  6. Start Notepad++ and activate your plugin from the plugins menu

Upgrading to a newer version

  • Upgrading the pluging package

    • replacing the NppPluginXXXX.zip from your visual studio (typically "My Documents\Visual Studio 2015\Templates\ProjectTemplates\Visual C#\") with a newer version
  • Upgrading plugings using the plugin pack.

    • Delete the folder PluginInfrastructure and copy over that folder from a newer version of NppPluginXXXX.zip
    • Open visual studio
      • Click "show all files" in the "solution explorer"
      • Select the new files, Right-click and choose "include in project"

Plugins using this pluginpack

How to start coding plugins

First read the the demo-plugin code. It is actively being maintaned - see https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net/tree/master/Demo%20Plugin it is a spin-off of Don Ho's http://download.tuxfamily.org/nppplugins/NppPluginDemo/NppPluginDemo.zip

Overall plugin architecture

Plugins can interact with Notepad++ or the underlying Scintilla engine. The plugin pack provides two classes to make this interaction easier. This is NotepadPlusPlusGateway and ScintillaGateWay which are thin layers making interaction more pleasant (and testable!).

If you are interested in low-level access you can use the Win32 api also included in the plugin pack.

The architecture of the plugin is.

               +-----------+ +-----------+
               | Scintilla | | Notepad++ |
               +-----------+ +-----------+
                    ^             ^
                    |             |
           +--------+--------+----+------------+                   
           |                 |                 |
 +------------------+ +----------------+ +-----------+ 
 | ScintillaGateway | | NotepadGateway | | Win32     |
 +------------------+ +----------------+ +-----------+ 
      ^                     ^                ^        
      |                     |                |        
      +-----------------+---+----------------+                   
                        |              
                   +-----------+ 
                   | Plugin    |
                   +-----------+ 

How to debug plugins

  • start notepad++
  • in Visualstudio: debug -> attach to process... -> notepad++.exe

you can now set breakpoints and step-execute. (currently not working in v6.9.2 notepad-plus-plus/notepad-plus-plus#1964)

  • you can make this process easier by setting the "start action" in the project -> properties -> debug to start notepad++.exe - then you can simply build and hit F5.

Versioning

Until we reach v1.0 expect a bit of chaos and breaking changes.

From v1.0 and onwards we will turn over to semantic versioning

Credits

Requirements:

  • works with .NET Runtime 3.5 and above (can easily be reduced to .Net runtime 2.0 if needed)
  • UNICODE plugins only.

About me

I blog at http://firstclassthoughts.co.uk/ on code readability and quality