From f5793ea34811ea6e77650d2bd3576de79bd72076 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Fri, 8 Dec 2006 22:46:27 +0000 Subject: [PATCH] Fixed some problems reported in the forum. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2140 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Src/Document/MarkerStrategy/TextMarker.cs | 6 ++--- .../Project/Src/Lexer/CSharp/Lexer.cs | 23 +++++++++++++++++++ .../Services/ProjectService/ProjectService.cs | 4 ++++ 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/MarkerStrategy/TextMarker.cs b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/MarkerStrategy/TextMarker.cs index 4c02b0b3f5..953d8f133a 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/MarkerStrategy/TextMarker.cs +++ b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/MarkerStrategy/TextMarker.cs @@ -76,8 +76,7 @@ namespace ICSharpCode.TextEditor.Document public TextMarker(int offset, int length, TextMarkerType textMarkerType, Color color) { - if (length < 1) - throw new ArgumentOutOfRangeException("length", length, "length must be >= 1"); + if (length < 1) length = 1; this.offset = offset; this.length = length; this.textMarkerType = textMarkerType; @@ -86,8 +85,7 @@ namespace ICSharpCode.TextEditor.Document public TextMarker(int offset, int length, TextMarkerType textMarkerType, Color color, Color foreColor) { - if (length < 1) - throw new ArgumentOutOfRangeException("length", length, "length must be >= 1"); + if (length < 1) length = 1; this.offset = offset; this.length = length; this.textMarkerType = textMarkerType; diff --git a/src/Libraries/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs b/src/Libraries/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs index 9220c2d249..1f59febb21 100644 --- a/src/Libraries/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs +++ b/src/Libraries/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs @@ -776,21 +776,44 @@ namespace ICSharpCode.NRefactory.Parser.CSharp } } else { specialTracker.StartComment(CommentType.Block, new Location(Col, Line)); + + // sc* = special comment handling (TO DO markers) + string scTag = null; // is set to non-null value when we are inside a comment marker + StringBuilder scCurWord = new StringBuilder(); // current word, (scTag == null) or comment (when scTag != null) + Location scStartLocation = Location.Empty; + while ((nextChar = ReaderRead()) != -1) { char ch = (char)nextChar; if (HandleLineEnd(ch)) { + if (scTag != null) { + this.TagComments.Add(new TagComment(scTag, scCurWord.ToString(), scStartLocation, new Location(Col, Line))); + scTag = null; + } + scCurWord.Length = 0; specialTracker.AddString(Environment.NewLine); continue; } // End of multiline comment reached ? if (ch == '*' && ReaderPeek() == '/') { + if (scTag != null) { + this.TagComments.Add(new TagComment(scTag, scCurWord.ToString(), scStartLocation, new Location(Col, Line))); + } ReaderRead(); specialTracker.FinishComment(new Location(Col, Line)); return; } specialTracker.AddChar(ch); + if (scTag != null || IsIdentifierPart(ch)) { + scCurWord.Append(ch); + } else { + if (specialCommentHash != null && specialCommentHash.ContainsKey(scCurWord.ToString())) { + scTag = scCurWord.ToString(); + scStartLocation = new Location(Col, Line); + } + scCurWord.Length = 0; + } } specialTracker.FinishComment(new Location(Col, Line)); } diff --git a/src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs b/src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs index 5f76eb7505..63635b747e 100644 --- a/src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs +++ b/src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs @@ -262,6 +262,10 @@ namespace ICSharpCode.SharpDevelop.Project } else { (openSolution.Preferences as IMementoCapable).SetMemento(new Properties()); } + } catch (Exception ex) { + MessageService.ShowError(ex); + } + try { ApplyConfigurationAndReadPreferences(); } catch (Exception ex) { MessageService.ShowError(ex);