Beispiel #1
0
        static public void ToggleBreakpoint(int lineClick = -1)
        {
            string file = Npp.GetCurrentFile();

            int line = 0;

            if (lineClick != -1)
            {
                line = lineClick;
            }
            else
            {
                line = Npp.GetCaretLineNumber();
            }

            bool isAutoGenerated = file.EndsWith(".g.cs", StringComparison.OrdinalIgnoreCase);

            if (!isAutoGenerated)
            {
                ToggleBreakpoint(file, line);
            }

            if (OnBreakpointChanged != null)
            {
                OnBreakpointChanged();
            }
        }
Beispiel #2
0
        static public void SetInstructionPointer()
        {
            if (IsRunning && IsInBreak)
            {
                ClearDebuggingMarkers();

                int line = TranslateSourceLineLocation(Npp.GetCurrentFile(), Npp.GetCaretLineNumber());

                DebuggerServer.SetInstructionPointer(line + 1); //debugger is 1-based
                DebuggerServer.Break();                         //need to break to trigger reporting the current step
            }
        }
Beispiel #3
0
 static public void RunToCursor()
 {
     if (IsRunning && IsInBreak)
     {
         string file             = Npp.GetCurrentFile();
         int    line             = Npp.GetCaretLineNumber();
         string key              = BuildBreakpointKey(file, line);
         string actualBreakpoint = TranslateSourceBreakpoint(key);
         DebuggerServer.AddBreakpoint(actualBreakpoint);
         DebuggerServer.Go();
         DebuggerServer.OnBreak = () =>
         {
             DebuggerServer.RemoveBreakpoint(actualBreakpoint);
         };
     }
 }
Beispiel #4
0
        void MembersList_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (membersList.SelectedItem != null)
            {
                var info = (membersList.SelectedItem as MemberInfo);
                try
                {
                    membersList.SelectedItem = null;
                    if (info.Line != -1)
                    {
                        Npp.GrabFocus();
                        int currentLineNum  = Npp.GetCaretLineNumber();
                        int prevLineEnd     = Npp.GetLineStart(currentLineNum) - Environment.NewLine.Length;
                        int topScrollOffset = currentLineNum - Npp.GetFirstVisibleLine();

                        Win32.SendMessage(Npp.CurrentScintilla, SciMsg.SCI_GOTOLINE, info.Line, 0);
                        Npp.SetFirstVisibleLine(info.Line - topScrollOffset);
                    }
                }
                catch { } //it is expected to fail if the line does not contain the file content position spec. This is also the reason for not validating any "IndexOf" results.
            }
        }