static void beNotified(IntPtr notifyCode) { try { CSScriptIntellisense.Interop.NppUI.OnNppTick(); SCNotification nc = (SCNotification)Marshal.PtrToStructure(notifyCode, typeof(SCNotification)); //Debug.WriteLine(">>>>> ncnc.nmhdr.code={0}, {1}", nc.nmhdr.code, (int)nc.nmhdr.code); if (nc.nmhdr.code == (uint)NppMsg.NPPN_READY) { CSScriptIntellisense.Plugin.OnNppReady(); CSScriptNpp.Plugin.OnNppReady(); Npp.SetCalltipTime(500); } else if (nc.nmhdr.code == (uint)NppMsg.NPPN_SHUTDOWN) { CSScriptNpp.Plugin.StopVBCSCompilers(); } else if (nc.nmhdr.code == (uint)NppMsg.NPPN_TBMODIFICATION) { CSScriptNpp.Plugin.OnToolbarUpdate(); } else if (nc.nmhdr.code == (uint)NppMsg.NPPM_SAVECURRENTFILEAS || (Config.Instance.HandleSaveAs && nc.nmhdr.code == (uint)SciMsg.SCN_SAVEPOINTREACHED)) //for some strange reason NPP doesn't fire NPPM_SAVECURRENTFILEAS but does 2002 instead. { string file = Npp.GetCurrentFile(); if (file != lastActivatedBuffer) { CSScriptNpp.Plugin.OnFileSavedAs(lastActivatedBuffer, file); } } else if (nc.nmhdr.code == (uint)SciMsg.SCN_CHARADDED) { CSScriptIntellisense.Plugin.OnCharTyped((char)nc.ch); } //else if (nc.nmhdr.code == (uint)SciMsg.SCN_KEY) //{ // System.Diagnostics.Debug.WriteLine("SciMsg.SCN_KEY"); //} else if (nc.nmhdr.code == (uint)SciMsg.SCN_MARGINCLICK) { if (nc.margin == _SC_MARGE_SYBOLE && nc.modifiers == SCI_CTRL) { int lineClick = Npp.GetLineFromPosition(nc.position); Debugger.ToggleBreakpoint(lineClick); } } else if (nc.nmhdr.code == (uint)SciMsg.SCN_DWELLSTART) //tooltip { //Npp.ShowCalltip(nc.position, "\u0001 1 of 3 \u0002 test tooltip " + Environment.TickCount); //Npp.ShowCalltip(nc.position, CSScriptIntellisense.Npp.GetWordAtPosition(nc.position)); //tooltip = @"Creates all directories and subdirectories as specified by path. Npp.OnCalltipRequest(nc.position); } else if (nc.nmhdr.code == (uint)SciMsg.SCN_DWELLEND) { Npp.CancelCalltip(); } else if (nc.nmhdr.code == (uint)NppMsg.NPPN_BUFFERACTIVATED) { string file = Npp.GetCurrentFile(); lastActivatedBuffer = file; if (file.EndsWith("npp.args")) { Win32.SendMessage(Npp.NppHandle, NppMsg.NPPM_MENUCOMMAND, 0, NppMenuCmd.IDM_FILE_CLOSE); string args = File.ReadAllText(file); Plugin.ProcessCommandArgs(args); try { File.Delete(file); } catch { } } else { CSScriptIntellisense.Plugin.OnCurrentFileChanegd(); CSScriptNpp.Plugin.OnCurrentFileChanged(); Debugger.OnCurrentFileChanged(); } } else if (nc.nmhdr.code == (uint)NppMsg.NPPN_FILEOPENED) { string file = Npp.GetTabFile((int)nc.nmhdr.idFrom); Debugger.LoadBreakPointsFor(file); } else if (nc.nmhdr.code == (uint)NppMsg.NPPN_FILESAVED || nc.nmhdr.code == (uint)NppMsg.NPPN_FILEBEFORECLOSE) { string file = Npp.GetTabFile((int)nc.nmhdr.idFrom); Debugger.RefreshBreakPointsFromContent(); Debugger.SaveBreakPointsFor(file); if (nc.nmhdr.code == (uint)NppMsg.NPPN_FILESAVED) { Plugin.OnDocumentSaved(); } } else if (nc.nmhdr.code == (uint)NppMsg.NPPN_FILEBEFORESAVE) { CSScriptIntellisense.Plugin.OnBeforeDocumentSaved(); } else if (nc.nmhdr.code == (uint)NppMsg.NPPN_SHUTDOWN) { Marshal.FreeHGlobal(_ptrPluginName); Plugin.CleanUp(); } if (nc.nmhdr.code == (uint)SciMsg.SCI_ENDUNDOACTION) { //CSScriptIntellisense.Plugin.OnSavedOrUndo(); } Plugin.OnNotification(nc); } catch { }//this is indeed the last line of defense as all CS-S calls have the error handling inside }