diff options
9 files changed, 136 insertions, 16 deletions
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/CSharpFoldingParser.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/CSharpFoldingParser.cs index 798643fd37..8b8da7aa2a 100644 --- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/CSharpFoldingParser.cs +++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/CSharpFoldingParser.cs @@ -52,7 +52,7 @@ namespace MonoDevelop.CSharp.Parser while (ptr < endPtr) { switch (*ptr) { case '/': - if (inString || inChar || inVerbatimString) + if (inString || inChar || inVerbatimString || inMultiLineComment || inSingleComment) break; if (ptr + 1 < endPtr) { char nextCh = *(ptr + 1); @@ -102,11 +102,16 @@ namespace MonoDevelop.CSharp.Parser break; case '\n': if (inSingleComment) { + bool isDocumentation = *beginPtr == '/'; + if (isDocumentation) + beginPtr++; + result.Add (new MonoDevelop.TypeSystem.Comment () { Region = new DomRegion (startLoc, new TextLocation (line, column)), CommentType = CommentType.SingleLine, Text = content.Substring ((int)(beginPtr - startPtr), (int)(ptr - beginPtr)), - CommentStartsLine = hasStartedAtLine + CommentStartsLine = hasStartedAtLine, + IsDocumentation = isDocumentation }); inSingleComment = false; } diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/McsParser.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/McsParser.cs index 92d9a33f65..545a2b199c 100644 --- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/McsParser.cs +++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/McsParser.cs @@ -49,6 +49,9 @@ namespace MonoDevelop.CSharp.Parser public override IResolver CreateResolver (ProjectDom dom, object editor, string fileName) { MonoDevelop.Ide.Gui.Document doc = (MonoDevelop.Ide.Gui.Document)editor; + if (doc.Editor == null) + return null; + return new NRefactoryResolver (dom, doc.CompilationUnit, ICSharpCode.OldNRefactory.SupportedLanguage.CSharp, doc.Editor, fileName); } diff --git a/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/VariableValueReference.cs b/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/VariableValueReference.cs index eee0e7a825..63f591eb56 100644 --- a/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/VariableValueReference.cs +++ b/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/VariableValueReference.cs @@ -67,10 +67,7 @@ namespace Mono.Debugging.Soft try { return ctx.Frame.GetValue (variable); } catch (AbsentInformationException) { - if (((SoftDebuggerSession) ctx.Session).IsExternalCode (ctx.Frame)) - throw new EvaluatorException ("Value not available"); - - throw; + throw new EvaluatorException ("Value not available"); } } set { diff --git a/main/src/addins/MonoDevelop.MacDev/ObjCIntegration/NSObjectProjectInfo.cs b/main/src/addins/MonoDevelop.MacDev/ObjCIntegration/NSObjectProjectInfo.cs index 4155d2493f..6e6c3983cd 100755 --- a/main/src/addins/MonoDevelop.MacDev/ObjCIntegration/NSObjectProjectInfo.cs +++ b/main/src/addins/MonoDevelop.MacDev/ObjCIntegration/NSObjectProjectInfo.cs @@ -262,7 +262,7 @@ namespace MonoDevelop.MacDev.ObjCIntegration type.BaseCliType = dom.Compilation.LookupType (defaultNamespace, provider.CreateValidIdentifier (type.BaseObjCType)).FullName; var message = string.Format ("Failed to resolve Objective-C type '{0}' to a type in the current solution.", type.BaseObjCType); - message += string.Format (" If the type '{0}' exists, adding a [Register] attribute to the type will allow it to be synced correctly. Alternatively adding a [Register (\"{0}\")] attribute to any type will allow that type to be used while syncing.", type.BaseObjCType); + message += string.Format (" Adding a [Register (\"{0}\")] attribute to the class which corresponds to this will allow it to be synced to Objective-C.", type.BaseObjCType); monitor.ReportError (null, new UserException ("Error while syncing", message)); } } @@ -278,7 +278,7 @@ namespace MonoDevelop.MacDev.ObjCIntegration outlet.CliType = defaultNamespace + "." + provider.CreateValidIdentifier (outlet.ObjCType); var message = string.Format ("Failed to resolve Objective-C outlet '{0}' of type '{1}' to a type in the current solution.", outlet.ObjCName, outlet.ObjCType); - message += string.Format (" If the type '{0}' exists, adding a [Register] attribute to the type will allow it to be synced correctly. Alternatively adding a [Register (\"{0}\")] attribute to any type will allow that type to be used while syncing.", outlet.ObjCType); + message += string.Format (" Adding a [Register (\"{0}\")] attribute to the class which corresponds to this will allow it to be synced to Objective-C.", outlet.ObjCType); monitor.ReportError (null, new UserException ("Error while syncing", message)); } } @@ -295,7 +295,7 @@ namespace MonoDevelop.MacDev.ObjCIntegration param.CliType = defaultNamespace + "." + provider.CreateValidIdentifier (param.ObjCType); var message = string.Format ("Failed to resolve paramater '{0}' of type '{2}' on Objective-C action '{1}' to a type in the current solution.", param.Name, action.ObjCName, param.ObjCType); - message += string.Format (" If the type '{0}' exists, adding a [Register] attribute to the type will allow it to be synced correctly. Alternatively adding a [Register (\"{0}\")] attribute to any type will allow that type to be used while syncing.", param.ObjCType); + message += string.Format (" Adding a [Register (\"{0}\")] attribute to the class which corresponds to this will allow it to be synced to Objective-C.", param.ObjCType); monitor.ReportError (null, new UserException ("Error while syncing", message)); } } diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/RepositoryStatus.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/RepositoryStatus.cs index 32beb5b029..4aada9f2a3 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/RepositoryStatus.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/RepositoryStatus.cs @@ -50,6 +50,48 @@ using NGit.Treewalk.Filter; namespace MonoDevelop.VersionControl.Git { + class SpecificStatus : NGit.Api.StatusCommand + { + WorkingTreeIterator iter; + IEnumerable<string> Files { + get; set; + } + + public SpecificStatus (NGit.Repository repository) + : base (repository) + { + } + + public SpecificStatus (NGit.Repository repository, IEnumerable<string> files) + : base (repository) + { + Files = files; + } + + public override void SetWorkingTreeIt (WorkingTreeIterator workingTreeIt) + { + iter = workingTreeIt; + } + + public override NGit.Api.Status Call () + { + if (iter == null) + iter = new FileTreeIterator(repo); + + IndexDiff diff = new IndexDiff(repo, Constants.HEAD, iter); + if (Files != null) { + var filters = Files.Select (PathFilter.Create).ToArray (); + if (filters.Length > 1) + diff.SetFilter (OrTreeFilter.Create (filters)); + else + diff.SetFilter (filters [0]); + } + + diff.Diff (); + return new NGit.Api.Status(diff); + } + } + public class RepositoryStatus { private string _root_path; @@ -133,12 +175,38 @@ namespace MonoDevelop.VersionControl.Git MergeConflict = new HashSet<string>(); if (_file_paths != null) - UpdateDirectory (_file_paths, false); + UpdateSingleFiles (_file_paths.ToList ()); else if (_recursive) UpdateDirectory (new string[] { _root_path }, true); else UpdateDirectory (new string[] { _root_path }, false); } + + void UpdateSingleFiles (List<string> singleFiles) + { + var status = new SpecificStatus (Repository, singleFiles).Call (); + + foreach (var v in status.GetAdded ()) + Added.Add (v); + + foreach (var v in status.GetChanged ()) + Modified.Add (v); + + foreach (var v in status.GetConflicting ()) + MergeConflict.Add (v); + + foreach (var v in status.GetMissing ()) + Missing.Add (v); + + foreach (var v in status.GetModified ()) + Modified.Add (v); + + foreach (var v in status.GetRemoved ()) + Removed.Add (v); + + foreach (var v in status.GetUntracked ()) + Untracked.Add (v); + } /// <summary> /// Run the diff operation. Until this is called, all lists will be empty @@ -152,7 +220,7 @@ namespace MonoDevelop.VersionControl.Git TreeWalk treeWalk = new TreeWalk (Repository); treeWalk.Reset (); - treeWalk.Recursive = false; + treeWalk.Recursive = recursive; if (commit != null) treeWalk.AddTree (commit.Tree); diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Document.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Document.cs index 7b6b8c84a7..d01e79ab50 100644 --- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Document.cs +++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Document.cs @@ -995,6 +995,7 @@ namespace Mono.TextEditor var newSegments = (List<FoldSegment>)e.Argument; var oldSegments = new List<FoldSegment> (FoldSegments); int oldIndex = 0; + bool foldedSegmentAdded = false; newSegments.Sort (); var newFoldedSegments = new HashSet<FoldSegment> (); foreach (FoldSegment newFoldSegment in newSegments) { @@ -1013,8 +1014,10 @@ namespace Mono.TextEditor curSegment.EndColumn = curSegment.EndOffset - curSegment.EndLine.Offset + 1; curSegment.Column = offset - curSegment.StartLine.Offset + 1; - if (newFoldSegment.IsFolded) + if (newFoldSegment.IsFolded) { + foldedSegmentAdded |= !curSegment.IsFolded; curSegment.isFolded = true; + } if (curSegment.isFolded) newFoldedSegments.Add (curSegment); oldIndex++; @@ -1024,6 +1027,7 @@ namespace Mono.TextEditor newFoldSegment.EndColumn = newFoldSegment.EndOffset - endLine.Offset + 1; newFoldSegment.Column = offset - startLine.Offset + 1; newFoldSegment.isAttached = true; + foldedSegmentAdded |= newFoldSegment.IsFolded; if (oldIndex < oldSegments.Count && newFoldSegment.Length == oldSegments [oldIndex].Length) { newFoldSegment.isFolded = oldSegments [oldIndex].IsFolded; } @@ -1036,17 +1040,19 @@ namespace Mono.TextEditor RemoveFolding (oldSegments [oldIndex]); oldIndex++; } + bool countChanged = foldedSegments.Count != newFoldedSegments.Count; if (worker != null) { Gtk.Application.Invoke (delegate { - bool countChanged = foldedSegments.Count != newFoldedSegments.Count; foldedSegments = newFoldedSegments; InformFoldTreeUpdated (); - if (countChanged) + if (foldedSegmentAdded || countChanged) CommitUpdateAll (); }); } else { foldedSegments = newFoldedSegments; InformFoldTreeUpdated (); + if (foldedSegmentAdded || countChanged) + CommitUpdateAll (); } } diff --git a/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.FindInFiles.FindInFilesDialog.cs b/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.FindInFiles.FindInFilesDialog.cs index fbe36dd14c..d41cd934db 100644 --- a/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.FindInFiles.FindInFilesDialog.cs +++ b/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.FindInFiles.FindInFilesDialog.cs @@ -54,6 +54,7 @@ namespace MonoDevelop.Ide.FindInFiles this.toggleFindInFiles.TooltipMarkup = "Switch to Find in Files"; this.toggleFindInFiles.CanFocus = true; this.toggleFindInFiles.Name = "toggleFindInFiles"; + this.toggleFindInFiles.Active = true; this.toggleFindInFiles.DrawIndicator = false; this.toggleFindInFiles.UseUnderline = true; this.toggleFindInFiles.Relief = ((global::Gtk.ReliefStyle)(2)); diff --git a/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Gui.Dialogs.TipOfTheDayWindow.cs b/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Gui.Dialogs.TipOfTheDayWindow.cs index 890fbc07a9..5bc366d997 100644 --- a/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Gui.Dialogs.TipOfTheDayWindow.cs +++ b/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Gui.Dialogs.TipOfTheDayWindow.cs @@ -100,7 +100,6 @@ namespace MonoDevelop.Ide.Gui.Dialogs w7.Fill = false; // Container child hbox5.Gtk.Box+BoxChild this.hbuttonbox1 = new global::Gtk.HButtonBox (); - this.hbuttonbox1.Name = "hbuttonbox1"; this.hbuttonbox1.Spacing = 10; this.hbuttonbox1.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4)); // Container child hbuttonbox1.Gtk.ButtonBox+ButtonBoxChild diff --git a/main/tests/UnitTests/MonoDevelop.CSharpBinding/FoldingParserTests.cs b/main/tests/UnitTests/MonoDevelop.CSharpBinding/FoldingParserTests.cs index f73e254ad6..7dcc0d5f01 100644 --- a/main/tests/UnitTests/MonoDevelop.CSharpBinding/FoldingParserTests.cs +++ b/main/tests/UnitTests/MonoDevelop.CSharpBinding/FoldingParserTests.cs @@ -40,7 +40,7 @@ namespace MonoDevelop.CSharpBinding.Tests [TestFixture] public class FoldingParserTests { - static void Test (string code) + static ParsedDocument Test (string code) { var parser = new CSharpFoldingParser (); var sb = new StringBuilder (); @@ -78,6 +78,7 @@ namespace MonoDevelop.CSharpBinding.Tests foreach (var generated in generatedFoldings) { Assert.IsTrue (foldingList.Any (f => f == generated.Region), "fold not found:" + generated.Region); } + return doc; } [Test] @@ -154,6 +155,46 @@ using System;"); }"); } + + [Test] + public void TestDocComment () + { + var doc = Test (@"class Test +{ + [/// <summary> + /// Test + /// </summary>] + void FooBar () + { + } +}"); + foreach (var cmt in doc.Comments) + Assert.IsTrue (cmt.IsDocumentation); + } + + + [Test] + public void TestNestedSingeLineComment () + { + Test (@"[/* + +// Comment + +*/]"); + } + + + + [Test] + public void TestNestedMultiLineComment () + { + Test (@"[/* + +/* + +*/]"); + } + } } |