public static void RefreshBreakPointsFromContent() { var chengedFiles = new List <string>(); var currFile = Npp.GetCurrentFile(); foreach (string key in breakpoints.Keys.ToArray()) { //IMPORTANT: GetLineOfMarker returns line form the handle of the marker within a //current file. Value of handles are file specific and reused between the files/documents. //This is because marker handles are just marker indexes within a document. //Thus resolving a given handle for a non current document can in fact return a proper line //of the current doc if it has the marker with the same handle value. This already led to //the break points drifting. if (!key.StartsWith(currFile, StringComparison.OrdinalIgnoreCase)) { continue; } IntPtr marker = breakpoints[key]; if (marker != IntPtr.Zero) { int line = Npp.GetLineOfMarker(marker); if (line != -1 && !key.EndsWith("|" + (line + 1))) { //key = <file>|<line + 1> //server debugger operates in '1-based' and NPP in '0-based' lines string file = key.Split('|').First(); if (!chengedFiles.Contains(file)) { chengedFiles.Add(file); } string newKey = file + "|" + (line + 1); breakpoints.Remove(key); if (breakpoints.ContainsKey(newKey)) { breakpoints.Add(newKey, marker); } else { breakpoints[newKey] = marker; } } } } if (OnBreakpointChanged != null) { OnBreakpointChanged(); } }