diff --git a/src/Main/Base/Project/Src/TextEditor/Gui/Editor/ErrorDrawer.cs b/src/Main/Base/Project/Src/TextEditor/Gui/Editor/ErrorDrawer.cs index d3daeeea00..563ec2b8ac 100644 --- a/src/Main/Base/Project/Src/TextEditor/Gui/Editor/ErrorDrawer.cs +++ b/src/Main/Base/Project/Src/TextEditor/Gui/Editor/ErrorDrawer.cs @@ -50,7 +50,6 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor TaskService.Removed += new TaskEventHandler(OnRemoved); TaskService.Cleared += new EventHandler(OnCleared); TaskService.InUpdateChanged += OnInUpdateChanged; - textEditor.FileNameChanged += new EventHandler(SetErrors); DebuggerService.DebugStarted += OnDebugStarted; DebuggerService.DebugStopped += OnDebugStopped; } @@ -88,7 +87,6 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor TaskService.Removed -= new TaskEventHandler(OnRemoved); TaskService.Cleared -= new EventHandler(OnCleared); TaskService.InUpdateChanged -= OnInUpdateChanged; - textEditor.FileNameChanged -= new EventHandler(SetErrors); DebuggerService.DebugStarted -= OnDebugStarted; DebuggerService.DebugStopped -= OnDebugStopped; ClearErrors(); @@ -182,7 +180,10 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor } } - void SetErrors(object sender, EventArgs e) + /// + /// Clears all errors and adds them again. + /// + public void UpdateErrors() { ClearErrors(); foreach (Task task in TaskService.Tasks) { diff --git a/src/Main/Base/Project/Src/TextEditor/Gui/Editor/SharpDevelopTextAreaControl.cs b/src/Main/Base/Project/Src/TextEditor/Gui/Editor/SharpDevelopTextAreaControl.cs index 3762704ee0..3ede44107d 100644 --- a/src/Main/Base/Project/Src/TextEditor/Gui/Editor/SharpDevelopTextAreaControl.cs +++ b/src/Main/Base/Project/Src/TextEditor/Gui/Editor/SharpDevelopTextAreaControl.cs @@ -193,6 +193,13 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor } } + internal void FileLoaded() + { + if (errorDrawer != null) { + errorDrawer.UpdateErrors(); + } + } + void GenerateEditActions() { #if DEBUG diff --git a/src/Main/Base/Project/Src/TextEditor/Gui/Editor/TextEditorDisplayBinding.cs b/src/Main/Base/Project/Src/TextEditor/Gui/Editor/TextEditorDisplayBinding.cs index dc82d7f496..3c5256b75a 100644 --- a/src/Main/Base/Project/Src/TextEditor/Gui/Editor/TextEditorDisplayBinding.cs +++ b/src/Main/Base/Project/Src/TextEditor/Gui/Editor/TextEditorDisplayBinding.cs @@ -231,6 +231,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor bool autodetectEncoding = true; textEditorControl.LoadFile(file.FileName, stream, true, autodetectEncoding); + textEditorControl.FileLoaded(); foreach (Bookmarks.SDBookmark mark in Bookmarks.BookmarkManager.GetBookmarks(file.FileName)) { mark.Document = textEditorControl.Document; textEditorControl.Document.BookmarkManager.Marks.Add(mark);