Plugin development help
-
Hi,
So i have decided that i want to make a plugin for NP++.
I’m using (or trying to!) NP++ Plugin.NET, but i am having trouble understanding which commands to use.
What i want to do is make a plugin that brings up call-tips if you type “(” or “{”.
Can someone help?Cheers,
FinnP.S: I don’t really know where to put this, in Plugin Development or Help wanted, so sorry if it is in the wrong place :)
-
You could look at the sources of
https://sourceforge.net/projects/npp-plugins/files/XBrackets Lite/
It’s in C++, but I believe it’s enough to catch the idea of what to do in C#.
Search for SCN_CHARADDED in the source code. -
Thanks @Vitaliy-Dovgan
-
Hi,
Well i found it and i know what i’m looking for (sort of?). I think i need some help. Again :)
And your right about C being easy to understand
I did what you said and found no trace of SCN_CHARADDED. Thought i did search the plugin template and that had it.
By the way, what would i do with SCN_CHARADDED, what i mean is: what is it’s use?
e.g.if NppData.SCN_CHARADDED /*Would somthing like that work?*/ { };
I think this code is maybe what i’m looking for (it’s from XBrackets.h):
public: enum TFileType { tftNone = 0, tftText, tftC_Cpp, tftH_Hpp, tftPas, tftHtmlCompatible }; enum TBracketType { tbtNone = 0, tbtBracket, // ( tbtSquare, // [ tbtBrace, // { tbtDblQuote, // " tbtSglQuote, // ' tbtTag, // < tbtTag2, tbtCount }; enum eConsts { MAX_ESCAPED_PREFIX = 20 }; static const TCHAR* PLUGIN_NAME; static const char* strBrackets[tbtCount - 1]; protected: // plugin menu CXBracketsMenu m_PluginMenu; // internal vars INT_PTR m_nAutoRightBracketPos; int m_nFileType; bool m_bSupportedFileType; public: CXBrackets(); virtual ~CXBrackets(); // standard n++ plugin functions virtual void nppBeNotified(SCNotification* pscn); virtual FuncItem* nppGetFuncsArray(int* pnbFuncItems); virtual const TCHAR* nppGetName();
Is it what i’m looking for?
Cheers,
Finn -
@Finn-McCarthy said:
would i do with SCN_CHARADDED, what i mean is: what is it’s use?
I think the implication here is when you see that, you could check if what was added was
(
or{
(from your spec)…and do whatever actions you want your plugin to do when that occurs. -
Source file XBrackets\src\XBrackets.cpp,
void XBrackets::nppBeNotified(SCNotification* pscn) { ... switch ( pscn->nmhdr.code ) { case SCN_CHARADDED: OnSciCharAdded(pscn->ch); break; ... } ... }
Basically, what needs to be done now is:
- implement own method Plugin.nppBeNotified to be called from the standard
void beNotified(SCNotification* pscn)
; - implement own Plugin.OnSciCharAdded (looking at the one in XBrackets as an example)
- implement own method Plugin.nppBeNotified to be called from the standard
-
See scintilla docu: https://www.scintilla.org/ScintillaDoc.html#SCN_CHARADDED. Scintilla is the framework N++ is based on.
-
Hi,
I found out the proper name of what i’m trying to do: Call-Tips. (custom Call-Tips).
Ok. I have had a look…And i still don’t understand. I probably should mention that have never, ever coded in C, C++,C# or VB (well 3 years ago, anyway and i cannot remember practically anything). So yeah…(This next bit will probably sound lame…sorry)
What I am trying to say is: I basically need someone to write the plugin for me, and i can learn from their source code. That’s how i normally learn…
Cheers,
FinnP.S: Sorry, (I know i probably sound whiny)
-
EDIT: I found a way, yippee!!
jN Notepad++ Plugin