diff options
author | Vsevolod Kukol <sevoku@xamarin.com> | 2016-02-02 10:24:41 +0300 |
---|---|---|
committer | Vsevolod Kukol <sevoku@xamarin.com> | 2016-02-02 10:24:41 +0300 |
commit | a30ac906e16d28a90fdddf6757f23a0847230918 (patch) | |
tree | bc611f385591f3a6db90c74914a6e64daa923994 | |
parent | 31cd8ade0652b41b726cdc5ad5a6971a9176848d (diff) | |
parent | 610c7a3b54777e74c505a786606b1942abebe1aa (diff) |
Merge remote-tracking branch 'origin/master' into roslyn-dark-skin
27 files changed, 183 insertions, 108 deletions
diff --git a/.gitmodules b/.gitmodules index 9597b87b04..0cc72f900c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -45,14 +45,14 @@ [submodule "main/external/libgit2sharp"] path = main/external/libgit2sharp url = git://github.com/mono/libgit2sharp.git - branch = xs-5.10-v2 + branch = xs-6.0-v1 [submodule "main/external/libgit-binary"] path = main/external/libgit-binary url = git://github.com/mono/libgit-binary.git [submodule "main/external/libgit2"] path = main/external/libgit2 url = git://github.com/mono/libgit2.git - branch = xs-5.10-v2 + branch = xs-6.0-v1 [submodule "main/external/RefactoringEssentials"] path = main/external/RefactoringEssentials url = git://github.com/icsharpcode/RefactoringEssentials.git diff --git a/main/Makefile.include b/main/Makefile.include index ce61385fb8..8d0cec7599 100644 --- a/main/Makefile.include +++ b/main/Makefile.include @@ -11,6 +11,6 @@ MD_BIN_PATH=$(abs_top_builddir)/build/bin MD_LAUNCH_SETUP= \ MONODEVELOP_LOCALE_PATH="$(abs_top_builddir)/build/locale" \ - MONODEVELOP_TEST_PROFILE="$(MD_BIN_PATH)/test-profile" + MONODEVELOP_PROFILE="$(MD_BIN_PATH)/test-profile" MDTOOL_RUN=$(MD_LAUNCH_SETUP) exec -a "mdtool" $(RUNTIME)$(SGEN_SUFFIX) --debug "$(MD_BIN_PATH)/mdtool.exe" diff --git a/main/external/RefactoringEssentials b/main/external/RefactoringEssentials -Subproject e33da299b46d9fb5c650dea2aec3d3e3af7500d +Subproject f53f4091514104936eaf472b95ee2aa210854ad diff --git a/main/external/debugger-libs b/main/external/debugger-libs -Subproject fc339ef4b095026ae8d05f8ac32bf2fc385dccd +Subproject dd327bd2bdc85a96333a8ff72a12d9ca977f69f diff --git a/main/external/fsharpbinding b/main/external/fsharpbinding -Subproject 1963ad92fcf790a55eaaf988df675d18766f0f6 +Subproject 0888ab6a530c9f51576f7a18e9653c1445412b4 diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/OnTheFlyFormatter.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/OnTheFlyFormatter.cs index 146dcd4ba9..3331393f78 100644 --- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/OnTheFlyFormatter.cs +++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/OnTheFlyFormatter.cs @@ -38,8 +38,8 @@ using Microsoft.CodeAnalysis.Formatting; using Microsoft.CodeAnalysis.Text; using MonoDevelop.Ide.Gui.Content; using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.Options;
-
+using Microsoft.CodeAnalysis.Options; + namespace MonoDevelop.CSharp.Formatting { static class OnTheFlyFormatter @@ -47,18 +47,8 @@ namespace MonoDevelop.CSharp.Formatting public static void Format (TextEditor editor, DocumentContext context) { Format (editor, context, 0, editor.Length); - }
-
- // public static void Format (TextEditor editor, DocumentContext context, TextLocation location)
- // {
- // Format (editor, context, location, location, false);
- // }
- //
- // public static void Format (TextEditor editor, DocumentContext context, TextLocation startLocation, TextLocation endLocation, bool exact = true)
- // {
- // Format (editor, context, editor.LocationToOffset (startLocation), editor.LocationToOffset (endLocation), exact);
- // }
-
+ } + public static void Format (TextEditor editor, DocumentContext context, int startOffset, int endOffset, bool exact = true, OptionSet optionSet = null) { var policyParent = context.Project != null ? context.Project.Policies : PolicyService.DefaultPolicies; @@ -126,8 +116,11 @@ namespace MonoDevelop.CSharp.Formatting var caretEndOffset = caretOffset + delta; if (0 <= caretEndOffset && caretEndOffset < editor.Length) editor.CaretOffset = caretEndOffset; - if (editor.CaretColumn == 1) + if (editor.CaretColumn == 1) { + if (editor.CaretLine > 1 && editor.GetLine (editor.CaretLine - 1).Length == 0) + editor.CaretLine--; editor.CaretColumn = editor.GetVirtualIndentationColumn (editor.CaretLine); + } } catch (Exception e) { LoggingService.LogError ("Error in on the fly formatter", e); } diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/SignatureMarkupCreator.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/SignatureMarkupCreator.cs index 22518d54fc..122877d6ef 100644 --- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/SignatureMarkupCreator.cs +++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/SignatureMarkupCreator.cs @@ -1067,6 +1067,9 @@ namespace MonoDevelop.CSharp result.SummaryMarkup = "A " + Highlight ("delegate", colorStyle.KeywordDeclaration) + " declaration defines a reference type that can be used to encapsulate a method with a specific signature."; break; case SyntaxKind.IdentifierToken: + if (node.ToFullString () == "nameof" && node.Parent?.Parent?.Kind () == SyntaxKind.InvocationExpression) + goto case SyntaxKind.NameOfKeyword; + if (node.ToFullString () == "dynamic") { result.SignatureMarkup = Highlight ("dynamic", colorStyle.KeywordContext) + keywordSign; result.SummaryMarkup = "The " + Highlight ("dynamic", colorStyle.KeywordContext) + " type allows for an object to bypass compile-time type checking and resolve type checking during run-time."; @@ -1470,6 +1473,11 @@ namespace MonoDevelop.CSharp result.AddCategory ("Form", Highlight ("while", colorStyle.KeywordIteration) + " (expression) statement"); result.SummaryMarkup = "The " + Highlight ("while", colorStyle.KeywordIteration) + " statement executes a statement or a block of statements until a specified expression evaluates to false. "; break; + case SyntaxKind.NameOfKeyword: + result.SignatureMarkup = Highlight ("nameof", colorStyle.KeywordDeclaration) + keywordSign; + result.AddCategory ("Form", Highlight ("nameof", colorStyle.KeywordDeclaration) + "(identifier)"); + result.SummaryMarkup = "Used to obtain the simple (unqualified) string name of a variable, type, or member."; + break; default: return null; } diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BusyEvaluatorDialog.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BusyEvaluatorDialog.cs index d82779bcbc..48bdacad81 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BusyEvaluatorDialog.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BusyEvaluatorDialog.cs @@ -26,27 +26,46 @@ using System; using Mono.Debugging.Client; +using MonoDevelop.Ide; namespace MonoDevelop.Debugger { - public partial class BusyEvaluatorDialog : Gtk.Dialog + class BusyEvaluator { - public BusyEvaluatorDialog () - { - this.Build (); - //Prevent closing dialog via X button, user can either wait with - //dialog open or press "Stop Debugger" button - DeleteEvent += (o, args) => args.RetVal = true; + public BusyEvaluatorDialog Dialog { + get; + private set; } public void UpdateBusyState (BusyStateEventArgs args) { if (!args.IsBusy) { - Hide (); + if (Dialog != null) {
+ Dialog.Destroy ();
+ Dialog.Dispose ();
+ Dialog = null; + } } else { - Show (); + if (Dialog == null) + Dialog = new BusyEvaluatorDialog (); + + Dialog.Show (); } } + } + + public partial class BusyEvaluatorDialog : Gtk.Dialog + { + public BusyEvaluatorDialog () + { + this.Build (); + //Prevent closing dialog via X button, user can either wait with + //dialog open or press "Stop Debugger" button + DeleteEvent += (o, args) => args.RetVal = true; + Modal = true; + TransientFor = MessageService.RootWindow; + DestroyWithParent = true; + } protected virtual void OnButtonCancelClicked (object sender, System.EventArgs e) { diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs index c2c4d28767..f53884d81c 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs @@ -73,7 +73,7 @@ namespace MonoDevelop.Debugger static ExceptionCaughtMessage exceptionDialog; - static BusyEvaluatorDialog busyDialog; + static BusyEvaluator busyEvaluator; static StatusBarIcon busyStatusIcon; static bool isBusy; @@ -100,10 +100,7 @@ namespace MonoDevelop.Debugger IdeApp.Workspace.StoringUserPreferences += OnStoreUserPrefs; IdeApp.Workspace.LoadingUserPreferences += OnLoadUserPrefs; IdeApp.Workspace.LastWorkspaceItemClosed += OnSolutionClosed; - busyDialog = new BusyEvaluatorDialog (); - busyDialog.Modal = true; - busyDialog.TransientFor = MessageService.RootWindow; - busyDialog.DestroyWithParent = true; + busyEvaluator = new BusyEvaluator (); }; AddinManager.AddExtensionNodeHandler (FactoriesPath, delegate { // Refresh the engines list @@ -702,33 +699,37 @@ namespace MonoDevelop.Debugger } } - static void OnBusyStateChanged (object s, BusyStateEventArgs args) + static async void OnBusyStateChanged (object s, BusyStateEventArgs args) { isBusy = args.IsBusy; - Runtime.RunInMainThread (delegate { - busyDialog.UpdateBusyState (args); + await Runtime.RunInMainThread (delegate { + busyEvaluator.UpdateBusyState (args); if (args.IsBusy) { if (busyStatusIcon == null) { busyStatusIcon = IdeApp.Workbench.StatusBar.ShowStatusIcon (ImageService.GetIcon ("md-bug", Gtk.IconSize.Menu)); busyStatusIcon.SetAlertMode (100); busyStatusIcon.ToolTip = GettextCatalog.GetString ("The debugger runtime is not responding. You can wait for it to recover, or stop debugging."); - busyStatusIcon.Clicked += delegate { - MessageService.PlaceDialog (busyDialog, MessageService.RootWindow); - }; + busyStatusIcon.Clicked += OnBusyStatusIconClicked; } } else { if (busyStatusIcon != null) { + busyStatusIcon.Clicked -= OnBusyStatusIconClicked; busyStatusIcon.Dispose (); busyStatusIcon = null; } } }); } + + static void OnBusyStatusIconClicked (object sender, StatusBarIconClickedEventArgs args) + { + MessageService.PlaceDialog (busyEvaluator.Dialog, MessageService.RootWindow); + } static bool CheckIsBusy () { - if (isBusy && !busyDialog.Visible) - MessageService.PlaceDialog (busyDialog, MessageService.RootWindow); + if (isBusy && !busyEvaluator.Dialog.Visible) + MessageService.PlaceDialog (busyEvaluator.Dialog, MessageService.RootWindow); return isBusy; } diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Commands/PackageManagementStartupHandler.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Commands/PackageManagementStartupHandler.cs index 60e1ecefc1..77df65b596 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Commands/PackageManagementStartupHandler.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Commands/PackageManagementStartupHandler.cs @@ -96,6 +96,7 @@ namespace MonoDevelop.PackageManagement.Commands if (checkUpdatesAfterRestore && !restorer.RestoreFailed) {
CheckForUpdates ();
}
+ restorer = null;
});
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Commands/RestorePackagesInProjectHandler.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Commands/RestorePackagesInProjectHandler.cs index d130b4b906..115dd49a54 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Commands/RestorePackagesInProjectHandler.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Commands/RestorePackagesInProjectHandler.cs @@ -42,6 +42,8 @@ namespace MonoDevelop.PackageManagement.Commands var runner = new PackageRestoreRunner ();
PackageManagementBackgroundDispatcher.Dispatch (() => {
runner.Run (project, progressMessage);
+ runner = null;
+ project = null;
});
}
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/CheckForUpdatesTask.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/CheckForUpdatesTask.cs index e6456eec52..0ea3a6eb1b 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/CheckForUpdatesTask.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/CheckForUpdatesTask.cs @@ -61,15 +61,18 @@ namespace MonoDevelop.PackageManagement projectsWithUpdatedPackages.Add (updatedPackages);
}
}
+
+ projects.Clear ();
+
+ if (disposed) {
+ projectsWithUpdatedPackages.Clear ();
+ }
}
public void CheckForUpdatesCompleted ()
{
- updatedPackagesInSolution.CheckForUpdatesCompleted (this);
- }
-
- public IEnumerable<UpdatedPackagesInProject> ProjectsWithUpdatedPackages {
- get { return projectsWithUpdatedPackages; }
+ updatedPackagesInSolution.CheckForUpdatesCompleted (projectsWithUpdatedPackages);
+ projectsWithUpdatedPackages.Clear ();
}
public void Dispose ()
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UpdatedPackagesInSolution.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UpdatedPackagesInSolution.cs index 3ced778ce4..5bf8214085 100644 --- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UpdatedPackagesInSolution.cs +++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/UpdatedPackagesInSolution.cs @@ -132,9 +132,9 @@ namespace MonoDevelop.PackageManagement });
}
- public void CheckForUpdatesCompleted (CheckForUpdatesTask task)
+ public void CheckForUpdatesCompleted (IEnumerable<UpdatedPackagesInProject> projects)
{
- projectsWithUpdatedPackages = task.ProjectsWithUpdatedPackages.ToList ();
+ projectsWithUpdatedPackages = projects.ToList ();
RemovePackagesUpdatedDuringCheckForUpdates ();
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskStrip.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskStrip.cs index 2df99c72bd..c750bf49d0 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskStrip.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskStrip.cs @@ -208,7 +208,7 @@ namespace MonoDevelop.SourceEditor.QuickTasks protected override bool OnButtonPressEvent (EventButton evnt) { if (evnt.Button == 3) { - IdeApp.CommandService.ShowContextMenu (this, evnt, "/MonoDevelop/SourceEditor2/ContextMenu/Scrollbar"); + IdeApp.CommandService.ShowContextMenu (this, evnt, IdeApp.CommandService.CreateCommandEntrySet ("/MonoDevelop/SourceEditor2/ContextMenu/Scrollbar"), this); } return base.OnButtonPressEvent (evnt); } diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Wrappers/SemanticHighlightingSyntaxMode.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Wrappers/SemanticHighlightingSyntaxMode.cs index 911e648cc7..47ec20530c 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Wrappers/SemanticHighlightingSyntaxMode.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Wrappers/SemanticHighlightingSyntaxMode.cs @@ -90,6 +90,7 @@ namespace MonoDevelop.SourceEditor.Wrappers } } + bool isDisposed; Queue<Tuple<DocumentLine, HighlightingSegmentTree>> lineSegments = new Queue<Tuple<DocumentLine, HighlightingSegmentTree>> (); public SemanticHighlightingSyntaxMode (ExtensibleTextEditor editor, ISyntaxMode syntaxMode, SemanticHighlighting semanticHighlighting) @@ -108,6 +109,8 @@ namespace MonoDevelop.SourceEditor.Wrappers public void UpdateSemanticHighlighting (SemanticHighlighting newHighlighting) { + if (isDisposed) + return; if (semanticHighlighting !=null) semanticHighlighting.SemanticHighlightingUpdated -= SemanticHighlighting_SemanticHighlightingUpdated; semanticHighlighting = newHighlighting; @@ -118,12 +121,14 @@ namespace MonoDevelop.SourceEditor.Wrappers void SemanticHighlighting_SemanticHighlightingUpdated (object sender, EventArgs e) { Application.Invoke (delegate { - if (lineSegments == null) + if (isDisposed) return; UnregisterLineSegmentTrees (); lineSegments.Clear (); var margin = editor.TextViewMargin; + if (margin == null) + return; margin.PurgeLayoutCache (); editor.QueueDraw (); }); @@ -131,7 +136,7 @@ namespace MonoDevelop.SourceEditor.Wrappers void UnregisterLineSegmentTrees () { - if (lineSegments == null) + if (isDisposed) return; foreach (var kv in lineSegments) { try { @@ -143,8 +148,9 @@ namespace MonoDevelop.SourceEditor.Wrappers public void Dispose() { - if (lineSegments == null) + if (isDisposed) return; + isDisposed = true; UnregisterLineSegmentTrees (); lineSegments = null; semanticHighlighting.SemanticHighlightingUpdated -= SemanticHighlighting_SemanticHighlightingUpdated; diff --git a/main/src/addins/NUnit/NUnitRunner/NUnitTestRunner.cs b/main/src/addins/NUnit/NUnitRunner/NUnitTestRunner.cs index 8602b52b56..1c819770d9 100644 --- a/main/src/addins/NUnit/NUnitRunner/NUnitTestRunner.cs +++ b/main/src/addins/NUnit/NUnitRunner/NUnitTestRunner.cs @@ -113,17 +113,21 @@ namespace MonoDevelop.NUnit.External return BuildTestInfo (rootTS); } - NunitTestInfo BuildTestInfo (Test test) + internal NunitTestInfo BuildTestInfo (Test test) { NunitTestInfo ti = new NunitTestInfo (); // The name of inherited tests include the base class name as prefix. // That prefix has to be removed string tname = test.TestName.Name; // Find the last index of the dot character that is not a part of the test parameters - int j = tname.IndexOf ('('); - int i = tname.LastIndexOf ('.', (j == -1) ? (tname.Length - 1) : j); - if (i != -1) - tname = tname.Substring (i + 1); + // Parameterized methods can contain '.' as class name & they don't seem to prefix base class name, so it's safe to skip them + if (!(test.Parent is ParameterizedMethodSuite)) { + int j = tname.IndexOf ('('); + int i = tname.LastIndexOf ('.', (j == -1) ? (tname.Length - 1) : j); + if (i != -1) + tname = tname.Substring (i + 1); + } + if (test.FixtureType != null) { ti.FixtureTypeName = test.FixtureType.Name; ti.FixtureTypeNamespace = test.FixtureType.Namespace; diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Actions/DeleteActions.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Actions/DeleteActions.cs index f681fbb8b5..a7dcf62aaa 100644 --- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Actions/DeleteActions.cs +++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Actions/DeleteActions.cs @@ -197,6 +197,8 @@ namespace Mono.TextEditor { if (!data.CanEditSelection) return; + DocumentLine line; + bool smartBackspace = false; using (var undo = data.OpenUndoGroup ()) { if (data.IsSomethingSelected) { var visualAnchorLocation = data.LogicalToVisualLocation (data.MainSelection.Anchor); @@ -238,29 +240,17 @@ namespace Mono.TextEditor // if it's there or not (otherwise user has to press multiple backspaces in some cases) data.EnsureCaretIsNotVirtual (); - var line = data.Document.GetLine (data.Caret.Line); + line = data.Document.GetLine (data.Caret.Line); // smart backspace (delete indentation) if (data.HasIndentationTracker && (data.IndentationTracker.SupportedFeatures & IndentatitonTrackerFeatures.SmartBackspace) != 0 && (data.Options.IndentStyle == IndentStyle.Smart || data.Options.IndentStyle == IndentStyle.Virtual)) { if (data.Caret.Column == data.GetVirtualIndentationColumn (data.Caret.Location)) { bool isAllIndent = line.GetIndentation (data.Document).Length == data.Caret.Column - 1; - if (isAllIndent) { - var prevLine = line.PreviousLine; - var prevLineIsEmpty = prevLine != null && prevLine.Length == 0; - - var startOffset = prevLine != null ? prevLine.EndOffset : 0; - data.Remove (startOffset, data.Caret.Offset - startOffset); - if (prevLine != null) { - if (prevLineIsEmpty) { - if (line.Length - data.Caret.Column - 1 > 0 && data.HasIndentationTracker) { - data.InsertAtCaret (data.IndentationTracker.GetIndentationString (data.Caret.Offset)); - } else { - data.Caret.Column = data.GetVirtualIndentationColumn (prevLine.Offset); - } - } - data.FixVirtualIndentation (); + if (!data.Options.GenerateFormattingUndoStep) { + SmartBackspace (data, line); + return; } - return; + smartBackspace = true; } } } @@ -283,8 +273,34 @@ namespace Mono.TextEditor // Needs to be fixed after, the line may just contain the indentation data.FixVirtualIndentation (); } + + if (data.Options.GenerateFormattingUndoStep && smartBackspace) { + using (var undo = data.OpenUndoGroup ()) { + data.EnsureCaretIsNotVirtual (); + SmartBackspace (data, line); + } + } } - + + static void SmartBackspace (TextEditorData data, DocumentLine line) + { + var prevLine = line.PreviousLine; + var prevLineIsEmpty = prevLine != null && prevLine.Length == 0; + + var startOffset = prevLine != null ? prevLine.EndOffset : 0; + data.Remove (startOffset, data.Caret.Offset - startOffset); + if (prevLine != null) { + if (prevLineIsEmpty) { + if (line.Length - data.Caret.Column - 1 > 0 && data.HasIndentationTracker) { + data.InsertAtCaret (data.IndentationTracker.GetIndentationString (data.Caret.Offset)); + } else { + data.Caret.Column = data.GetVirtualIndentationColumn (prevLine.Offset); + } + } + data.FixVirtualIndentation (); + } + } + static void RemoveCharBeforeCaret (TextEditorData data) { int offset = data.Caret.Offset; diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/TargetFramework.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/TargetFramework.cs index 19224ce865..0482e38480 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/TargetFramework.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/TargetFramework.cs @@ -299,6 +299,8 @@ namespace MonoDevelop.Core.Assemblies break; case "4.5": case "4.5.1": + // PCL 4.6 uses 4.6 as the "Rutime version", not sure why, since it has nothing to do with .NET 4.6 + case "4.6": fx.clrVersion = ClrVersion.Net_4_5; break; default: diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/MonoDevelop-templates.xml b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/MonoDevelop-templates.xml index 911fd48dcb..1b3ab54445 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/MonoDevelop-templates.xml +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/MonoDevelop-templates.xml @@ -878,9 +878,9 @@ $selected$$end$ </Variable> </Variables> <Code><![CDATA[try { - $selected$ + $selected$$end$ } catch ($SystemException$ ex) { - $end$ + }]]></Code> </CodeTemplate> diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs index 4dd64fc720..c8d5a72005 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs @@ -773,6 +773,13 @@ namespace MonoDevelop.Ide.Gui } uint parseTimeout = 0; + CancellationTokenSource analysisDocumentSrc = new CancellationTokenSource (); + + void CancelEnsureAnalysisDocumentIsOpen () + { + analysisDocumentSrc.Cancel (); + analysisDocumentSrc = new CancellationTokenSource (); + } Task EnsureAnalysisDocumentIsOpen () { @@ -789,7 +796,9 @@ namespace MonoDevelop.Ide.Gui TypeSystemService.InformDocumentOpen (analysisDocument, Editor); } } else { + CancelEnsureAnalysisDocumentIsOpen (); lock (adhocProjectLock) { + var token = analysisDocumentSrc.Token; if (adhocProject != null) { return SpecializedTasks.EmptyTask; } @@ -814,9 +823,11 @@ namespace MonoDevelop.Ide.Gui adhocSolution = new Solution (); adhocSolution.AddConfiguration ("", true); adhocSolution.DefaultSolutionFolder.AddItem (newProject); - return TypeSystemService.Load (adhocSolution, new ProgressMonitor ()).ContinueWith (task => { + return TypeSystemService.Load (adhocSolution, new ProgressMonitor (), token).ContinueWith (task => { + if (token.IsCancellationRequested) + return; RoslynWorkspace = task.Result.FirstOrDefault(); // 1 solution loaded ->1 workspace as result - analysisDocument = TypeSystemService.GetDocumentId (RoslynWorkspace, adhocProject, adHocFile); + analysisDocument = TypeSystemService.GetDocumentId (RoslynWorkspace, newProject, adHocFile); TypeSystemService.InformDocumentOpen (RoslynWorkspace, analysisDocument, Editor); }); } @@ -834,6 +845,7 @@ namespace MonoDevelop.Ide.Gui void UnloadAdhocProject () { + CancelEnsureAnalysisDocumentIsOpen (); lock (adhocProjectLock) { if (adhocProject == null) return; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs index 90a2194f9e..44abef3f28 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs @@ -218,13 +218,12 @@ namespace MonoDevelop.Ide.TypeSystem return solutionInfo; } - public Task<SolutionInfo> TryLoadSolution (MonoDevelop.Projects.Solution solution/*, IProgressMonitor progressMonitor*/) + public Task<SolutionInfo> TryLoadSolution (MonoDevelop.Projects.Solution solution, CancellationToken cancellationToken = default(CancellationToken)) { this.currentMonoDevelopSolution = solution; - CancelLoad (); - return CreateSolutionInfo (solution, src.Token); + return CreateSolutionInfo (solution, cancellationToken); } - + public void UnloadSolution () { OnSolutionRemoved (); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs index ca27e4c372..3ae504505a 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs @@ -76,6 +76,7 @@ namespace MonoDevelop.Ide.TypeSystem static TypeSystemService () { + CleanupCache (); parsers = AddinManager.GetExtensionNodes<TypeSystemParserNode> ("/MonoDevelop/TypeSystem/Parser"); bool initialLoad = true; AddinManager.AddExtensionNodeHandler ("/MonoDevelop/TypeSystem/Parser", delegate (object sender, ExtensionNodeEventArgs args) { @@ -515,7 +516,7 @@ namespace MonoDevelop.Ide.TypeSystem static IEnumerable<string> GetPossibleCacheDirNames (string baseName) { int i = 0; - while (i < 4096) { + while (i < 999999) { yield return Path.Combine (baseName, i.ToString ()); i++; } @@ -598,24 +599,30 @@ namespace MonoDevelop.Ide.TypeSystem static void CleanupCache () { string derivedDataPath = UserProfile.Current.CacheDir.Combine ("DerivedData"); - string[] subDirs; + string[] cacheDirectories; try { if (!Directory.Exists (derivedDataPath)) return; - subDirs = Directory.GetDirectories (derivedDataPath); + cacheDirectories = Directory.GetDirectories (derivedDataPath); } catch (Exception e) { LoggingService.LogError ("Error while getting derived data directories.", e); return; } - - foreach (var subDir in subDirs) { + var now = DateTime.Now; + foreach (var cacheDirectory in cacheDirectories) { try { - var days = Math.Abs ((DateTime.Now - Directory.GetLastWriteTime (subDir)).TotalDays); - if (days > 30) - Directory.Delete (subDir, true); + foreach (var subDir in Directory.GetDirectories (cacheDirectory)) { + try { + var days = Math.Abs ((now - Directory.GetLastWriteTime (subDir)).TotalDays); + if (days > 30) + Directory.Delete (subDir, true); + } catch (Exception e) { + LoggingService.LogError ("Error while removing outdated cache " + subDir, e); + } + } } catch (Exception e) { - LoggingService.LogError ("Error while removing outdated cache " + subDir, e); + LoggingService.LogError ("Error while getting cache directories " + cacheDirectory, e); } } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService_WorkspaceHandling.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService_WorkspaceHandling.cs index 853e9bcb92..175cc3f7ee 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService_WorkspaceHandling.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService_WorkspaceHandling.cs @@ -126,21 +126,21 @@ namespace MonoDevelop.Ide.TypeSystem ws.UpdateFileContent (fileName, text); } - internal static Task<List<MonoDevelopWorkspace>> Load (WorkspaceItem item, ProgressMonitor progressMonitor) + internal static Task<List<MonoDevelopWorkspace>> Load (WorkspaceItem item, ProgressMonitor progressMonitor, CancellationToken cancellationToken = default(CancellationToken)) { using (Counters.ParserService.WorkspaceItemLoaded.BeginTiming ()) { var wsList = new List<MonoDevelopWorkspace> (); - return InternalLoad (wsList, item, progressMonitor).ContinueWith (t => { t.Wait (); return wsList; }); + return InternalLoad (wsList, item, progressMonitor, cancellationToken).ContinueWith (t => { t.Wait (); return wsList; }); } } - static Task InternalLoad (List<MonoDevelopWorkspace> list, MonoDevelop.Projects.WorkspaceItem item, ProgressMonitor progressMonitor) + static Task InternalLoad (List<MonoDevelopWorkspace> list, MonoDevelop.Projects.WorkspaceItem item, ProgressMonitor progressMonitor, CancellationToken cancellationToken = default(CancellationToken)) { return Task.Run (async () => { var ws = item as MonoDevelop.Projects.Workspace; if (ws != null) { foreach (var it in ws.Items) { - await InternalLoad (list, it, progressMonitor); + await InternalLoad (list, it, progressMonitor, cancellationToken); } ws.ItemAdded += OnWorkspaceItemAdded; ws.ItemRemoved += OnWorkspaceItemRemoved; @@ -152,7 +152,7 @@ namespace MonoDevelop.Ide.TypeSystem workspace.ShowStatusIcon (); lock (workspaceLock) workspaces = workspaces.Add (workspace); - await workspace.TryLoadSolution (solution/*, progressMonitor*/); + await workspace.TryLoadSolution (solution, cancellationToken); solution.SolutionItemAdded += OnSolutionItemAdded; solution.SolutionItemRemoved += OnSolutionItemRemoved; workspace.HideStatusIcon (); diff --git a/main/src/core/MonoDevelop.Startup/MonoDevelop.Startup.csproj b/main/src/core/MonoDevelop.Startup/MonoDevelop.Startup.csproj index 9a0c8ca36e..f518cef7a8 100644 --- a/main/src/core/MonoDevelop.Startup/MonoDevelop.Startup.csproj +++ b/main/src/core/MonoDevelop.Startup/MonoDevelop.Startup.csproj @@ -22,7 +22,7 @@ <EnvironmentVariables> <EnvironmentVariables> <Variable name="MONODEVELOP_LOCALE_PATH" value="../locale" /> - <Variable name="MONODEVELOP_TEST_PROFILE" value="./test-profile" /> + <Variable name="MONODEVELOP_PROFILE" value="./test-profile" /> </EnvironmentVariables> </EnvironmentVariables> <PlatformTarget>x86</PlatformTarget> @@ -50,7 +50,7 @@ <EnvironmentVariables> <EnvironmentVariables> <Variable name="MONODEVELOP_LOCALE_PATH" value="../locale" /> - <Variable name="MONODEVELOP_TEST_PROFILE" value="./test-profile" /> + <Variable name="MONODEVELOP_PROFILE" value="./test-profile" /> </EnvironmentVariables> </EnvironmentVariables> <Execution> diff --git a/main/tests/UnitTests/MonoDevelop.CSharpBinding/AutomaticBracketInsertionTests.cs b/main/tests/UnitTests/MonoDevelop.CSharpBinding/AutomaticBracketInsertionTests.cs index 6a16ac0a87..0e54af3a18 100644 --- a/main/tests/UnitTests/MonoDevelop.CSharpBinding/AutomaticBracketInsertionTests.cs +++ b/main/tests/UnitTests/MonoDevelop.CSharpBinding/AutomaticBracketInsertionTests.cs @@ -212,6 +212,8 @@ namespace MonoDevelop.CSharpBinding listWindow.CompletionWidget = widget; listWindow.CodeCompletionContext = widget.CurrentCodeCompletionContext; var model = ext.DocumentContext.ParsedDocument.GetAst<SemanticModel> (); + Ide.IdeApp.Preferences.AddParenthesesAfterCompletion.Set (true); + Ide.IdeApp.Preferences.AddOpeningOnly.Set (false); var t = model.Compilation.GetTypeByMetadataName (type); var method = member != null ? t.GetMembers().First (m => m.Name == member) : t.GetMembers ().OfType<IMethodSymbol> ().First (m => m.MethodKind == MethodKind.Constructor); diff --git a/main/tests/UserInterfaceTests/TestService.cs b/main/tests/UserInterfaceTests/TestService.cs index a66d0c374c..e7e6793476 100644 --- a/main/tests/UserInterfaceTests/TestService.cs +++ b/main/tests/UserInterfaceTests/TestService.cs @@ -39,7 +39,7 @@ namespace UserInterfaceTests Session = new AutoTestClientSession (); Session.StartApplication (file: monoDevelopBinPath, environment: new Dictionary<string,string> { - { "MONODEVELOP_TEST_PROFILE", profilePath ?? Util.CreateTmpDir ("profile") } + { "MONODEVELOP_PROFILE", profilePath ?? Util.CreateTmpDir ("profile") } }); Session.SetGlobalValue ("MonoDevelop.Core.Instrumentation.InstrumentationService.Enabled", true); diff --git a/main/tests/test-projects/test-multi-configuration/project.csproj b/main/tests/test-projects/test-multi-configuration/project.csproj index 8e486b486a..03a8ed6a34 100644 --- a/main/tests/test-projects/test-multi-configuration/project.csproj +++ b/main/tests/test-projects/test-multi-configuration/project.csproj @@ -22,7 +22,7 @@ <EnvironmentVariables> <EnvironmentVariables> <Variable name="MONODEVELOP_LOCALE_PATH" value="../locale" /> - <Variable name="MONODEVELOP_TEST_PROFILE" value="./test-profile" /> + <Variable name="MONODEVELOP_PROFILE" value="./test-profile" /> </EnvironmentVariables> </EnvironmentVariables> <PlatformTarget>x86</PlatformTarget> @@ -52,7 +52,7 @@ <EnvironmentVariables> <EnvironmentVariables> <Variable name="MONODEVELOP_LOCALE_PATH" value="../locale" /> - <Variable name="MONODEVELOP_TEST_PROFILE" value="./test-profile" /> + <Variable name="MONODEVELOP_PROFILE" value="./test-profile" /> </EnvironmentVariables> </EnvironmentVariables> <Execution> |