Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Ungureanu <marius.ungureanu@xamarin.com>2015-11-23 16:45:18 +0300
committerMarius Ungureanu <marius.ungureanu@xamarin.com>2015-11-23 16:45:18 +0300
commita94ef4314d4bbbc96c0c80f15762335bf86df663 (patch)
treefcf7244620c9a1b9b735476ec2d9ae3f7d7f3407
parent26e5c5b5cf30799e0b263fd3a26de017a72b1f49 (diff)
parenta05bc0f6d0591f71c5e4e5786108118f51c68fe1 (diff)
Merge remote-tracking branch 'origin/roslyn' into roslyn-nogtkshell
-rw-r--r--main/Makefile.include5
-rw-r--r--main/build/MacOSX/monostub-test.m5
-rw-r--r--main/build/MacOSX/monostub-utils.h15
-rw-r--r--main/configure.in17
m---------main/external/xwt0
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeRefactorings/Resources.cs4
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/HighlightUsagesExtension.cs16
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/CSharpParsedDocument.cs16
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp/AstStockIcons.cs165
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp/CSharpNavigationTextEditorExtension.cs36
-rw-r--r--main/src/addins/MacPlatform/Dialogs/MacOpenFileDialogHandler.cs9
-rw-r--r--main/src/addins/MacPlatform/Dialogs/MacSelectFileDialogHandler.cs8
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs42
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/NRefactoryStock.cs323
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorDebuggerEngine.cs2
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/EvaluationTests.cs3
-rw-r--r--main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/CodeBehindWriter.cs27
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/AnalysisCommands.cs3
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/HighlightingPanel.cs1
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs4
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/gui.stetic1
-rw-r--r--main/src/addins/NUnit/Services/NUnitProjectServiceExtension.cs46
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/MonoDevelop.VersionControl.Subversion.Unix/SvnClient.cs3
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/CommonTextEditorOptions.cs13
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs2
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/OpenFileDialogHandler.cs1
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/SelectFileDialogHandler.cs2
-rw-r--r--main/src/addins/Xml/Editor/BaseXmlEditorExtension.cs92
-rw-r--r--main/src/addins/Xml/Editor/XmlTextEditorExtension.cs14
-rw-r--r--main/src/addins/Xml/Parser/XmlCommentState.cs1
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/ColorScheme.cs4
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Document/DocumentUpdateRequest.cs2
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/LayoutCache.cs37
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs269
-rw-r--r--main/src/core/Mono.Texteditor/Styles/DefaultStyle.json1
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/IBuildTarget.cs7
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs5
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectFile.cs1
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectItem.cs2
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs5
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionFolder.cs5
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItem.cs5
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Workspace.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/GtkWidgetResult.cs11
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbarController.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchPopupWindow.cs36
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchResult.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/FileChooserAction.cs28
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatterService.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplate.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/FileCommands.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ProjectCommands.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/CustomToolService.cs94
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractNavigationExtension.cs36
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractUsagesExtension.cs19
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColorScheme.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs25
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorViewContent.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResultWidget.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/LogView.cs7
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/ReferenceNodeBuilder.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ImplicitFrameworkAssemblyReferenceNodeBuilder.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionFolderFileNodeBuilder.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionFolderNodeBuilder.cs18
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionNodeBuilder.cs16
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SystemFileNodeBuilder.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/UnknownEntryNodeBuilder.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs12
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs16
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/FileViewer.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/StartupInfo.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewFileDialog.cs11
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewProjectController.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/CommentTasksView.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/UserTasksView.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/FileTemplate.cs638
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectTemplate.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/SingleFileDescriptionTemplate.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/Ambience.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MetadataReferenceCache.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs8
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/ProjectCacheService.cs8
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/StockIcons.cs243
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Ide.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdePreferences.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs20
-rw-r--r--main/tests/Ide.Tests/FileTransferTests.cs62
89 files changed, 1354 insertions, 1245 deletions
diff --git a/main/Makefile.include b/main/Makefile.include
index 826698c130..ce61385fb8 100644
--- a/main/Makefile.include
+++ b/main/Makefile.include
@@ -10,11 +10,6 @@ abs_top_builddir ?= $(top_builddir)
MD_BIN_PATH=$(abs_top_builddir)/build/bin
MD_LAUNCH_SETUP= \
- PATH="$(PATH)" \
- PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" \
- LD_LIBRARY_PATH="$(LD_LIBRARY_PATH)" \
- DYLD_FALLBACK_LIBRARY_PATH="$(DYLD_FALLBACK_LIBRARY_PATH)" \
- MONO_GAC_PREFIX="$(MONO_GAC_PREFIX)" \
MONODEVELOP_LOCALE_PATH="$(abs_top_builddir)/build/locale" \
MONODEVELOP_TEST_PROFILE="$(MD_BIN_PATH)/test-profile"
diff --git a/main/build/MacOSX/monostub-test.m b/main/build/MacOSX/monostub-test.m
index 080212ff6c..8378ec3436 100644
--- a/main/build/MacOSX/monostub-test.m
+++ b/main/build/MacOSX/monostub-test.m
@@ -154,7 +154,6 @@ void check_path_has_components(char *path, const char **components, int count)
{
char *token, *tofree, *copy;
-
for (int i = 0; i < count; ++i) {
BOOL found = FALSE;
tofree = copy = strdup(path);
@@ -198,6 +197,9 @@ void test_update_environment(void)
const char *safe_components[] = {
"yes",
};
+ const char *numeric_components[] = {
+ "C",
+ };
// Check that we only get updates one time, that's how monostub works.
check_bool_equal(TRUE, update_environment(".", true));
@@ -209,6 +211,7 @@ void test_update_environment(void)
check_path_has_components(getenv("PKG_CONFIG_PATH"), pkg_components, sizeof(pkg_components) / sizeof(char *));
check_path_has_components(getenv("MONO_GAC_PREFIX"), gac_components, sizeof(gac_components) / sizeof(char *));
check_path_has_components(getenv("MONODEVELOP_64BIT_SAFE"), safe_components, sizeof(safe_components) / sizeof (char *));
+ check_path_has_components(getenv("LC_NUMERIC"), numeric_components, sizeof(numeric_components) / sizeof(char *));
}
void (*tests[])(void) = {
diff --git a/main/build/MacOSX/monostub-utils.h b/main/build/MacOSX/monostub-utils.h
index cebc04248e..3d6dbd82e9 100644
--- a/main/build/MacOSX/monostub-utils.h
+++ b/main/build/MacOSX/monostub-utils.h
@@ -173,6 +173,18 @@ push_env_to_end (const char *variable, const char *value)
}
static bool
+replace_env (const char *variable, const char *value)
+{
+ const char *old = getenv (variable);
+
+ if (old && !strcmp (old, value))
+ return false;
+
+ setenv (variable, value, true);
+ return true;
+}
+
+static bool
update_environment (const char *contentsDir, bool need64Bit)
{
bool updated = NO;
@@ -232,6 +244,9 @@ update_environment (const char *contentsDir, bool need64Bit)
}
}
+ if (replace_env ("LC_NUMERIC", "C"))
+ updated = YES;
+
return updated;
}
diff --git a/main/configure.in b/main/configure.in
index 30d7287526..a0e8667138 100644
--- a/main/configure.in
+++ b/main/configure.in
@@ -39,12 +39,17 @@ if ! $PKG_CONFIG --atleast-version=$MONO_REQUIRED_VERSION mono; then
AC_MSG_ERROR([You need mono $MONO_REQUIRED_VERSION or newer])
fi
-#ensure we have the same env as when configured
-AC_SUBST(PATH)
-AC_SUBST(PKG_CONFIG_PATH)
-AC_SUBST(LD_LIBRARY_PATH)
-AC_SUBST(DYLD_FALLBACK_LIBRARY_PATH)
-AC_SUBST(MONO_GAC_PREFIX)
+###
+# Disable the environment capturing as it breaks on El Capitan and we end up storing empty env vars
+# which means we break things like `DYLD_FALLBACK_LIBRARY_PATH` because that env has a default meaning
+# when it is *not set*, but this code causes it to be set to an empty value so we can't load libc.
+###
+##ensure we have the same env as when configured
+#AC_SUBST(PATH)
+#AC_SUBST(PKG_CONFIG_PATH)
+#AC_SUBST(LD_LIBRARY_PATH)
+#AC_SUBST(DYLD_FALLBACK_LIBRARY_PATH)
+#AC_SUBST(MONO_GAC_PREFIX)
default_gnomeplatform=no
default_windowsplatform=no
diff --git a/main/external/xwt b/main/external/xwt
-Subproject 0d2ca452e0287331dd4408bd4b9b3db7a063508
+Subproject c5eff99963f7fe21e82734d29a5a0dda0bff98a
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeRefactorings/Resources.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeRefactorings/Resources.cs
index b3abc4fc04..7856a0cda4 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeRefactorings/Resources.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeRefactorings/Resources.cs
@@ -37,7 +37,7 @@ namespace ICSharpCode.NRefactory6.CSharp
public static string GenerateNewConstructorIn = "Generate constructor in '{0}'";
public static string GenerateAbstractMethod = "Generate abstract method '{0}' in '{1}'";
- public static string GenerateAbstractProperty = "Generate abstract property '{0}' in '{1}&apos";
+ public static string GenerateAbstractProperty = "Generate abstract property '{0}' in '{1}'";
public static string GeneratePropertyIn = "Generate property '{1}.{0}'";
public static string GenerateMethodIn = "Generate method '{1}.{0}'";
@@ -53,7 +53,7 @@ namespace ICSharpCode.NRefactory6.CSharp
public static string ImplementInterfaceAbstractly = "Implement interface abstractly";
public static string ImplementInterfaceExplicitly = "Implement interface explicitly";
public static string ImplementInterfaceExplicitlyWithDisposePattern = "Implement interface explicitly with Dispose pattern";
- public static string ImplementInterfaceThrough = "Implement interface through '{0}&apos";
+ public static string ImplementInterfaceThrough = "Implement interface through '{0}'";
public static string ImplementInterfaceWithDisposePattern = "Implement interface with Dispose pattern";
public static string ImplicitConversionDisplayText = "Generate implicit conversion operator in '{0}'";
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/HighlightUsagesExtension.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/HighlightUsagesExtension.cs
index 362c35e423..911ec89710 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/HighlightUsagesExtension.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/HighlightUsagesExtension.cs
@@ -97,26 +97,28 @@ namespace MonoDevelop.CSharp.Highlighting
};
}
- protected override IEnumerable<MemberReference> GetReferences (UsageData resolveResult, CancellationToken token)
+ protected override async Task<IEnumerable<MemberReference>> GetReferencesAsync (UsageData resolveResult, CancellationToken token)
{
+ var result = new List<MemberReference> ();
if (resolveResult.Symbol == null)
- yield break;
+ return result;
var doc = resolveResult.Document;
var documents = ImmutableHashSet.Create (doc);
var symbol = resolveResult.Symbol;
foreach (var loc in symbol.Locations) {
if (loc.IsInSource && loc.SourceTree.FilePath == doc.FilePath)
- yield return new MemberReference (symbol, doc.FilePath, loc.SourceSpan.Start, loc.SourceSpan.Length) {
+ result.Add (new MemberReference (symbol, doc.FilePath, loc.SourceSpan.Start, loc.SourceSpan.Length) {
ReferenceUsageType = ReferenceUsageType.Declariton
- };
+ });
}
- foreach (var mref in SymbolFinder.FindReferencesAsync (symbol, TypeSystemService.Workspace.CurrentSolution, documents, token).Result) {
+ foreach (var mref in await SymbolFinder.FindReferencesAsync (symbol, TypeSystemService.Workspace.CurrentSolution, documents, token)) {
foreach (var loc in mref.Locations) {
- yield return new MemberReference (symbol, doc.FilePath, loc.Location.SourceSpan.Start, loc.Location.SourceSpan.Length) {
+ result.Add (new MemberReference (symbol, doc.FilePath, loc.Location.SourceSpan.Start, loc.Location.SourceSpan.Length) {
ReferenceUsageType = GetUsage (loc.Location.SourceTree.GetRoot ().FindNode (loc.Location.SourceSpan))
- };
+ });
}
}
+ return result;
}
static ReferenceUsageType GetUsage (SyntaxNode node)
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/CSharpParsedDocument.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/CSharpParsedDocument.cs
index 4cf598444f..de1fc05416 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/CSharpParsedDocument.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/CSharpParsedDocument.cs
@@ -350,7 +350,7 @@ namespace MonoDevelop.CSharp.Parser
base.VisitCompilationUnit (node);
}
- void AddFolding (SyntaxToken openBrace, SyntaxToken closeBrace)
+ void AddFolding (SyntaxToken openBrace, SyntaxToken closeBrace, FoldType type)
{
openBrace = openBrace.GetPreviousToken (false, false, true, true);
@@ -359,7 +359,7 @@ namespace MonoDevelop.CSharp.Parser
var last = closeBrace.GetLocation ().GetLineSpan ();
if (first.EndLinePosition.Line != last.EndLinePosition.Line)
- Foldings.Add (new FoldingRegion (new DocumentRegion (first.EndLinePosition, last.EndLinePosition), FoldType.Undefined));
+ Foldings.Add (new FoldingRegion (new DocumentRegion (first.EndLinePosition, last.EndLinePosition), type));
} catch (ArgumentOutOfRangeException) {}
}
@@ -385,38 +385,38 @@ namespace MonoDevelop.CSharp.Parser
public override void VisitNamespaceDeclaration (Microsoft.CodeAnalysis.CSharp.Syntax.NamespaceDeclarationSyntax node)
{
AddUsings (node);
- AddFolding (node.OpenBraceToken, node.CloseBraceToken);
+ AddFolding (node.OpenBraceToken, node.CloseBraceToken, FoldType.Undefined);
base.VisitNamespaceDeclaration (node);
}
public override void VisitClassDeclaration (Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax node)
{
- AddFolding (node.OpenBraceToken, node.CloseBraceToken);
+ AddFolding (node.OpenBraceToken, node.CloseBraceToken, FoldType.Type);
base.VisitClassDeclaration (node);
}
public override void VisitStructDeclaration (Microsoft.CodeAnalysis.CSharp.Syntax.StructDeclarationSyntax node)
{
- AddFolding (node.OpenBraceToken, node.CloseBraceToken);
+ AddFolding (node.OpenBraceToken, node.CloseBraceToken, FoldType.Type);
base.VisitStructDeclaration (node);
}
public override void VisitInterfaceDeclaration (Microsoft.CodeAnalysis.CSharp.Syntax.InterfaceDeclarationSyntax node)
{
- AddFolding (node.OpenBraceToken, node.CloseBraceToken);
+ AddFolding (node.OpenBraceToken, node.CloseBraceToken, FoldType.Type);
base.VisitInterfaceDeclaration (node);
}
public override void VisitEnumDeclaration (Microsoft.CodeAnalysis.CSharp.Syntax.EnumDeclarationSyntax node)
{
- AddFolding (node.OpenBraceToken, node.CloseBraceToken);
+ AddFolding (node.OpenBraceToken, node.CloseBraceToken, FoldType.Type);
base.VisitEnumDeclaration (node);
}
public override void VisitBlock (Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax node)
{
cancellationToken.ThrowIfCancellationRequested ();
- AddFolding (node.OpenBraceToken, node.CloseBraceToken);
+ AddFolding (node.OpenBraceToken, node.CloseBraceToken, node.Parent is MemberDeclarationSyntax ? FoldType.Member : FoldType.Undefined);
base.VisitBlock (node);
}
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/AstStockIcons.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/AstStockIcons.cs
index 932a5127b7..e2aab565b5 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/AstStockIcons.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/AstStockIcons.cs
@@ -49,78 +49,9 @@ namespace MonoDevelop.CSharp
static readonly IconId Delegate = "md-delegate";
public static readonly IconId Namespace = "md-name-space";
- static readonly IconId InternalClass = "md-internal-class";
- static readonly IconId InternalDelegate = "md-internal-delegate";
- static readonly IconId InternalEnum = "md-internal-enum";
- static readonly IconId InternalEvent = "md-internal-event";
- static readonly IconId InternalField = "md-internal-field";
- static readonly IconId InternalInterface = "md-internal-interface";
- static readonly IconId InternalMethod = "md-internal-method";
- static readonly IconId InternalProperty = "md-internal-property";
- static readonly IconId InternalStruct = "md-internal-struct";
-
- static readonly IconId InternalAndProtectedClass = "md-InternalAndProtected-class";
- static readonly IconId InternalAndProtectedDelegate = "md-InternalAndProtected-delegate";
- static readonly IconId InternalAndProtectedEnum = "md-InternalAndProtected-enum";
- static readonly IconId InternalAndProtectedEvent = "md-InternalAndProtected-event";
- static readonly IconId InternalAndProtectedField = "md-InternalAndProtected-field";
- static readonly IconId InternalAndProtectedInterface = "md-InternalAndProtected-interface";
- static readonly IconId InternalAndProtectedMethod = "md-InternalAndProtected-method";
- static readonly IconId InternalAndProtectedProperty = "md-InternalAndProtected-property";
- static readonly IconId InternalAndProtectedStruct = "md-InternalAndProtected-struct";
-
- static readonly IconId PrivateClass = "md-private-class";
- static readonly IconId PrivateDelegate = "md-private-delegate";
- static readonly IconId PrivateEnum = "md-private-enum";
- static readonly IconId PrivateEvent = "md-private-event";
- static readonly IconId PrivateField = "md-private-field";
- static readonly IconId PrivateInterface = "md-private-interface";
- static readonly IconId PrivateMethod = "md-private-method";
- static readonly IconId PrivateProperty = "md-private-property";
- static readonly IconId PrivateStruct = "md-private-struct";
-
- static readonly IconId ProtectedClass = "md-protected-class";
- static readonly IconId ProtectedDelegate = "md-protected-delegate";
- static readonly IconId ProtectedEnum = "md-protected-enum";
- static readonly IconId ProtectedEvent = "md-protected-event";
- static readonly IconId ProtectedField = "md-protected-field";
- static readonly IconId ProtectedInterface = "md-protected-interface";
- static readonly IconId ProtectedMethod = "md-protected-method";
- static readonly IconId ProtectedProperty = "md-protected-property";
- static readonly IconId ProtectedStruct = "md-protected-struct";
-
- static readonly IconId ProtectedOrInternalClass = "md-ProtectedOrInternal-class";
- static readonly IconId ProtectedOrInternalDelegate = "md-ProtectedOrInternal-delegate";
- static readonly IconId ProtectedOrInternalEnum = "md-ProtectedOrInternal-enum";
- static readonly IconId ProtectedOrInternalEvent = "md-ProtectedOrInternal-event";
- static readonly IconId ProtectedOrInternalField = "md-ProtectedOrInternal-field";
- static readonly IconId ProtectedOrInternalInterface = "md-ProtectedOrInternal-interface";
- static readonly IconId ProtectedOrInternalMethod = "md-ProtectedOrInternal-method";
- static readonly IconId ProtectedOrInternalProperty = "md-ProtectedOrInternal-property";
- static readonly IconId ProtectedOrInternalStruct = "md-ProtectedOrInternal-struct";
-
- static IconId[,] typeIconTable = new IconId[,] {
- {Class, PrivateClass, Class, ProtectedClass, InternalClass, ProtectedOrInternalClass, InternalAndProtectedClass}, // class
- {Enum, PrivateEnum, Enum, ProtectedEnum, InternalEnum, ProtectedOrInternalEnum, InternalAndProtectedEnum}, // enum
- {Interface, PrivateInterface, Interface, ProtectedInterface, InternalInterface, ProtectedOrInternalInterface, InternalAndProtectedInterface}, // interface
- {Struct, PrivateStruct, Struct, ProtectedStruct, InternalStruct, ProtectedOrInternalStruct, InternalAndProtectedStruct}, // struct
- {Delegate, PrivateDelegate, Delegate, ProtectedDelegate, InternalDelegate, ProtectedOrInternalDelegate, InternalAndProtectedDelegate} // delegate
- };
- static readonly IconId[] fieldIconTable = {
- AstStockIcons.Field, AstStockIcons.PrivateField, AstStockIcons.Field, AstStockIcons.ProtectedField, AstStockIcons.InternalField, AstStockIcons.ProtectedOrInternalField, AstStockIcons.InternalAndProtectedField
- };
- static readonly IconId[] methodIconTable = {
- AstStockIcons.Method, AstStockIcons.PrivateMethod, AstStockIcons.Method, AstStockIcons.ProtectedMethod, AstStockIcons.InternalMethod, AstStockIcons.ProtectedOrInternalMethod, AstStockIcons.InternalAndProtectedMethod
- };
- static readonly IconId[] propertyIconTable = {
- AstStockIcons.Property, AstStockIcons.PrivateProperty, AstStockIcons.Property, AstStockIcons.ProtectedProperty, AstStockIcons.InternalProperty, AstStockIcons.ProtectedOrInternalProperty, AstStockIcons.InternalAndProtectedProperty
- };
- static readonly IconId[] eventIconTable = {
- AstStockIcons.Event, AstStockIcons.PrivateEvent, AstStockIcons.Event, AstStockIcons.ProtectedEvent, AstStockIcons.InternalEvent, AstStockIcons.ProtectedOrInternalEvent, AstStockIcons.InternalAndProtectedEvent
- };
-
- static void AdjustAccessibility (SyntaxTokenList modifiers, ref Accessibility acc, ref bool result)
+ static void AdjustAccessibility (SyntaxTokenList modifiers, ref Accessibility acc, ref bool isStatic, ref bool result)
{
+ isStatic = modifiers.Any (mod => mod.Kind () == Microsoft.CodeAnalysis.CSharp.SyntaxKind.StaticKeyword);
if (modifiers.Any (mod => mod.Kind () == Microsoft.CodeAnalysis.CSharp.SyntaxKind.ProtectedKeyword) &&
modifiers.Any (mod => mod.Kind () == Microsoft.CodeAnalysis.CSharp.SyntaxKind.InternalKeyword)) {
acc = Accessibility.ProtectedOrInternal;
@@ -139,7 +70,7 @@ namespace MonoDevelop.CSharp
result = true;
return;
}
- if (mod.Kind () == Microsoft.CodeAnalysis.CSharp.SyntaxKind.ProtectedKeyword) {
+ if (mod.Kind () == Microsoft.CodeAnalysis.CSharp.SyntaxKind.ProtectedKeyword) {
acc = Accessibility.Protected;
result = true;
return;
@@ -152,8 +83,9 @@ namespace MonoDevelop.CSharp
}
}
- static bool GetAccessibility (SyntaxNode element, out Accessibility acc)
+ static bool GetAccessibility (SyntaxNode element, out Accessibility acc, out bool isStatic)
{
+ isStatic = false;
if (element.Parent is TypeDeclarationSyntax && element.Parent is InterfaceDeclarationSyntax) {
acc = Accessibility.Public;
return true;
@@ -164,110 +96,121 @@ namespace MonoDevelop.CSharp
acc = Accessibility.Internal;
if (element is TypeDeclarationSyntax)
- AdjustAccessibility (((TypeDeclarationSyntax)element).Modifiers, ref acc, ref result);
+ AdjustAccessibility (((TypeDeclarationSyntax)element).Modifiers, ref acc, ref isStatic, ref result);
if (element is BaseFieldDeclarationSyntax)
- AdjustAccessibility (((BaseFieldDeclarationSyntax)element).Modifiers, ref acc, ref result);
+ AdjustAccessibility (((BaseFieldDeclarationSyntax)element).Modifiers, ref acc, ref isStatic, ref result);
if (element is BasePropertyDeclarationSyntax)
- AdjustAccessibility (((BasePropertyDeclarationSyntax)element).Modifiers, ref acc, ref result);
+ AdjustAccessibility (((BasePropertyDeclarationSyntax)element).Modifiers, ref acc, ref isStatic, ref result);
if (element is BaseMethodDeclarationSyntax)
- AdjustAccessibility (((BaseMethodDeclarationSyntax)element).Modifiers, ref acc, ref result);
+ AdjustAccessibility (((BaseMethodDeclarationSyntax)element).Modifiers, ref acc, ref isStatic, ref result);
return result;
}
public static string GetStockIcon (this SyntaxNode element)
{
Accessibility acc = Accessibility.Public;
+ bool isStatic = false;
if (element is NamespaceDeclarationSyntax)
return Namespace;
if (element is AccessorDeclarationSyntax) {
- if (!GetAccessibility ((MemberDeclarationSyntax)element, out acc))
- GetAccessibility (element.Parent as MemberDeclarationSyntax, out acc);
+ if (!GetAccessibility ((MemberDeclarationSyntax)element, out acc, out isStatic))
+ GetAccessibility (element.Parent as MemberDeclarationSyntax, out acc, out isStatic);
- return methodIconTable [(int) (acc)];
+ return "md-" + GetAccess (acc) + "method";
}
- GetAccessibility (element, out acc);
+ GetAccessibility (element, out acc, out isStatic);
if (element is EnumDeclarationSyntax) {
- return typeIconTable [1, (int) (acc)];
+ return "md-" + GetAccess (acc) + "enum";
}
if (element is TypeDeclarationSyntax) {
var type = element as TypeDeclarationSyntax;
switch (type.Keyword.Kind ()) {
case SyntaxKind.ClassKeyword:
- return typeIconTable [0, (int) (acc)];
+ return "md-" + GetAccess (acc) + "class";
case SyntaxKind.StructKeyword:
- return typeIconTable [3, (int) (acc)];
+ return "md-" + GetAccess (acc) + "struct";
case SyntaxKind.InterfaceKeyword:
- return typeIconTable [2, (int) (acc)];
+ return "md-" + GetAccess (acc) + "interface";
case SyntaxKind.EnumKeyword:
- return typeIconTable [1, (int) (acc)];
+ return "md-" + GetAccess (acc) + "enum";
default:
throw new ArgumentOutOfRangeException ();
}
}
if (element is DelegateDeclarationSyntax)
- return typeIconTable [4, (int) (acc)];
+ return "md-" + GetAccess (acc) + "delegate";
// member accessibility
- GetAccessibility (element, out acc);
+ GetAccessibility (element, out acc, out isStatic);
if (element is BaseMethodDeclarationSyntax) {
// TODO!
// var method = element as MethodDeclarationSyntax;
// if (method.ParameterList.Parameters.First ())
// return extensionMethodIconTable [(int) (acc)];
- return methodIconTable [(int) (acc)];
+
+
+ return "md-" + GetAccess (acc) + GetGlobal (isStatic) + "method";
}
if (element is PropertyDeclarationSyntax || element is IndexerDeclarationSyntax)
- return propertyIconTable [(int) (acc)];
+ return "md-" + GetAccess (acc) + GetGlobal (isStatic) + "property";
if (element is EventDeclarationSyntax || element is EventFieldDeclarationSyntax)
- return eventIconTable [(int) (acc)];
+ return "md-" + GetAccess (acc) + GetGlobal (isStatic) + "event";
if (element.Parent is EnumDeclarationSyntax)
- acc = Accessibility.Public;
- return fieldIconTable [(int) (acc)];
+ return "md-" + GetAccess (acc) + "enum";
+ return "md-" + GetAccess (acc) + GetGlobal (isStatic) + "field";
+ }
+
+ static string GetGlobal (bool isStatic)
+ {
+ return isStatic ? "static-" : "";
+ }
+
+ static string GetAccess (Accessibility acc)
+ {
+ return MonoDevelop.Ide.TypeSystem.Stock.GetAccess (acc);
}
internal static IconId GetStockIconForSymbolInfo (this DeclaredSymbolInfo symbol)
{
switch (symbol.Kind) {
- case DeclaredSymbolInfoKind.Class:
+ case DeclaredSymbolInfoKind.Class:
return AstStockIcons.Class;
- case DeclaredSymbolInfoKind.Constant:
+ case DeclaredSymbolInfoKind.Constant:
return AstStockIcons.Field;
- case DeclaredSymbolInfoKind.Constructor:
+ case DeclaredSymbolInfoKind.Constructor:
return AstStockIcons.Method;
- case DeclaredSymbolInfoKind.Delegate:
+ case DeclaredSymbolInfoKind.Delegate:
return AstStockIcons.Delegate;
- case DeclaredSymbolInfoKind.Enum:
+ case DeclaredSymbolInfoKind.Enum:
return AstStockIcons.Enum;
- case DeclaredSymbolInfoKind.EnumMember:
+ case DeclaredSymbolInfoKind.EnumMember:
return AstStockIcons.Field;
- case DeclaredSymbolInfoKind.Event:
+ case DeclaredSymbolInfoKind.Event:
return AstStockIcons.Event;
- case DeclaredSymbolInfoKind.Field:
+ case DeclaredSymbolInfoKind.Field:
return AstStockIcons.Field;
- case DeclaredSymbolInfoKind.Indexer:
+ case DeclaredSymbolInfoKind.Indexer:
return AstStockIcons.Method;
- case DeclaredSymbolInfoKind.Interface:
+ case DeclaredSymbolInfoKind.Interface:
return AstStockIcons.Interface;
- case DeclaredSymbolInfoKind.Method:
+ case DeclaredSymbolInfoKind.Method:
return AstStockIcons.Method;
- case DeclaredSymbolInfoKind.Module:
+ case DeclaredSymbolInfoKind.Module:
return AstStockIcons.Method;
- case DeclaredSymbolInfoKind.Property:
+ case DeclaredSymbolInfoKind.Property:
return AstStockIcons.Property;
- case DeclaredSymbolInfoKind.Struct:
+ case DeclaredSymbolInfoKind.Struct:
return AstStockIcons.Struct;
- default:
- throw new ArgumentOutOfRangeException ();
+ default:
+ throw new ArgumentOutOfRangeException ();
}
}
-
}
-
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/CSharpNavigationTextEditorExtension.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/CSharpNavigationTextEditorExtension.cs
new file mode 100644
index 0000000000..1b9f73f259
--- /dev/null
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/CSharpNavigationTextEditorExtension.cs
@@ -0,0 +1,36 @@
+//
+// CSharpNavigationTextEditorExtension.cs
+//
+// Author:
+// Mike Krüger <mkrueger@xamarin.com>
+//
+// Copyright (c) 2015 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+namespace MonoDevelop.CSharp
+{
+ public class CSharpNavigationTextEditorExtension
+ {
+ public CSharpNavigationTextEditorExtension ()
+ {
+ }
+ }
+}
+
diff --git a/main/src/addins/MacPlatform/Dialogs/MacOpenFileDialogHandler.cs b/main/src/addins/MacPlatform/Dialogs/MacOpenFileDialogHandler.cs
index 33657e4922..1ca6cf5c6d 100644
--- a/main/src/addins/MacPlatform/Dialogs/MacOpenFileDialogHandler.cs
+++ b/main/src/addins/MacPlatform/Dialogs/MacOpenFileDialogHandler.cs
@@ -48,15 +48,12 @@ namespace MonoDevelop.MacIntegration
NSSavePanel panel = null;
try {
- bool directoryMode = data.Action != FileChooserAction.Open
- && data.Action != FileChooserAction.Save;
-
if (data.Action == FileChooserAction.Save) {
panel = new NSSavePanel ();
} else {
panel = new NSOpenPanel {
- CanChooseDirectories = directoryMode,
- CanChooseFiles = !directoryMode,
+ CanChooseDirectories = (data.Action & FileChooserAction.FolderFlags) != 0,
+ CanChooseFiles = (data.Action & FileChooserAction.FileFlags) != 0,
};
}
@@ -71,7 +68,7 @@ namespace MonoDevelop.MacIntegration
List<FileViewer> currentViewers = null;
var labels = new List<MDAlignment> ();
- if (!directoryMode) {
+ if ((data.Action & FileChooserAction.FileFlags) != 0) {
var filterPopup = MacSelectFileDialogHandler.CreateFileFilterPopup (data, panel);
if (filterPopup != null) {
diff --git a/main/src/addins/MacPlatform/Dialogs/MacSelectFileDialogHandler.cs b/main/src/addins/MacPlatform/Dialogs/MacSelectFileDialogHandler.cs
index 25c8676fdb..fa9914aab5 100644
--- a/main/src/addins/MacPlatform/Dialogs/MacSelectFileDialogHandler.cs
+++ b/main/src/addins/MacPlatform/Dialogs/MacSelectFileDialogHandler.cs
@@ -49,21 +49,19 @@ namespace MonoDevelop.MacIntegration
NSSavePanel panel = null;
try {
- bool directoryMode = data.Action != FileChooserAction.Open;
-
if (data.Action == FileChooserAction.Save) {
panel = new NSSavePanel ();
} else {
panel = new NSOpenPanel {
- CanChooseDirectories = directoryMode,
- CanChooseFiles = !directoryMode,
+ CanChooseDirectories = (data.Action & FileChooserAction.FolderFlags) != 0,
+ CanChooseFiles = (data.Action & FileChooserAction.FileFlags) != 0,
ResolvesAliases = false,
};
}
SetCommonPanelProperties (data, panel);
- if (!directoryMode) {
+ if ((data.Action & FileChooserAction.FileFlags) != 0) {
var popup = CreateFileFilterPopup (data, panel);
if (popup != null) {
panel.AccessoryView = popup;
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs
index e1bb1926fa..16a664662e 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs
@@ -53,6 +53,7 @@ using System.Threading;
using MonoDevelop.Ide.Editor;
using MonoDevelop.Ide.Navigation;
using MonoDevelop.Ide.Gui.Content;
+using System.IO;
namespace MonoDevelop.AssemblyBrowser
{
@@ -392,8 +393,8 @@ namespace MonoDevelop.AssemblyBrowser
{
TreeIter selectedIter;
if (searchTreeview.Selection.GetSelected (out selectedIter)) {
- var member = (IUnresolvedEntity)(searchMode != SearchMode.Type ? memberListStore.GetValue (selectedIter, 4) : typeListStore.GetValue (selectedIter, 4));
-
+ var member = (IUnresolvedEntity)(searchMode == SearchMode.Member ? memberListStore.GetValue (selectedIter, 4) : typeListStore.GetValue (selectedIter, 4));
+
var nav = SearchMember (member);
if (nav != null) {
notebook1.Page = 0;
@@ -712,11 +713,14 @@ namespace MonoDevelop.AssemblyBrowser
col.PackStart (crt, true);
col.AddAttribute (crp, "image", 0);
col.AddAttribute (crt, "text", 1);
+ col.SortColumnId = 1;
searchTreeview.AppendColumn (col);
col.Resizable = true;
col = searchTreeview.AppendColumn (GettextCatalog.GetString ("Declaring Type"), new Gtk.CellRendererText (), "text", 2);
+ col.SortColumnId = 2;
col.Resizable = true;
col = searchTreeview.AppendColumn (GettextCatalog.GetString ("Assembly"), new Gtk.CellRendererText (), "text", 3);
+ col.SortColumnId = 3;
col.Resizable = true;
searchTreeview.Model = memberListStore;
break;
@@ -729,11 +733,17 @@ namespace MonoDevelop.AssemblyBrowser
col.PackStart (crt, true);
col.AddAttribute (crp, "image", 0);
col.AddAttribute (crt, "text", 1);
+ col.SortColumnId = 1;
+
searchTreeview.AppendColumn (col);
col.Resizable = true;
col = searchTreeview.AppendColumn (GettextCatalog.GetString ("Parent"), new Gtk.CellRendererText (), "text", 2);
+ col.SortColumnId = 2;
+
col.Resizable = true;
col = searchTreeview.AppendColumn (GettextCatalog.GetString ("Assembly"), new Gtk.CellRendererText (), "text", 3);
+ col.SortColumnId = 3;
+
col.Resizable = true;
searchTreeview.Model = typeListStore;
break;
@@ -746,11 +756,16 @@ namespace MonoDevelop.AssemblyBrowser
col.PackStart (crt, true);
col.AddAttribute (crp, "image", 0);
col.AddAttribute (crt, "text", 1);
+ col.SortColumnId = 1;
searchTreeview.AppendColumn (col);
col.Resizable = true;
+
col = searchTreeview.AppendColumn (GettextCatalog.GetString ("Namespace"), new Gtk.CellRendererText (), "text", 2);
+ col.SortColumnId = 2;
col.Resizable = true;
+
col = searchTreeview.AppendColumn (GettextCatalog.GetString ("Assembly"), new Gtk.CellRendererText (), "text", 3);
+ col.SortColumnId = 3;
col.Resizable = true;
searchTreeview.Model = typeListStore;
break;
@@ -925,7 +940,7 @@ namespace MonoDevelop.AssemblyBrowser
return;
if (!type.IsPublic && publicOnly)
continue;
- if (type.FullName.ToUpper ().IndexOf (pattern) >= 0)
+ if (type.FullName.ToUpper ().IndexOf (pattern, StringComparison.Ordinal) >= 0)
typeList.Add (type);
}
typeDict [unit] = typeList;
@@ -946,23 +961,25 @@ namespace MonoDevelop.AssemblyBrowser
break;
case SearchMode.TypeAndMembers:
- var typeDict2 = new Dictionary<AssemblyLoader, List<IUnresolvedEntity>> ();
+ var typeDict2 = new Dictionary<AssemblyLoader, List<Tuple<IUnresolvedEntity, string>>> ();
foreach (var unit in this.definitions) {
- var typeList = new List<IUnresolvedEntity> ();
+ var typeList = new List<Tuple<IUnresolvedEntity, string>> ();
foreach (var type in unit.UnresolvedAssembly.TopLevelTypeDefinitions) {
if (worker.CancellationPending)
return;
if (!type.IsPublic && publicOnly)
continue;
- if (type.FullName.ToUpper ().IndexOf (pattern) >= 0)
- typeList.Add (type);
+ var parent = type.FullName;
+ if (parent.ToUpper ().IndexOf (pattern, StringComparison.Ordinal) >= 0)
+ typeList.Add (Tuple.Create ((IUnresolvedEntity)type, type.Namespace));
+
foreach (var member in type.Members) {
if (worker.CancellationPending)
return;
if (!member.IsPublic && publicOnly)
continue;
if (member.Name.ToUpper ().Contains (pattern)) {
- typeList.Add (member);
+ typeList.Add (Tuple.Create ((IUnresolvedEntity)member, parent));
}
}
@@ -972,13 +989,14 @@ namespace MonoDevelop.AssemblyBrowser
Gtk.Application.Invoke (delegate {
foreach (var kv in typeDict2) {
- foreach (var type in kv.Value) {
+ foreach (var tuple in kv.Value) {
if (worker.CancellationPending)
return;
+ var type = tuple.Item1;
typeListStore.AppendValues (ImageService.GetIcon (type.GetStockIcon (), Gtk.IconSize.Menu),
type.Name,
- type.Namespace,
- kv.Key.Assembly.FullName,
+ tuple.Item2,
+ kv.Key.Assembly.FullName,
type);
}
}
@@ -1603,6 +1621,8 @@ namespace MonoDevelop.AssemblyBrowser
return result;
}
+ if (!File.Exists (fileName))
+ return null;
result = new AssemblyLoader (this, fileName);
definitions.Add (result);
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/NRefactoryStock.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/NRefactoryStock.cs
index 9d4624c339..f06aab28df 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/NRefactoryStock.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/NRefactoryStock.cs
@@ -31,96 +31,9 @@ namespace MonoDevelop.AssemblyBrowser
{
static class NRefactoryStock
{
- static readonly IconId Class = "md-class";
- static readonly IconId Enum = "md-enum";
- static readonly IconId Event = "md-event";
static readonly IconId Field = "md-field";
- static readonly IconId Interface = "md-interface";
- static readonly IconId Method = "md-method";
- static readonly IconId ExtensionMethod = "md-extensionmethod";
- static readonly IconId Property = "md-property";
- static readonly IconId Struct = "md-struct";
- static readonly IconId Delegate = "md-delegate";
public static readonly IconId Namespace = "md-name-space";
- static readonly IconId InternalClass = "md-internal-class";
- static readonly IconId InternalDelegate = "md-internal-delegate";
- static readonly IconId InternalEnum = "md-internal-enum";
- static readonly IconId InternalEvent = "md-internal-event";
- static readonly IconId InternalField = "md-internal-field";
- static readonly IconId InternalInterface = "md-internal-interface";
- static readonly IconId InternalMethod = "md-internal-method";
- static readonly IconId InternalExtensionMethod = "md-internal-extensionmethod";
- static readonly IconId InternalProperty = "md-internal-property";
- static readonly IconId InternalStruct = "md-internal-struct";
-
- static readonly IconId InternalAndProtectedClass = "md-InternalAndProtected-class";
- static readonly IconId InternalAndProtectedDelegate = "md-InternalAndProtected-delegate";
- static readonly IconId InternalAndProtectedEnum = "md-InternalAndProtected-enum";
- static readonly IconId InternalAndProtectedEvent = "md-InternalAndProtected-event";
- static readonly IconId InternalAndProtectedField = "md-InternalAndProtected-field";
- static readonly IconId InternalAndProtectedInterface = "md-InternalAndProtected-interface";
- static readonly IconId InternalAndProtectedMethod = "md-InternalAndProtected-method";
- static readonly IconId InternalAndProtectedExtensionMethod = "md-InternalAndProtected-extensionmethod";
- static readonly IconId InternalAndProtectedProperty = "md-InternalAndProtected-property";
- static readonly IconId InternalAndProtectedStruct = "md-InternalAndProtected-struct";
-
- static readonly IconId PrivateClass = "md-private-class";
- static readonly IconId PrivateDelegate = "md-private-delegate";
- static readonly IconId PrivateEnum = "md-private-enum";
- static readonly IconId PrivateEvent = "md-private-event";
- static readonly IconId PrivateField = "md-private-field";
- static readonly IconId PrivateInterface = "md-private-interface";
- static readonly IconId PrivateMethod = "md-private-method";
- static readonly IconId PrivateExtensionMethod = "md-private-extensionmethod";
- static readonly IconId PrivateProperty = "md-private-property";
- static readonly IconId PrivateStruct = "md-private-struct";
-
- static readonly IconId ProtectedClass = "md-protected-class";
- static readonly IconId ProtectedDelegate = "md-protected-delegate";
- static readonly IconId ProtectedEnum = "md-protected-enum";
- static readonly IconId ProtectedEvent = "md-protected-event";
- static readonly IconId ProtectedField = "md-protected-field";
- static readonly IconId ProtectedInterface = "md-protected-interface";
- static readonly IconId ProtectedMethod = "md-protected-method";
- static readonly IconId ProtectedExtensionMethod = "md-protected-extensionmethod";
- static readonly IconId ProtectedProperty = "md-protected-property";
- static readonly IconId ProtectedStruct = "md-protected-struct";
-
- static readonly IconId ProtectedOrInternalClass = "md-ProtectedOrInternal-class";
- static readonly IconId ProtectedOrInternalDelegate = "md-ProtectedOrInternal-delegate";
- static readonly IconId ProtectedOrInternalEnum = "md-ProtectedOrInternal-enum";
- static readonly IconId ProtectedOrInternalEvent = "md-ProtectedOrInternal-event";
- static readonly IconId ProtectedOrInternalField = "md-ProtectedOrInternal-field";
- static readonly IconId ProtectedOrInternalInterface = "md-ProtectedOrInternal-interface";
- static readonly IconId ProtectedOrInternalMethod = "md-ProtectedOrInternal-method";
- static readonly IconId ProtectedOrInternalExtensionMethod = "md-ProtectedOrInternal-extensionmethod";
- static readonly IconId ProtectedOrInternalProperty = "md-ProtectedOrInternal-property";
- static readonly IconId ProtectedOrInternalStruct = "md-ProtectedOrInternal-struct";
-
- static IconId[,] typeIconTable = new IconId[,] {
- {Class, PrivateClass, Class, ProtectedClass, InternalClass, ProtectedOrInternalClass, InternalAndProtectedClass}, // class
- {Enum, PrivateEnum, Enum, ProtectedEnum, InternalEnum, ProtectedOrInternalEnum, InternalAndProtectedEnum}, // enum
- {Interface, PrivateInterface, Interface, ProtectedInterface, InternalInterface, ProtectedOrInternalInterface, InternalAndProtectedInterface}, // interface
- {Struct, PrivateStruct, Struct, ProtectedStruct, InternalStruct, ProtectedOrInternalStruct, InternalAndProtectedStruct}, // struct
- {Delegate, PrivateDelegate, Delegate, ProtectedDelegate, InternalDelegate, ProtectedOrInternalDelegate, InternalAndProtectedDelegate} // delegate
- };
- static readonly IconId[] fieldIconTable = {
- NRefactoryStock.Field, NRefactoryStock.PrivateField, NRefactoryStock.Field, NRefactoryStock.ProtectedField, NRefactoryStock.InternalField, NRefactoryStock.ProtectedOrInternalField, NRefactoryStock.InternalAndProtectedField
- };
- static readonly IconId[] methodIconTable = {
- NRefactoryStock.Method, NRefactoryStock.PrivateMethod, NRefactoryStock.Method, NRefactoryStock.ProtectedMethod, NRefactoryStock.InternalMethod, NRefactoryStock.ProtectedOrInternalMethod, NRefactoryStock.InternalAndProtectedMethod
- };
- static readonly IconId[] extensionMethodIconTable = {
- NRefactoryStock.ExtensionMethod, NRefactoryStock.PrivateExtensionMethod, NRefactoryStock.ExtensionMethod, NRefactoryStock.ProtectedExtensionMethod, NRefactoryStock.InternalExtensionMethod, NRefactoryStock.ProtectedOrInternalExtensionMethod, NRefactoryStock.InternalAndProtectedExtensionMethod
- };
- static readonly IconId[] propertyIconTable = {
- NRefactoryStock.Property, NRefactoryStock.PrivateProperty, NRefactoryStock.Property, NRefactoryStock.ProtectedProperty, NRefactoryStock.InternalProperty, NRefactoryStock.ProtectedOrInternalProperty, NRefactoryStock.InternalAndProtectedProperty
- };
- static readonly IconId[] eventIconTable = {
- NRefactoryStock.Event, NRefactoryStock.PrivateEvent, NRefactoryStock.Event, NRefactoryStock.ProtectedEvent, NRefactoryStock.InternalEvent, NRefactoryStock.ProtectedOrInternalEvent, NRefactoryStock.InternalAndProtectedEvent
- };
-
public static IconId GetStockIcon (this INamedElement element)
{
if (element is IType)
@@ -137,77 +50,6 @@ namespace MonoDevelop.AssemblyBrowser
return GetStockIcon ((IType)entity);
}
- public static IconId GetStockIcon (this IType entity)
- {
- var def = entity.GetDefinition ();
- if (def == null)
- return Class;
- switch (def.Kind) {
- case TypeKind.Class:
- return typeIconTable [0, (int)def.Accessibility];
- case TypeKind.Enum:
- return typeIconTable [1, (int)def.Accessibility];
- case TypeKind.Interface:
- return typeIconTable [2, (int)def.Accessibility];
- case TypeKind.Struct:
- return typeIconTable [3, (int)def.Accessibility];
- case TypeKind.Delegate:
- return typeIconTable [4, (int)def.Accessibility];
- default:
- return typeIconTable [0, (int)def.Accessibility];
- }
- }
- public static IconId GetStockIcon (this IUnresolvedTypeDefinition def)
- {
- switch (def.Kind) {
- case TypeKind.Class:
- return typeIconTable [0, (int)def.Accessibility];
- case TypeKind.Enum:
- return typeIconTable [1, (int)def.Accessibility];
- case TypeKind.Interface:
- return typeIconTable [2, (int)def.Accessibility];
- case TypeKind.Struct:
- return typeIconTable [3, (int)def.Accessibility];
- case TypeKind.Delegate:
- return typeIconTable [4, (int)def.Accessibility];
- default:
- return typeIconTable [0, (int)def.Accessibility];
- }
- }
-
- static int GetTypeIndex (Microsoft.CodeAnalysis.TypeKind typeKind)
- {
- switch (typeKind) {
- case Microsoft.CodeAnalysis.TypeKind.Unknown:
- case Microsoft.CodeAnalysis.TypeKind.Array:
- return 0;
- case Microsoft.CodeAnalysis.TypeKind.Class:
- return 0;
- case Microsoft.CodeAnalysis.TypeKind.Delegate:
- return 4;
- case Microsoft.CodeAnalysis.TypeKind.Dynamic:
- return 0;
- case Microsoft.CodeAnalysis.TypeKind.Enum:
- return 1;
- case Microsoft.CodeAnalysis.TypeKind.Error:
- return 0;
- case Microsoft.CodeAnalysis.TypeKind.Interface:
- return 2;
- case Microsoft.CodeAnalysis.TypeKind.Module:
- return 0;
- case Microsoft.CodeAnalysis.TypeKind.Pointer:
- return 0;
- case Microsoft.CodeAnalysis.TypeKind.Struct:
- return 3;
- case Microsoft.CodeAnalysis.TypeKind.TypeParameter:
- return 0;
- case Microsoft.CodeAnalysis.TypeKind.Submission:
- return 0;
- default:
- throw new ArgumentOutOfRangeException ();
- }
- }
-
public static IconId GetStockIcon (this IField field)
{
return GetStockIcon ((IEntity)field);
@@ -230,73 +72,152 @@ namespace MonoDevelop.AssemblyBrowser
public static IconId GetStockIcon (this IEntity entity, bool showAccessibility = true)
{
+ return "md-" + GetAccess (entity) + GetGlobal (entity) + GetSource (entity);
+ }
+
+ static string GetAccess (IEntity entity)
+ {
+ switch (entity.Accessibility) {
+ case Accessibility.None:
+ return "";
+ case Accessibility.Private:
+ return "private-";
+ case Accessibility.Public:
+ return "";
+ case Accessibility.Protected:
+ return "protected-";
+ case Accessibility.Internal:
+ return "internal-";
+ case Accessibility.ProtectedOrInternal:
+ case Accessibility.ProtectedAndInternal:
+ return "ProtectedOrInternal-";
+ default:
+ throw new ArgumentOutOfRangeException ();
+ }
+ }
+
+ static string GetGlobal (IEntity entity)
+ {
+ switch (entity.SymbolKind) {
+ case SymbolKind.Field:
+ case SymbolKind.Method:
+ case SymbolKind.Constructor:
+ case SymbolKind.Destructor:
+ case SymbolKind.Operator:
+ case SymbolKind.Property:
+ case SymbolKind.Indexer:
+ return entity.IsStatic ? "static-" : "";
+ }
+ return "";
+
+ }
+
+ static string GetSource (IEntity entity)
+ {
switch (entity.SymbolKind) {
case SymbolKind.TypeDefinition:
- return GetStockIcon ((IType)entity);
+ var type = (IType)entity;
+ switch (type.Kind) {
+ case TypeKind.Class:
+ return "class";
+ case TypeKind.Interface:
+ return "interface";
+ case TypeKind.Struct:
+ return "struct";
+ case TypeKind.Delegate:
+ return "delegate";
+ case TypeKind.Enum:
+ return "enum";
+ }
+ return "class";
case SymbolKind.Field:
- if (showAccessibility)
- return fieldIconTable [(int)entity.Accessibility];
- else
- return fieldIconTable [0];
+ case SymbolKind.Event:
+ return "field";
case SymbolKind.Method:
case SymbolKind.Constructor:
case SymbolKind.Destructor:
case SymbolKind.Operator:
- if (showAccessibility) {
- if (((IMethod)entity).IsExtensionMethod)
- return extensionMethodIconTable [(int)entity.Accessibility];
- return methodIconTable [(int)entity.Accessibility];
- } else {
- if (((IMethod)entity).IsExtensionMethod)
- return extensionMethodIconTable [0];
- return methodIconTable [0];
- }
+ return "method";
case SymbolKind.Property:
case SymbolKind.Indexer:
- if (showAccessibility)
- return propertyIconTable [(int)entity.Accessibility];
- else
- return propertyIconTable [0];
- case SymbolKind.Event:
- if (showAccessibility)
- return eventIconTable [(int)entity.Accessibility];
- else
- return eventIconTable [0];
+ return "property";
}
return "";
}
+
public static IconId GetStockIcon (this IUnresolvedEntity entity, bool showAccessibility = true)
{
+ return "md-" + GetAccess (entity) + GetGlobal (entity) + GetSource (entity);
+ }
+
+ static string GetAccess (IUnresolvedEntity entity)
+ {
+ switch (entity.Accessibility) {
+ case Accessibility.None:
+ return "";
+ case Accessibility.Private:
+ return "private-";
+ case Accessibility.Public:
+ return "";
+ case Accessibility.Protected:
+ return "protected-";
+ case Accessibility.Internal:
+ return "internal-";
+ case Accessibility.ProtectedOrInternal:
+ case Accessibility.ProtectedAndInternal:
+ return "ProtectedOrInternal-";
+ default:
+ throw new ArgumentOutOfRangeException ();
+ }
+ }
+
+ static string GetGlobal (IUnresolvedEntity entity)
+ {
+ switch (entity.SymbolKind) {
+ case SymbolKind.Field:
+ case SymbolKind.Method:
+ case SymbolKind.Constructor:
+ case SymbolKind.Destructor:
+ case SymbolKind.Operator:
+ case SymbolKind.Property:
+ case SymbolKind.Indexer:
+ return entity.IsStatic ? "static-" : "";
+ }
+ return "";
+ }
+
+ static string GetSource (IUnresolvedEntity entity)
+ {
switch (entity.SymbolKind) {
case SymbolKind.TypeDefinition:
- return GetStockIcon ((IUnresolvedTypeDefinition)entity);
+ var type = (IUnresolvedTypeDefinition)entity;
+ switch (type.Kind) {
+ case TypeKind.Class:
+ return "class";
+ case TypeKind.Interface:
+ return "interface";
+ case TypeKind.Struct:
+ return "struct";
+ case TypeKind.Delegate:
+ return "delegate";
+ case TypeKind.Enum:
+ return "enum";
+ }
+ return "class";
case SymbolKind.Field:
- if (showAccessibility)
- return fieldIconTable [(int)entity.Accessibility];
- else
- return fieldIconTable [0];
+ return "field";
+ case SymbolKind.Event:
+ return "event";
case SymbolKind.Method:
case SymbolKind.Constructor:
case SymbolKind.Destructor:
case SymbolKind.Operator:
- if (showAccessibility)
- return methodIconTable [(int)entity.Accessibility];
- else
- return methodIconTable [0];
+ return "method";
case SymbolKind.Property:
case SymbolKind.Indexer:
- if (showAccessibility)
- return propertyIconTable [(int)entity.Accessibility];
- else
- return propertyIconTable [0];
- case SymbolKind.Event:
- if (showAccessibility)
- return eventIconTable [(int)entity.Accessibility];
- else
- return eventIconTable [0];
+ return "property";
}
return "";
}
}
-}
-
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorDebuggerEngine.cs b/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorDebuggerEngine.cs
index 092f0ae140..db58871ac4 100644
--- a/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorDebuggerEngine.cs
+++ b/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorDebuggerEngine.cs
@@ -66,7 +66,7 @@ namespace MonoDevelop.Debugger.Win32
public DebuggerSession CreateSession ( )
{
- return new CorDebuggerSession ();
+ return MtaThread.Run(() => new CorDebuggerSession());
}
public ProcessInfo[] GetAttachableProcesses ( )
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/EvaluationTests.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/EvaluationTests.cs
index 0b212ede4c..f9982813e2 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/EvaluationTests.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/EvaluationTests.cs
@@ -1529,6 +1529,7 @@ namespace MonoDevelop.Debugger.Tests
Assert.AreEqual ("{int[2][]}", val.Value);
Assert.AreEqual ("int[][]", val.TypeName);
+ IgnoreCorDebugger ("Randomly fails");
val = Eval ("arrayWithLowerBounds");
Assert.AreEqual ("int[,,]", val.TypeName);
@@ -1539,8 +1540,6 @@ namespace MonoDevelop.Debugger.Tests
Assert.AreEqual ("int[,,]", val.TypeName);
Assert.IsFalse (val.IsNull);
- IgnoreCorDebugger ("Randomly fails");
-
val = Eval ("nulledByteArray");
Assert.AreEqual ("(null)", val.Value);
Assert.AreEqual ("byte[]", val.TypeName);
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/CodeBehindWriter.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/CodeBehindWriter.cs
index ca8035a582..3b025914ed 100644
--- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/CodeBehindWriter.cs
+++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/CodeBehindWriter.cs
@@ -116,9 +116,15 @@ namespace MonoDevelop.DesignerSupport
});
WrittenCount++;
} catch (IOException ex) {
- monitor.ReportError (GettextCatalog.GetString ("Failed to write file '{0}'.", path), ex);
+ if (monitor != null)
+ monitor.ReportError (GettextCatalog.GetString ("Failed to write file '{0}'.", path), ex);
+ else
+ LoggingService.LogError ("CodeBehindWriter failed", ex);
} catch (Exception ex) {
- monitor.ReportError (GettextCatalog.GetString ("Failed to generate code for file '{0}'.", path), ex);
+ if (monitor != null)
+ monitor.ReportError (GettextCatalog.GetString ("Failed to generate code for file '{0}'.", path), ex);
+ else
+ LoggingService.LogError ("CodeBehindWriter failed", ex);
}
}
@@ -145,9 +151,15 @@ namespace MonoDevelop.DesignerSupport
});
WrittenCount++;
} catch (IOException ex) {
- monitor.ReportError (GettextCatalog.GetString ("Failed to write file '{0}'.", path), ex);
+ if (monitor != null)
+ monitor.ReportError (GettextCatalog.GetString ("Failed to write file '{0}'.", path), ex);
+ else
+ LoggingService.LogError ("CodeBehindWriter failed", ex);
} catch (Exception ex) {
- monitor.ReportError (GettextCatalog.GetString ("Failed to generate code for file '{0}'.", path), ex);
+ if (monitor != null)
+ monitor.ReportError (GettextCatalog.GetString ("Failed to generate code for file '{0}'.", path), ex);
+ else
+ LoggingService.LogError ("CodeBehindWriter failed", ex);
}
}
@@ -195,9 +207,10 @@ namespace MonoDevelop.DesignerSupport
WrittenCount++;
} catch (IOException ex) {
- monitor.ReportError (
- GettextCatalog.GetString ("Failed to write file '{0}'.", item.Key),
- ex);
+ if (monitor != null)
+ monitor.ReportError (GettextCatalog.GetString ("Failed to write file '{0}'.", item.Key), ex);
+ else
+ LoggingService.LogError ("CodeBehindWriter failed", ex);
}
}
});
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/AnalysisCommands.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/AnalysisCommands.cs
index ee20f804d3..4bba040f78 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/AnalysisCommands.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/AnalysisCommands.cs
@@ -41,6 +41,7 @@ using System.IO;
using MonoDevelop.Refactoring;
using MonoDevelop.Ide.Gui.Dialogs;
using Microsoft.CodeAnalysis;
+using MonoDevelop.Components.Extensions;
namespace MonoDevelop.AnalysisCore
{
@@ -286,7 +287,7 @@ namespace MonoDevelop.AnalysisCore
{
var lang = "text/x-csharp";
- OpenFileDialog dlg = new OpenFileDialog ("Export Rules", FileChooserAction.Save);
+ OpenFileDialog dlg = new OpenFileDialog ("Export Rules", MonoDevelop.Components.FileChooserAction.Save);
dlg.InitialFileName = "rules.html";
if (!dlg.Run ())
return;
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/HighlightingPanel.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/HighlightingPanel.cs
index a5759e86ea..63219fac03 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/HighlightingPanel.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/HighlightingPanel.cs
@@ -33,6 +33,7 @@ using MonoDevelop.Core;
using MonoDevelop.Ide;
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Ide.Editor;
+using MonoDevelop.Components.Extensions;
namespace MonoDevelop.SourceEditor.OptionPanels
{
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs
index 10203916bf..6c43de0444 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs
@@ -3021,8 +3021,8 @@ namespace MonoDevelop.SourceEditor
}
public double ZoomLevel {
- get { return TextEditor.Options.Zoom; }
- set { TextEditor.Options.Zoom = value; }
+ get { return TextEditor != null && TextEditor.Options != null ? TextEditor.Options.Zoom : 1d; }
+ set { if (TextEditor != null && TextEditor.Options != null) TextEditor.Options.Zoom = value; }
}
event EventHandler ITextEditorImpl.ZoomLevelChanged {
add {
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/gui.stetic b/main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/gui.stetic
index 93a698b0ee..e4fbf10592 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/gui.stetic
+++ b/main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/gui.stetic
@@ -7,6 +7,7 @@
<import>
<widget-library name="../../../../build/bin/MonoDevelop.Ide.dll" />
<widget-library name="../../../../build/AddIns/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.dll" />
+ <widget-library name="../../../../build/AddIns/MonoDevelop.Debugger/MonoDevelop.Debugger.dll" />
<widget-library name="../../../../build/bin/Mono.TextEditor.dll" />
<widget-library name="../../../../build/AddIns/DisplayBindings/SourceEditor/MonoDevelop.SourceEditor.dll" internal="true" />
</import>
diff --git a/main/src/addins/NUnit/Services/NUnitProjectServiceExtension.cs b/main/src/addins/NUnit/Services/NUnitProjectServiceExtension.cs
index 777528694a..028061a0e9 100644
--- a/main/src/addins/NUnit/Services/NUnitProjectServiceExtension.cs
+++ b/main/src/addins/NUnit/Services/NUnitProjectServiceExtension.cs
@@ -30,6 +30,7 @@ using MonoDevelop.Projects;
using MonoDevelop.Ide;
using System.Threading.Tasks;
using System.Threading;
+using System.Runtime.InteropServices;
namespace MonoDevelop.NUnit
{
@@ -38,6 +39,43 @@ namespace MonoDevelop.NUnit
bool checkingCanExecute;
object canExecuteCheckLock = new object ();
+ bool unitTestChecked;
+ UnitTest unitTestFound;
+
+ protected override bool SupportsObject (WorkspaceObject item)
+ {
+ return IdeApp.IsInitialized && base.SupportsObject (item);
+ }
+
+ protected override void Initialize ()
+ {
+ base.Initialize ();
+ if (IdeApp.IsInitialized)
+ NUnitService.Instance.TestSuiteChanged += TestSuiteChanged;
+ }
+
+ public override void Dispose ()
+ {
+ base.Dispose ();
+ if (IdeApp.IsInitialized)
+ NUnitService.Instance.TestSuiteChanged -= TestSuiteChanged;
+ }
+
+ void TestSuiteChanged (object sender, System.EventArgs e)
+ {
+ unitTestChecked = false;
+ unitTestFound = null;
+ }
+
+ UnitTest FindRootTest ()
+ {
+ if (!unitTestChecked) {
+ unitTestFound = NUnitService.Instance.FindRootTest (Project);
+ unitTestChecked = true;
+ }
+ return unitTestFound;
+ }
+
protected override async Task OnExecute (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.ExecutionContext context, ConfigurationSelector configuration)
{
bool defaultCanExecute;
@@ -55,7 +93,7 @@ namespace MonoDevelop.NUnit
await base.OnExecute (monitor, context, configuration);
return;
}
- UnitTest test = NUnitService.Instance.FindRootTest (Project);
+ UnitTest test = FindRootTest ();
if (test != null) {
var cs = new CancellationTokenSource ();
using (monitor.CancellationToken.Register (cs.Cancel))
@@ -66,9 +104,9 @@ namespace MonoDevelop.NUnit
protected override ProjectFeatures OnGetSupportedFeatures ()
{
var sf = base.OnGetSupportedFeatures ();
- if (!sf.HasFlag (ProjectFeatures.Execute) && IdeApp.IsInitialized) {
+ if (!sf.HasFlag (ProjectFeatures.Execute)) {
// Unit test projects support execution
- UnitTest test = NUnitService.Instance.FindRootTest (Project);
+ UnitTest test = FindRootTest ();
if (test != null)
sf |= ProjectFeatures.Execute;
}
@@ -86,7 +124,7 @@ namespace MonoDevelop.NUnit
}
if (res)
return true;
- UnitTest test = NUnitService.Instance.FindRootTest (Project);
+ UnitTest test = FindRootTest ();
return (test != null) && test.CanRun (context.ExecutionHandler);
}
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/MonoDevelop.VersionControl.Subversion.Unix/SvnClient.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/MonoDevelop.VersionControl.Subversion.Unix/SvnClient.cs
index ac42434561..b5b20880f4 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/MonoDevelop.VersionControl.Subversion.Unix/SvnClient.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/MonoDevelop.VersionControl.Subversion.Unix/SvnClient.cs
@@ -195,6 +195,9 @@ namespace MonoDevelop.VersionControl.Subversion.Unix
public override string GetDirectoryDotSvn (FilePath path)
{
+ if (path.IsNullOrEmpty)
+ return string.Empty;
+
if (Pre_1_7)
return base.GetDirectoryDotSvn (path);
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/CommonTextEditorOptions.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/CommonTextEditorOptions.cs
index a0b04e7edd..d1486c22e8 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/CommonTextEditorOptions.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/CommonTextEditorOptions.cs
@@ -217,9 +217,9 @@ namespace MonoDevelop.VersionControl.Views
get { return defaultEolMarker; }
}
- public MonoDevelop.Ide.Editor.ControlLeftRightMode ControlLeftRightMode {
+ public MonoDevelop.Ide.Editor.WordNavigationStyle WordNavigationStyle {
get {
- return MonoDevelop.Ide.Editor.DefaultSourceEditorOptions.Instance.ControlLeftRightMode;
+ return MonoDevelop.Ide.Editor.DefaultSourceEditorOptions.Instance.WordNavigationStyle;
}
set {
}
@@ -244,14 +244,11 @@ namespace MonoDevelop.VersionControl.Views
return;
}
- switch (ControlLeftRightMode) {
- case MonoDevelop.Ide.Editor.ControlLeftRightMode.MonoDevelop:
+ switch (WordNavigationStyle) {
+ case MonoDevelop.Ide.Editor.WordNavigationStyle.Unix:
this.wordFindStrategy = new EmacsWordFindStrategy (true);
break;
- case MonoDevelop.Ide.Editor.ControlLeftRightMode.Emacs:
- this.wordFindStrategy = new EmacsWordFindStrategy (false);
- break;
- case MonoDevelop.Ide.Editor.ControlLeftRightMode.SharpDevelop:
+ case MonoDevelop.Ide.Editor.WordNavigationStyle.Windows:
this.wordFindStrategy = new SharpDevelopWordFindStrategy ();
break;
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs
index cfca0d186f..29be4e17b8 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs
@@ -485,7 +485,7 @@ namespace MonoDevelop.VersionControl.Views
} else {
day = rev.Time.ToShortDateString ();
}
- renderer.Text = string.Format ("{0} {1:HH:MM}", day, rev.Time);
+ renderer.Text = string.Format ("{0} {1:HH:mm}", day, rev.Time);
}
static void GraphFunc (Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
diff --git a/main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/OpenFileDialogHandler.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/OpenFileDialogHandler.cs
index 57574febd1..df890a1a99 100644
--- a/main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/OpenFileDialogHandler.cs
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/OpenFileDialogHandler.cs
@@ -36,6 +36,7 @@ using Microsoft.WindowsAPICodePack.Dialogs;
using Microsoft.WindowsAPICodePack.Dialogs.Controls;
using MonoDevelop.Components;
using MonoDevelop.Core;
+using MonoDevelop.Components.Extensions;
using MonoDevelop.Ide;
using MonoDevelop.Ide.Extensions;
using MonoDevelop.Ide.Gui;
diff --git a/main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/SelectFileDialogHandler.cs b/main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/SelectFileDialogHandler.cs
index a33639204a..ee641eb696 100644
--- a/main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/SelectFileDialogHandler.cs
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/Dialogs/SelectFileDialogHandler.cs
@@ -44,7 +44,7 @@ namespace MonoDevelop.Platform
var parent = data.TransientFor ?? MessageService.RootWindow;
CommonFileDialog dialog;
- if (data.Action == FileChooserAction.Open || data.Action == FileChooserAction.SelectFolder)
+ if ((data.Action & (FileChooserAction.Open | FileChooserAction.SelectFolder)) != 0)
dialog = new CustomCommonOpenFileDialog ();
else
dialog = new CommonSaveFileDialog ();
diff --git a/main/src/addins/Xml/Editor/BaseXmlEditorExtension.cs b/main/src/addins/Xml/Editor/BaseXmlEditorExtension.cs
index 39871d5af3..de58b78d86 100644
--- a/main/src/addins/Xml/Editor/BaseXmlEditorExtension.cs
+++ b/main/src/addins/Xml/Editor/BaseXmlEditorExtension.cs
@@ -50,6 +50,8 @@ using MonoDevelop.Xml.Dom;
using MonoDevelop.Xml.Parser;
using System.Threading.Tasks;
using System.Threading;
+using MonoDevelop.Components.Commands;
+using MonoDevelop.Ide.Commands;
namespace MonoDevelop.Xml.Editor
{
@@ -1028,5 +1030,95 @@ namespace MonoDevelop.Xml.Editor
EditorSelect (region);
}
#endregion
+
+ [CommandUpdateHandler (EditCommands.AddCodeComment)]
+ [CommandUpdateHandler (EditCommands.RemoveCodeComment)]
+ [CommandUpdateHandler (EditCommands.ToggleCodeComment)]
+ void ToggleCodeCommentCommandUpdate (CommandInfo info)
+ {
+ info.Enabled = true;
+ info.Visible = true;
+ }
+
+ bool IsInComment ()
+ {
+ Tracker.UpdateEngine ();
+ if (Tracker.Engine.CurrentState is XmlCommentState) {
+ return true;
+ }
+ //If we are not in comment, try parsing 3 letters so in case we are just after
+ //"<" of <!-- we come inside... and state changes into XmlCommentState
+ var engineClone = Tracker.Engine.GetTreeParser ();
+ int j = 0;
+ for (int i = engineClone.Position; i < Editor.Length && j < 3; i++, j++) {
+ engineClone.Push (Editor.GetCharAt (engineClone.Position));
+ }
+ return engineClone.CurrentState is XmlCommentState;
+ }
+
+ [CommandHandler (EditCommands.AddCodeComment)]
+ public void AddCodeCommentCommand ()
+ {
+ if (!IsInComment ()) {
+ ToggleCodeCommentCommandInternal (false);
+ }
+ }
+
+ [CommandHandler (EditCommands.RemoveCodeComment)]
+ public void RemoveCodeCommentCommand ()
+ {
+ if (IsInComment ()) {
+ ToggleCodeCommentCommandInternal (true);
+ }
+ }
+
+ [CommandHandler (EditCommands.ToggleCodeComment)]
+ public void ToggleCodeCommentCommand ()
+ {
+ ToggleCodeCommentCommandInternal (IsInComment ());
+ }
+
+ void ToggleCodeCommentCommandInternal (bool remove)
+ {
+ if (remove) {
+ //We are guarenteed we are inside comment start
+ var treeParser = Tracker.Engine.GetTreeParser ();
+ XComment commentNode = treeParser.Nodes.Peek () as XComment;
+ //Keep parsing XML until end of file or until comment node is ended
+ for (int i = treeParser.Position; i < Editor.Length; i++) {
+ treeParser.Push (Editor.GetCharAt (i));
+ if (commentNode != null) {
+ if (commentNode.IsEnded) {
+ break;
+ }
+ } else {
+ commentNode = treeParser.Nodes.Peek () as XComment;
+ }
+ }
+ //Comment doesn't close until end of file
+ if (commentNode == null || !commentNode.IsEnded) {
+ return;
+ }
+ var startOffset = Editor.LocationToOffset (commentNode.Region.Begin);
+ var endOffset = Editor.LocationToOffset (commentNode.Region.End) - 3 - 4;//-3 because End is after "-->", -4 because removed "<!--" just before
+ using (Editor.OpenUndoGroup ()) {
+ Editor.RemoveText (startOffset, 4);//4 equals "<!--"
+ Editor.RemoveText (endOffset, 3);//3 equals "-->"
+ }
+ } else {
+ using (Editor.OpenUndoGroup ()) {
+ if (Editor.IsSomethingSelected) {
+ //end variable is also used because inserting start deselectes text and Editor.SelectionRange.EndOffset becomes invalid
+ var end = Editor.SelectionRange.EndOffset + 4;//+4 equals "<!--" inserted in next line
+ Editor.InsertText (Editor.SelectionRange.Offset, "<!--");
+ Editor.InsertText (end, "-->");
+ } else {
+ var currentLine = Editor.GetLine (Editor.CaretLine);
+ Editor.InsertText (currentLine.Offset, "<!--");
+ Editor.InsertText (currentLine.EndOffset, "-->");//currentLine.EndOffset updates automaticlly
+ }
+ }
+ }
+ }
}
}
diff --git a/main/src/addins/Xml/Editor/XmlTextEditorExtension.cs b/main/src/addins/Xml/Editor/XmlTextEditorExtension.cs
index efa31cccce..b92d2508a7 100644
--- a/main/src/addins/Xml/Editor/XmlTextEditorExtension.cs
+++ b/main/src/addins/Xml/Editor/XmlTextEditorExtension.cs
@@ -666,19 +666,7 @@ namespace MonoDevelop.Xml.Editor
#endregion
#region Command handlers
-
- [CommandUpdateHandler (MonoDevelop.Ide.Commands.EditCommands.ToggleCodeComment)]
- protected void ToggleCodeCommentCommandUpdate (CommandInfo info)
- {
- info.Enabled = false;
- }
-
- [CommandHandler (MonoDevelop.Ide.Commands.EditCommands.ToggleCodeComment)]
- public void ToggleCodeCommentCommand ()
- {
- //FIXME: implement
- }
-
+
[CommandHandler (XmlCommands.CreateSchema)]
public void CreateSchemaCommand ()
{
diff --git a/main/src/addins/Xml/Parser/XmlCommentState.cs b/main/src/addins/Xml/Parser/XmlCommentState.cs
index c4ff6fb2e7..33ac93a3b1 100644
--- a/main/src/addins/Xml/Parser/XmlCommentState.cs
+++ b/main/src/addins/Xml/Parser/XmlCommentState.cs
@@ -64,6 +64,7 @@ namespace MonoDevelop.Xml.Parser
return Parent;
} else {
context.LogWarning ("The string '--' should not appear within comments.");
+ context.StateTag = NOMATCH;
}
} else {
// not any part of a '-->', so make sure matching is reset
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/ColorScheme.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/ColorScheme.cs
index 297da792ba..04e25725bd 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/ColorScheme.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor.Highlighting/ColorScheme.cs
@@ -445,6 +445,10 @@ namespace Mono.TextEditor.Highlighting
[ColorDescription(UserTypesTypeParametersKey, VSSetting = "User Types(Type parameters)")]
public ChunkStyle UserTypesTypeParameters { get; private set; }
+ public const string UserTypesMutableKey = "User Types(Mutable)";
+ [ColorDescription(UserTypesMutableKey, VSSetting = "User Types(Mutable")]
+ public ChunkStyle UserTypesMutable { get; private set; }
+
public const string UserFieldUsageKey = "User Field Usage";
[ColorDescription(UserFieldUsageKey, VSSetting = "Identifier")]
public ChunkStyle UserFieldUsage { get; private set; }
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Document/DocumentUpdateRequest.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Document/DocumentUpdateRequest.cs
index baa5551ec1..a964098a25 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Document/DocumentUpdateRequest.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Document/DocumentUpdateRequest.cs
@@ -83,7 +83,7 @@ namespace Mono.TextEditor
public override void Update (MonoTextEditor editor)
{
- editor.TextViewMargin.PurgeLayoutCache ();
+ //editor.TextViewMargin.PurgeLayoutCache ();
editor.RedrawLines (start, end);
}
}
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/LayoutCache.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/LayoutCache.cs
index ab99a0fa95..aa7127d6dd 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/LayoutCache.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/LayoutCache.cs
@@ -33,10 +33,10 @@ namespace Mono.TextEditor
/// </summary>
public class LayoutCache : IDisposable
{
- readonly Gtk.Widget widget;
+ readonly MonoTextEditor widget;
readonly Queue<LayoutProxy> layoutQueue = new Queue<LayoutProxy> ();
- public LayoutCache (Gtk.Widget widget)
+ public LayoutCache (MonoTextEditor widget)
{
if (widget == null)
throw new ArgumentNullException ("widget");
@@ -65,6 +65,7 @@ namespace Mono.TextEditor
{
readonly LayoutCache layoutCache;
readonly Pango.Layout layout;
+ int width = -1, height = -1, lineCount = -1;
public LayoutProxy (LayoutCache layoutCache, Pango.Layout layout)
{
@@ -134,11 +135,12 @@ namespace Mono.TextEditor
}
public int LineCount {
- get { return layout.LineCount; }
+ get { return lineCount < 0 ? lineCount = layout.LineCount : lineCount; }
}
public void SetText (string text)
{
+ this.width = this.height = lineCount = -1;
layout.SetText (text);
}
@@ -159,7 +161,14 @@ namespace Mono.TextEditor
public void GetSize (out int width, out int height)
{
- layout.GetSize (out width, out height);
+ if (this.width >= 0) {
+ width = this.width;
+ height = this.height;
+ return;
+ }
+ layout.GetSize (out width, out height);
+ this.width = width;
+ this.height = height;
}
public bool XyToIndex (int x, int y, out int index, out int trailing)
@@ -174,11 +183,29 @@ namespace Mono.TextEditor
public void GetPixelSize (out int width, out int height)
{
- layout.GetPixelSize (out width, out height);
+ if (this.width >= 0) {
+ width = (int)(this.width / Pango.Scale.PangoScale);
+ height = (int)(this.height / Pango.Scale.PangoScale);
+ return;
+ }
+
+ layout.GetPixelSize (out width, out height);
+ this.width = (int)(width * Pango.Scale.PangoScale);
+ this.height = (int)(height * Pango.Scale.PangoScale);
}
public void GetExtents (out Pango.Rectangle ink_rect, out Pango.Rectangle logical_rect)
{
+ if (this.width >= 0) {
+ ink_rect = logical_rect = new Pango.Rectangle {
+ X = 0,
+ Y = 0,
+ Width = width,
+ Height = height
+ };
+ return;
+ }
+
layout.GetExtents (out ink_rect, out logical_rect);
}
}
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs
index a3e4b4794f..f1d19cbfa1 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs
@@ -37,6 +37,7 @@ using Gdk;
using Gtk;
using System.Timers;
using ICSharpCode.NRefactory;
+using System.Diagnostics;
namespace Mono.TextEditor
{
@@ -869,144 +870,164 @@ namespace Mono.TextEditor
uint curChunkIndex = 0, byteChunkIndex = 0;
uint oldEndIndex = 0;
- foreach (Chunk chunk in chunks) {
- ChunkStyle chunkStyle = chunk != null ? textEditor.ColorStyle.GetChunkStyle (chunk) : null;
- foreach (TextLineMarker marker in line.Markers)
- chunkStyle = marker.GetStyle (chunkStyle);
-
- if (chunkStyle != null) {
- //startOffset = chunk.Offset;
- //endOffset = chunk.EndOffset;
-
- uint startIndex = (uint)(oldEndIndex);
- uint endIndex = (uint)(startIndex + chunk.Length);
- oldEndIndex = endIndex;
- HandleSelection (lineOffset, logicalRulerColumn, selectionStart, selectionEnd, chunk.Offset, chunk.EndOffset, delegate(int start, int end) {
- if (containsPreedit) {
- if (textEditor.preeditOffset < start)
- start += (int)preeditLength;
- if (textEditor.preeditOffset < end)
- end += (int)preeditLength;
- }
- var si = TranslateToUTF8Index (lineChars, (uint)(startIndex + start - chunk.Offset), ref curIndex, ref byteIndex);
- var ei = TranslateToUTF8Index (lineChars, (uint)(startIndex + end - chunk.Offset), ref curIndex, ref byteIndex);
- var color = ColorStyle.GetForeground (chunkStyle);
- foreach (var marker in markers) {
- var chunkMarker = marker as IChunkMarker;
- if (chunkMarker == null)
- continue;
- chunkMarker.ChangeForeColor (textEditor, chunk, ref color);
- }
- atts.AddForegroundAttribute ((HslColor)color, si, ei);
-
- if (!chunkStyle.TransparentBackground && GetPixel (ColorStyle.PlainText.Background) != GetPixel (chunkStyle.Background)) {
- wrapper.AddBackground (chunkStyle.Background, (int)si, (int)ei);
- } else if (chunk.SpanStack != null && ColorStyle != null) {
- foreach (var span in chunk.SpanStack) {
- if (span == null || string.IsNullOrEmpty (span.Color))
+ bool disableHighlighting = false;
+ var sw = new Stopwatch ();
+ sw.Start ();
+ try {
+ restart:
+ foreach (Chunk chunk in chunks) {
+ if (!disableHighlighting && sw.ElapsedMilliseconds > 50) {
+ chunks.Clear ();
+ chunks.Add (new Chunk (line.Offset, line.Length, "Plain Text"));
+ disableHighlighting = true;
+ atts.Dispose ();
+ atts = new FastPangoAttrList ();
+ curIndex = byteIndex = 0;
+ curChunkIndex = byteChunkIndex = 0;
+ oldEndIndex = 0;
+ goto restart;
+ }
+ ChunkStyle chunkStyle = chunk != null ? textEditor.ColorStyle.GetChunkStyle (chunk) : null;
+ foreach (TextLineMarker marker in line.Markers)
+ chunkStyle = marker.GetStyle (chunkStyle);
+
+ if (chunkStyle != null) {
+ //startOffset = chunk.Offset;
+ //endOffset = chunk.EndOffset;
+
+ uint startIndex = (uint)(oldEndIndex);
+ uint endIndex = (uint)(startIndex + chunk.Length);
+ oldEndIndex = endIndex;
+ HandleSelection (lineOffset, logicalRulerColumn, selectionStart, selectionEnd, chunk.Offset, chunk.EndOffset, delegate (int start, int end) {
+ if (containsPreedit) {
+ if (textEditor.preeditOffset < start)
+ start += (int)preeditLength;
+ if (textEditor.preeditOffset < end)
+ end += (int)preeditLength;
+ }
+ var si = TranslateToUTF8Index (lineChars, (uint)(startIndex + start - chunk.Offset), ref curIndex, ref byteIndex);
+ var ei = TranslateToUTF8Index (lineChars, (uint)(startIndex + end - chunk.Offset), ref curIndex, ref byteIndex);
+ var color = ColorStyle.GetForeground (chunkStyle);
+ foreach (var marker in markers) {
+ var chunkMarker = marker as IChunkMarker;
+ if (chunkMarker == null)
continue;
- var spanStyle = ColorStyle.GetChunkStyle (span.Color);
- if (spanStyle != null && !spanStyle.TransparentBackground && GetPixel (ColorStyle.PlainText.Background) != GetPixel (spanStyle.Background)) {
- wrapper.AddBackground (spanStyle.Background, (int)si, (int)ei);
- break;
+ chunkMarker.ChangeForeColor (textEditor, chunk, ref color);
+ }
+ atts.AddForegroundAttribute ((HslColor)color, si, ei);
+
+ if (!chunkStyle.TransparentBackground && GetPixel (ColorStyle.PlainText.Background) != GetPixel (chunkStyle.Background)) {
+ wrapper.AddBackground (chunkStyle.Background, (int)si, (int)ei);
+ } else if (chunk.SpanStack != null && ColorStyle != null) {
+ foreach (var span in chunk.SpanStack) {
+ if (span == null || string.IsNullOrEmpty (span.Color))
+ continue;
+ var spanStyle = ColorStyle.GetChunkStyle (span.Color);
+ if (spanStyle != null && !spanStyle.TransparentBackground && GetPixel (ColorStyle.PlainText.Background) != GetPixel (spanStyle.Background)) {
+ wrapper.AddBackground (spanStyle.Background, (int)si, (int)ei);
+ break;
+ }
}
}
- }
- }, delegate(int start, int end) {
- if (containsPreedit) {
- if (textEditor.preeditOffset < start)
- start += (int)preeditLength;
- if (textEditor.preeditOffset < end)
- end += (int)preeditLength;
- }
- var si = TranslateToUTF8Index (lineChars, (uint)(startIndex + start - chunk.Offset), ref curIndex, ref byteIndex);
- var ei = TranslateToUTF8Index (lineChars, (uint)(startIndex + end - chunk.Offset), ref curIndex, ref byteIndex);
- var color = !SelectionColor.TransparentForeground ? SelectionColor.Foreground : ColorStyle.GetForeground (chunkStyle);
- foreach (var marker in markers) {
- var chunkMarker = marker as IChunkMarker;
- if (chunkMarker == null)
- continue;
- chunkMarker.ChangeForeColor (textEditor, chunk, ref color);
- }
- atts.AddForegroundAttribute ((HslColor)color, si, ei);
- if (!wrapper.StartSet)
- wrapper.SelectionStartIndex = (int)si;
- wrapper.SelectionEndIndex = (int)ei;
- });
+ }, delegate (int start, int end) {
+ if (containsPreedit) {
+ if (textEditor.preeditOffset < start)
+ start += (int)preeditLength;
+ if (textEditor.preeditOffset < end)
+ end += (int)preeditLength;
+ }
+ var si = TranslateToUTF8Index (lineChars, (uint)(startIndex + start - chunk.Offset), ref curIndex, ref byteIndex);
+ var ei = TranslateToUTF8Index (lineChars, (uint)(startIndex + end - chunk.Offset), ref curIndex, ref byteIndex);
+ var color = !SelectionColor.TransparentForeground ? SelectionColor.Foreground : ColorStyle.GetForeground (chunkStyle);
+ foreach (var marker in markers) {
+ var chunkMarker = marker as IChunkMarker;
+ if (chunkMarker == null)
+ continue;
+ chunkMarker.ChangeForeColor (textEditor, chunk, ref color);
+ }
+ atts.AddForegroundAttribute ((HslColor)color, si, ei);
+ if (!wrapper.StartSet)
+ wrapper.SelectionStartIndex = (int)si;
+ wrapper.SelectionEndIndex = (int)ei;
+ });
- var translatedStartIndex = TranslateToUTF8Index (lineChars, (uint)startIndex, ref curChunkIndex, ref byteChunkIndex);
- var translatedEndIndex = TranslateToUTF8Index (lineChars, (uint)endIndex, ref curChunkIndex, ref byteChunkIndex);
+ var translatedStartIndex = TranslateToUTF8Index (lineChars, (uint)startIndex, ref curChunkIndex, ref byteChunkIndex);
+ var translatedEndIndex = TranslateToUTF8Index (lineChars, (uint)endIndex, ref curChunkIndex, ref byteChunkIndex);
- if (chunkStyle.FontWeight != Xwt.Drawing.FontWeight.Normal)
- atts.AddWeightAttribute ((Pango.Weight)chunkStyle.FontWeight, translatedStartIndex, translatedEndIndex);
+ if (chunkStyle.FontWeight != Xwt.Drawing.FontWeight.Normal)
+ atts.AddWeightAttribute ((Pango.Weight)chunkStyle.FontWeight, translatedStartIndex, translatedEndIndex);
- if (chunkStyle.FontStyle != Xwt.Drawing.FontStyle.Normal)
- atts.AddStyleAttribute ((Pango.Style)chunkStyle.FontStyle, translatedStartIndex, translatedEndIndex);
+ if (chunkStyle.FontStyle != Xwt.Drawing.FontStyle.Normal)
+ atts.AddStyleAttribute ((Pango.Style)chunkStyle.FontStyle, translatedStartIndex, translatedEndIndex);
- if (chunkStyle.Underline)
- atts.AddUnderlineAttribute (Pango.Underline.Single, translatedStartIndex, translatedEndIndex);
+ if (chunkStyle.Underline)
+ atts.AddUnderlineAttribute (Pango.Underline.Single, translatedStartIndex, translatedEndIndex);
+ }
}
- }
- if (containsPreedit) {
- var si = TranslateToUTF8Index (lineChars, (uint)(textEditor.preeditOffset - offset), ref curIndex, ref byteIndex);
- var ei = TranslateToUTF8Index (lineChars, (uint)(textEditor.preeditOffset - offset + preeditLength), ref curIndex, ref byteIndex);
+ if (containsPreedit) {
+ var si = TranslateToUTF8Index (lineChars, (uint)(textEditor.preeditOffset - offset), ref curIndex, ref byteIndex);
+ var ei = TranslateToUTF8Index (lineChars, (uint)(textEditor.preeditOffset - offset + preeditLength), ref curIndex, ref byteIndex);
- if (textEditor.GetTextEditorData ().IsCaretInVirtualLocation) {
- uint len = (uint)textEditor.GetTextEditorData ().GetIndentationString (textEditor.Caret.Location).Length;
- si += len;
- ei += len;
- }
-
- atts.AddForegroundAttribute ((HslColor)ColorStyle.PlainText.Foreground, si, ei);
- var hasBackground = wrapper.BackgroundColors.Any (bg => bg.FromIdx <= si && bg.ToIdx >= ei);
- if (hasBackground)
- atts.AddBackgroundAttribute ((HslColor)ColorStyle.PlainText.Background, si, ei);
- atts.InsertOffsetList (textEditor.preeditAttrs, si, ei);
- }
- wrapper.LineChars = lineChars;
- wrapper.Layout.SetText (lineText);
- wrapper.IndentSize = 0;
- var tabSize = textEditor.Options != null ? textEditor.Options.TabSize : 4;
- for (int i = 0; i < lineChars.Length; i++) {
- char ch = lineChars [i];
- if (ch == ' ') {
- wrapper.IndentSize ++;
- } else if (ch == '\t') {
- wrapper.IndentSize = GetNextTabstop (textEditor.GetTextEditorData (), wrapper.IndentSize, tabSize);
- } else {
- break;
+ if (textEditor.GetTextEditorData ().IsCaretInVirtualLocation) {
+ uint len = (uint)textEditor.GetTextEditorData ().GetIndentationString (textEditor.Caret.Location).Length;
+ si += len;
+ ei += len;
+ }
+
+ atts.AddForegroundAttribute ((HslColor)ColorStyle.PlainText.Foreground, si, ei);
+ var hasBackground = wrapper.BackgroundColors.Any (bg => bg.FromIdx <= si && bg.ToIdx >= ei);
+ if (hasBackground)
+ atts.AddBackgroundAttribute ((HslColor)ColorStyle.PlainText.Background, si, ei);
+ atts.InsertOffsetList (textEditor.preeditAttrs, si, ei);
+ }
+ wrapper.LineChars = lineChars;
+ wrapper.Layout.SetText (lineText);
+ wrapper.IndentSize = 0;
+ var tabSize = textEditor.Options != null ? textEditor.Options.TabSize : 4;
+ for (int i = 0; i < lineChars.Length; i++) {
+ char ch = lineChars [i];
+ if (ch == ' ') {
+ wrapper.IndentSize++;
+ } else if (ch == '\t') {
+ wrapper.IndentSize = GetNextTabstop (textEditor.GetTextEditorData (), wrapper.IndentSize, tabSize);
+ } else {
+ break;
+ }
}
- }
- var nextLine = line.NextLine;
- wrapper.EolSpanStack = nextLine != null ? nextLine.StartSpan : null;
- atts.AssignTo (wrapper.Layout);
- atts.Dispose ();
- int w, h;
- wrapper.Layout.GetSize (out w, out h);
- wrapper.Width = System.Math.Floor (w / Pango.Scale.PangoScale);
- wrapper.Height = System.Math.Floor (h / Pango.Scale.PangoScale);
+ var nextLine = line.NextLine;
+ wrapper.EolSpanStack = nextLine != null ? nextLine.StartSpan : null;
+ atts.AssignTo (wrapper.Layout);
+ atts.Dispose ();
+ int w, h;
+ wrapper.Layout.GetSize (out w, out h);
+ wrapper.Width = System.Math.Floor (w / Pango.Scale.PangoScale);
+ wrapper.Height = System.Math.Floor (h / Pango.Scale.PangoScale);
+
+ var lines = wrapper.Layout.LineCount;
+
+ if (lines == 1) {
+ wrapper.LastLineWidth = wrapper.Width;
+ } else {
+ var layoutLine = wrapper.Layout.GetLine (lines - 1);
+ Pango.Rectangle iR = Pango.Rectangle.Zero;
+ Pango.Rectangle lR = Pango.Rectangle.Zero;
+ layoutLine.GetExtents (ref iR, ref lR);
+ wrapper.LastLineWidth = System.Math.Floor (lR.Width / Pango.Scale.PangoScale);
+ }
- var lines = wrapper.Layout.LineCount;
- if (lines == 1) {
- wrapper.LastLineWidth = wrapper.Width;
- } else {
- var layoutLine = wrapper.Layout.GetLine (lines - 1);
- Pango.Rectangle iR = Pango.Rectangle.Zero;
- Pango.Rectangle lR = Pango.Rectangle.Zero;
- layoutLine.GetExtents (ref iR, ref lR);
- wrapper.LastLineWidth = System.Math.Floor (lR.Width / Pango.Scale.PangoScale);
+ selectionStart = System.Math.Max (line.Offset - 1, selectionStart);
+ selectionEnd = System.Math.Min (line.EndOffsetIncludingDelimiter + 1, selectionEnd);
+ descriptor = new LayoutDescriptor (line, offset, length, wrapper, selectionStart, selectionEnd);
+ if (!containsPreedit) {
+ layoutDict [line] = descriptor;
+ }
+ // textEditor.GetTextEditorData ().HeightTree.SetLineHeight (line.LineNumber, System.Math.Max (LineHeight, wrapper.Height));
+ return wrapper;
+ } finally {
+ sw.Stop ();
}
-
-
- selectionStart = System.Math.Max (line.Offset - 1, selectionStart);
- selectionEnd = System.Math.Min (line.EndOffsetIncludingDelimiter + 1, selectionEnd);
- descriptor = new LayoutDescriptor (line, offset, length, wrapper, selectionStart, selectionEnd);
- if (!containsPreedit)
- layoutDict [line] = descriptor;
-// textEditor.GetTextEditorData ().HeightTree.SetLineHeight (line.LineNumber, System.Math.Max (LineHeight, wrapper.Height));
- return wrapper;
}
public void RemoveCachedLine (DocumentLine line)
diff --git a/main/src/core/Mono.Texteditor/Styles/DefaultStyle.json b/main/src/core/Mono.Texteditor/Styles/DefaultStyle.json
index 9289beff15..75b35b1085 100644
--- a/main/src/core/Mono.Texteditor/Styles/DefaultStyle.json
+++ b/main/src/core/Mono.Texteditor/Styles/DefaultStyle.json
@@ -191,6 +191,7 @@
{ "name":"User Types(Delegates)", "fore":"skyblue2" },
{ "name":"User Types(Value types)", "fore":"skyblue2" },
{ "name":"User Types(Type parameters)", "fore":"skyblue2" },
+ { "name":"User Types(Mutable)", "fore":"aluminium1", "back":"invalid-red" },
{ "name":"User Field Usage", "fore":"text-black" },
{ "name":"User Field Declaration", "fore":"text-black" },
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/IBuildTarget.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/IBuildTarget.cs
index 1e31ca4df0..4838362f9d 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/IBuildTarget.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/IBuildTarget.cs
@@ -66,6 +66,13 @@ namespace MonoDevelop.Projects
bool CanExecute (ExecutionContext context, ConfigurationSelector configuration);
/// <summary>
+ /// Determines whether this target can be built using the specified configuration.
+ /// </summary>
+ /// <returns><c>true</c> if this instance can be built; otherwise, <c>false</c>.</returns>
+ /// <param name="configuration">Configuration.</param>
+ bool CanBuild (ConfigurationSelector configuration);
+
+ /// <summary>
/// Prepares the target for execution
/// </summary>
/// <returns>The execution.</returns>
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs
index 5258723bc1..11570a89bf 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Project.cs
@@ -1437,10 +1437,7 @@ namespace MonoDevelop.Projects
}
if (UsingMSBuildEngine (configuration)) {
- var result = await RunMSBuildTarget (monitor, "Clean", configuration, context);
- if (!result.BuildResult.Failed)
- SetFastBuildCheckClean (configuration);
- return result;
+ return await RunMSBuildTarget (monitor, "Clean", configuration, context);
}
monitor.Log.WriteLine ("Removing output files...");
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectFile.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectFile.cs
index 642afc4621..5b5697fc85 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectFile.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectFile.cs
@@ -488,6 +488,7 @@ namespace MonoDevelop.Projects
pf.Project = null;
pf.VirtualPathChanged = null;
pf.PathChanged = null;
+ pf.BackingItem = null;
return pf;
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectItem.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectItem.cs
index 8edff833dc..dfd1fc06e3 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectItem.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectItem.cs
@@ -69,7 +69,7 @@ namespace MonoDevelop.Projects
}
set {
backingItem = value;
- UnevaluatedInclude = backingItem.Include;
+ UnevaluatedInclude = backingItem?.Include;
}
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs
index 4235c0fe1c..ded10dee83 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs
@@ -630,6 +630,11 @@ namespace MonoDevelop.Projects
}
}
+ bool IBuildTarget.CanBuild (ConfigurationSelector configuration)
+ {
+ return true;
+ }
+
public Task<BuildResult> Clean (ProgressMonitor monitor, string configuration)
{
return Clean (monitor, (SolutionConfigurationSelector) configuration);
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionFolder.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionFolder.cs
index a4368996c8..f290e327e4 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionFolder.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionFolder.cs
@@ -564,6 +564,11 @@ namespace MonoDevelop.Projects
return null;
}
+ bool IBuildTarget.CanBuild (ConfigurationSelector configuration)
+ {
+ return true;
+ }
+
public async Task<BuildResult> Clean (ProgressMonitor monitor, ConfigurationSelector configuration, OperationContext operationContext = null)
{
if (ParentSolution == null)
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItem.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItem.cs
index 7887b13f3d..1bf201f4cf 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItem.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItem.cs
@@ -468,6 +468,11 @@ namespace MonoDevelop.Projects
get { return fileStatusTracker.ItemFilesChanged; }
}
+ bool IBuildTarget.CanBuild (ConfigurationSelector configuration)
+ {
+ return SupportsBuild ();
+ }
+
public bool SupportsBuild ()
{
return ItemExtension.OnGetSupportedFeatures ().HasFlag (ProjectFeatures.Build);
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Workspace.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Workspace.cs
index 1604358c93..2a6342bfdc 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Workspace.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Workspace.cs
@@ -73,6 +73,11 @@ namespace MonoDevelop.Projects
base.OnDispose ();
}
+ bool IBuildTarget.CanBuild (ConfigurationSelector configuration)
+ {
+ return true;
+ }
+
[ThreadSafe]
public async Task<BuildResult> Build (ProgressMonitor monitor, ConfigurationSelector configuration, bool buildReferencedTargets = false, OperationContext operationContext = null)
{
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/GtkWidgetResult.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/GtkWidgetResult.cs
index bbf681d4b7..bac92d6f21 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/GtkWidgetResult.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.AutoTest.Results/GtkWidgetResult.cs
@@ -446,12 +446,13 @@ namespace MonoDevelop.Components.AutoTest.Results
return;
}
- Cairo.Context cr = Gdk.CairoHelper.Create (resultWidget.GdkWindow);
- cr.SetSourceRGB (1.0, 0.0, 0.0);
+ using (var cr = Gdk.CairoHelper.Create (resultWidget.GdkWindow)) {
+ cr.SetSourceRGB (1.0, 0.0, 0.0);
- Gdk.Rectangle allocation = resultWidget.Allocation;
- Gdk.CairoHelper.Rectangle (cr, allocation);
- cr.Stroke ();
+ Gdk.Rectangle allocation = resultWidget.Allocation;
+ Gdk.CairoHelper.Rectangle (cr, allocation);
+ cr.Stroke ();
+ }
}
public override void Flash ()
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbarController.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbarController.cs
index f69f95cc89..daacba7a22 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbarController.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbarController.cs
@@ -345,7 +345,7 @@ namespace MonoDevelop.Components.MainToolbar
bool SelectActiveRuntime (ref bool selected, ref ExecutionTarget defaultTarget, ref int defaultIter)
{
var runtimes = ToolbarView.RuntimeModel.Cast<RuntimeModel> ().ToList ();
- string lastRuntimeForProject = currentStartupProject.UserProperties.GetValue<string> ("PreferredExecutionTarget", defaultValue: null);
+ string lastRuntimeForProject = currentStartupProject?.UserProperties.GetValue<string> ("PreferredExecutionTarget", defaultValue: null);
var activeTarget = IdeApp.Workspace.ActiveExecutionTarget;
var activeTargetId = activeTarget != null ? activeTarget.Id : null;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchPopupWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchPopupWindow.cs
index 189f21b7c7..9ad1fba8bc 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchPopupWindow.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchPopupWindow.cs
@@ -191,9 +191,9 @@ namespace MonoDevelop.Components.MainToolbar
return;
if (region.Length <= 0) {
if (Pattern.LineNumber == 0) {
- IdeApp.Workbench.OpenDocument (SelectedItemFileName);
+ IdeApp.Workbench.OpenDocument (SelectedItemFileName, project: null);
} else {
- IdeApp.Workbench.OpenDocument (SelectedItemFileName, Pattern.LineNumber, Pattern.HasColumn ? Pattern.Column : 1);
+ IdeApp.Workbench.OpenDocument (SelectedItemFileName, null, Pattern.LineNumber, Pattern.HasColumn ? Pattern.Column : 1);
}
} else {
IdeApp.Workbench.OpenDocument (new FileOpenInformation (SelectedItemFileName, null) {
@@ -304,21 +304,23 @@ namespace MonoDevelop.Components.MainToolbar
Task.WhenAll (collectors.Select (c => c.Task)).ContinueWith (t => {
if (t.IsCanceled)
- return;
- if (t.IsFaulted) {
- LoggingService.LogError ("Error getting search results", t.Exception);
- } else {
- Application.Invoke (delegate {
- RemoveTimeout ();
- if (token.IsCancellationRequested)
- return;
- foreach (var col in collectors) {
- ShowResult (col.Category, col.Results);
- }
- isInSearch = false;
- AnimatedResize ();
- });
- }
+ return;
+ Application.Invoke (delegate {
+ RemoveTimeout ();
+ if (token.IsCancellationRequested)
+ return;
+ foreach (var col in collectors) {
+ if (col.Task.IsCanceled) {
+ continue;
+ } else if (col.Task.IsFaulted) {
+ LoggingService.LogError ($"Error getting search results for {col.Category}", col.Task.Exception);
+ } else {
+ ShowResult (col.Category, col.Results);
+ }
+ }
+ isInSearch = false;
+ AnimatedResize ();
+ });
}, token);
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchResult.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchResult.cs
index e8e78b0a62..9c55d54b90 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchResult.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchResult.cs
@@ -272,7 +272,12 @@ namespace MonoDevelop.Components.MainToolbar
public override bool IsValid {
get {
if (ci == null) {
+ //GetCommandInfo throws exception if GetActionCommand returns null
+ if (CommandManager.ToCommandId (IdeApp.CommandService.GetActionCommand (command.Id)) == null) {
+ return false;
+ }
DispatchService.GuiSyncDispatch (delegate {
+
ci = IdeApp.CommandService.GetCommandInfo (command.Id, new CommandTargetRoute (MainToolbar.LastCommandTarget));
});
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/FileChooserAction.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/FileChooserAction.cs
index 0ce8ea0e45..1136f7bde7 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/FileChooserAction.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/FileChooserAction.cs
@@ -27,30 +27,32 @@ using System;
namespace MonoDevelop.Components
{
+ [Flags]
public enum FileChooserAction
{
- Open,
- Save,
- SelectFolder,
- CreateFolder,
+ Open = 0x1,
+ Save = 0x2,
+ SelectFolder = 0x4,
+ CreateFolder = 0x8,
+
+ FolderFlags = CreateFolder | SelectFolder,
+ FileFlags = Open | Save,
}
static class FileChooserActionExtensions
{
public static Gtk.FileChooserAction ToGtkAction(this FileChooserAction action)
{
- switch (action) {
- case FileChooserAction.Open:
+ if ((action & FileChooserAction.CreateFolder) != 0)
+ return Gtk.FileChooserAction.CreateFolder;
+ else if ((action & FileChooserAction.SelectFolder) != 0)
+ return Gtk.FileChooserAction.SelectFolder;
+ else if ((action & FileChooserAction.Open) != 0)
return Gtk.FileChooserAction.Open;
- case FileChooserAction.Save:
+ else if ((action & FileChooserAction.Save) != 0)
return Gtk.FileChooserAction.Save;
- case FileChooserAction.SelectFolder:
- return Gtk.FileChooserAction.SelectFolder;
- case FileChooserAction.CreateFolder:
- return Gtk.FileChooserAction.CreateFolder;
- default:
+ else
throw new NotSupportedException ();
- }
}
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatterService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatterService.cs
index 6459b3b821..3c028ac631 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatterService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatterService.cs
@@ -83,7 +83,7 @@ namespace MonoDevelop.Ide.CodeFormatting
if (fmt == null)
return;
if (fmt.SupportsOnTheFlyFormatting) {
- fmt.OnTheFlyFormat (editor, ctx, segment.Offset, segment.EndOffset);
+ fmt.OnTheFlyFormat (editor, ctx, segment);
return;
}
editor.Text = fmt.FormatText (ctx.HasProject ? ctx.Project.Policies : null, editor.Text, segment);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplate.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplate.cs
index 376002197d..d3f0f3a801 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplate.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplate.cs
@@ -452,7 +452,7 @@ namespace MonoDevelop.Ide.CodeTemplates
if (prettyPrinter != null && prettyPrinter.SupportsOnTheFlyFormatting) {
int endOffset = template.InsertPosition + template.Code.Length;
var oldVersion = data.Version;
- prettyPrinter.OnTheFlyFormat (editor, context, template.InsertPosition, endOffset);
+ prettyPrinter.OnTheFlyFormat (editor, context, TextSegment.FromBounds (template.InsertPosition, endOffset));
foreach (var textLink in template.TextLinks) {
for (int i = 0; i < textLink.Links.Count; i++) {
var segment = textLink.Links [i];
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/FileCommands.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/FileCommands.cs
index 568003eb4a..dfeea4fe2d 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/FileCommands.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/FileCommands.cs
@@ -39,6 +39,7 @@ using MonoDevelop.Ide.Projects;
using MonoDevelop.Ide.Desktop;
using System.Linq;
using MonoDevelop.Components;
+using MonoDevelop.Components.Extensions;
namespace MonoDevelop.Ide.Commands
{
@@ -294,7 +295,7 @@ namespace MonoDevelop.Ide.Commands
protected override void Run (object dataItem)
{
- IdeApp.Workbench.OpenDocument ((string)dataItem);
+ IdeApp.Workbench.OpenDocument ((string)dataItem, project: null);
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ProjectCommands.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ProjectCommands.cs
index 79f19fb9ac..03a3f1bff2 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ProjectCommands.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ProjectCommands.cs
@@ -173,7 +173,7 @@ namespace MonoDevelop.Ide.Commands
{
if (IdeApp.Workspace.IsOpen) {
IBuildTarget buildTarget = IdeApp.ProjectOperations.CurrentSelectedBuildTarget;
- info.Enabled = (buildTarget != null) && (IdeApp.ProjectOperations.CurrentBuildOperation.IsCompleted);
+ info.Enabled = (buildTarget != null) && (IdeApp.ProjectOperations.CurrentBuildOperation.IsCompleted) && buildTarget.CanBuild (IdeApp.Workspace.ActiveConfiguration);
if (buildTarget != null) {
info.Text = GettextCatalog.GetString ("B_uild {0}", buildTarget.Name.Replace ("_","__"));
if (buildTarget is SolutionFolder)
@@ -214,7 +214,7 @@ namespace MonoDevelop.Ide.Commands
{
if (IdeApp.Workspace.IsOpen) {
IBuildTarget buildTarget = IdeApp.ProjectOperations.CurrentSelectedBuildTarget;
- info.Enabled = (buildTarget != null) && (IdeApp.ProjectOperations.CurrentBuildOperation.IsCompleted);
+ info.Enabled = (buildTarget != null) && (IdeApp.ProjectOperations.CurrentBuildOperation.IsCompleted) && buildTarget.CanBuild (IdeApp.Workspace.ActiveConfiguration);
if (buildTarget != null) {
info.Text = GettextCatalog.GetString ("R_ebuild {0}", IdeApp.ProjectOperations.CurrentSelectedBuildTarget.Name.Replace ("_","__"));
info.Description = GettextCatalog.GetString ("Rebuild {0}", IdeApp.ProjectOperations.CurrentSelectedBuildTarget.Name);
@@ -349,6 +349,7 @@ namespace MonoDevelop.Ide.Commands
if (IdeApp.ProjectOperations.CurrentSelectedBuildTarget == null)
info.Enabled = false;
else {
+ info.Enabled = IdeApp.ProjectOperations.CurrentSelectedBuildTarget.CanBuild (IdeApp.Workspace.ActiveConfiguration);
info.Text = GettextCatalog.GetString ("C_lean {0}", IdeApp.ProjectOperations.CurrentSelectedBuildTarget.Name.Replace ("_","__"));
info.Description = GettextCatalog.GetString ("Clean {0}", IdeApp.ProjectOperations.CurrentSelectedBuildTarget.Name);
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/CustomToolService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/CustomToolService.cs
index 4b3f30e788..e6e69d3824 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/CustomToolService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/CustomToolService.cs
@@ -37,6 +37,7 @@ using MonoDevelop.Core;
using MonoDevelop.Ide.Extensions;
using MonoDevelop.Ide.Tasks;
using MonoDevelop.Projects;
+using System.Threading.Tasks;
namespace MonoDevelop.Ide.CustomTools
{
@@ -250,32 +251,65 @@ namespace MonoDevelop.Ide.CustomTools
TaskService.Errors.ClearByOwner (file);
- //if this file is already being run, cancel it
+ TaskInfo runningTask;
+ TaskCompletionSource<bool> newTask = new TaskCompletionSource<bool> ();
+ var result = new SingleFileCustomToolResult ();
+ Task existingTask = null;
+ CancellationTokenSource cs = new CancellationTokenSource ();
+
+ // if this file is already being run, cancel it
+
lock (runningTasks) {
- TaskInfo runningTask;
if (runningTasks.TryGetValue (file.FilePath, out runningTask)) {
runningTask.CancellationTokenSource.Cancel ();
runningTasks.Remove (file.FilePath);
+ existingTask = runningTask.Task;
}
+ runningTask = new TaskInfo { Task = newTask.Task, CancellationTokenSource = cs, Result = result };
+ runningTasks.Add (file.FilePath, runningTask);
}
- CancellationTokenSource cs = new CancellationTokenSource ();
+ // If a task was already running, wait for it to finish. Running the same task in parallel may lead
+ // to file sharing violation errors
+
+ if (existingTask != null) {
+ try {
+ await existingTask;
+ } catch {
+ // Ignore exceptions, they are handled elsewhere
+ }
+ }
+
+ // Maybe I was cancelled while I was waiting. In that case, the task has already been removed from
+ // the runningTasks collection
+
+ if (cs.IsCancellationRequested)
+ return;
+
+ // Execute the generator
+
+ Exception error = null;
var monitor = IdeApp.Workbench.ProgressMonitors.GetToolOutputProgressMonitor (false).WithCancellationSource (cs);
- var result = new SingleFileCustomToolResult ();
+
try {
monitor.BeginTask (GettextCatalog.GetString ("Running generator '{0}' on file '{1}'...", file.Generator, file.Name), 1);
- var op = tool.Generate (monitor, file, result);
- lock (runningTasks) {
- runningTasks.Add (file.FilePath, new TaskInfo { Task = op, CancellationTokenSource = cs, Result = result });
+
+ try {
+ await tool.Generate (monitor, file, result);
+ } catch (Exception ex) {
+ error = ex;
+ result.UnhandledException = ex;
}
- await op;
+
+ // Generation has finished. Remove the task from the runningTasks collection
+
lock (runningTasks) {
- TaskInfo runningTask;
- if (runningTasks.TryGetValue (file.FilePath, out runningTask) && runningTask.Task == op) {
+ TaskInfo registeredTask;
+ if (runningTasks.TryGetValue (file.FilePath, out registeredTask) && registeredTask == runningTask) {
runningTasks.Remove (file.FilePath);
UpdateCompleted (monitor, file, genFile, result, false);
} else {
- //it was cancelled because another was run for the same file, so just clean up
+ // it was cancelled because another was run for the same file, so just clean up
monitor.EndTask ();
monitor.ReportWarning (GettextCatalog.GetString ("Cancelled because generator ran again for the same file"));
monitor.Dispose ();
@@ -284,6 +318,12 @@ namespace MonoDevelop.Ide.CustomTools
} catch (Exception ex) {
result.UnhandledException = ex;
UpdateCompleted (monitor, file, genFile, result, false);
+ } finally {
+ if (error == null)
+ newTask.SetResult (true);
+ else {
+ newTask.SetException (error);
+ }
}
}
@@ -408,7 +448,7 @@ namespace MonoDevelop.Ide.CustomTools
return ns;
}
- public static bool WaitForRunningTools (ProgressMonitor monitor)
+ public static Task WaitForRunningTools (ProgressMonitor monitor)
{
TaskInfo[] operations;
lock (runningTasks) {
@@ -416,30 +456,30 @@ namespace MonoDevelop.Ide.CustomTools
}
if (operations.Length == 0)
- return true;
+ return Task.FromResult (true);
monitor.BeginTask ("Waiting for custom tools...", operations.Length);
- var evt = new AutoResetEvent (false);
+ List<Task> tasks = new List<Task> ();
foreach (var t in operations) {
- t.Task.ContinueWith (ta => {
- monitor.Step (1);
- if (operations.All (op => op.Task.IsCompleted))
- evt.Set ();
- });
+ tasks.Add (t.Task.ContinueWith (ta => {
+ if (!monitor.CancellationToken.IsCancellationRequested)
+ monitor.Step (1);
+ }));
}
- monitor.CancellationToken.Register (delegate {
- evt.Set ();
- });
-
- evt.WaitOne ();
+ var cancelTask = new TaskCompletionSource<bool> ();
+ var allDone = Task.WhenAll (tasks);
- monitor.EndTask ();
+ var cancelReg = monitor.CancellationToken.Register (() => {
+ cancelTask.SetResult (true);
+ });
- //the tool operations display warnings themselves
- return operations.Any (op => !op.Result.SuccessWithWarnings);
+ return Task.WhenAny (allDone, cancelTask.Task).ContinueWith (t => {
+ monitor.EndTask ();
+ cancelReg.Dispose ();
+ });
}
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractNavigationExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractNavigationExtension.cs
new file mode 100644
index 0000000000..33c015e4a7
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractNavigationExtension.cs
@@ -0,0 +1,36 @@
+//
+// AbstractNavigationExtension.cs
+//
+// Author:
+// Mike Krüger <mkrueger@xamarin.com>
+//
+// Copyright (c) 2015 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+namespace MonoDevelop.Ide.Editor.Extension
+{
+ public class AbstractNavigationExtension
+ {
+ public AbstractNavigationExtension ()
+ {
+ }
+ }
+}
+
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractUsagesExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractUsagesExtension.cs
index 186860ca86..3c80bf6d19 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractUsagesExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractUsagesExtension.cs
@@ -128,7 +128,7 @@ namespace MonoDevelop.Ide.Editor.Extension
/// <returns>The references.</returns>
/// <param name="resolveResult">The resolve result given in 'TryResolve'.</param>
/// <param name="token">A cancellation token to cancel the operation.</param>
- protected abstract IEnumerable<MemberReference> GetReferences (T resolveResult, CancellationToken token);
+ protected abstract Task<IEnumerable<MemberReference>> GetReferencesAsync (T resolveResult, CancellationToken token);
async void DelayedTooltipShow ()
{
@@ -142,16 +142,13 @@ namespace MonoDevelop.Ide.Editor.Extension
ClearQuickTasks ();
return;
}
-
- Task.Run (delegate {
- var list = GetReferences (result, token).ToList ();
- if (!token.IsCancellationRequested) {
- Gtk.Application.Invoke (delegate {
- if (!token.IsCancellationRequested)
- ShowReferences (list);
- });
- }
- });
+ var list = await GetReferencesAsync (result, token);
+ if (!token.IsCancellationRequested) {
+ Gtk.Application.Invoke (delegate {
+ if (!token.IsCancellationRequested)
+ ShowReferences (list);
+ });
+ }
} catch (Exception e) {
LoggingService.LogError ("Unhandled Exception in HighlightingUsagesExtension", e);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColorScheme.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColorScheme.cs
index d71c68b6bd..f6448bcc37 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColorScheme.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColorScheme.cs
@@ -445,6 +445,10 @@ namespace MonoDevelop.Ide.Editor.Highlighting
[ColorDescription(UserTypesTypeParametersKey, VSSetting = "User Types(Type parameters)")]
public ChunkStyle UserTypesTypeParameters { get; private set; }
+ public const string UserTypesMutableKey = "User Types(Mutable)";
+ [ColorDescription(UserTypesMutableKey, VSSetting = "User Types(Mutable")]
+ public ChunkStyle UserTypesMutable { get; private set; }
+
public const string UserFieldUsageKey = "User Field Usage";
[ColorDescription(UserFieldUsageKey, VSSetting = "Identifier")]
public ChunkStyle UserFieldUsage { get; private set; }
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs
index 3f60819204..7d58d9f4d3 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs
@@ -31,14 +31,6 @@ using MonoDevelop.Ide.Editor.Extension;
namespace MonoDevelop.Ide.Editor
{
- [Obsolete ("Use WordNavigationStyle")]
- public enum ControlLeftRightMode
- {
- MonoDevelop,
- Emacs,
- SharpDevelop
- }
-
public enum WordNavigationStyle
{
Unix,
@@ -246,11 +238,8 @@ namespace MonoDevelop.Ide.Editor
DefaultSourceEditorOptions (TextStylePolicy currentPolicy)
{
- var defaultControlMode = (ControlLeftRightMode)Enum.Parse (typeof(ControlLeftRightMode), DesktopService.DefaultControlLeftRightBehavior);
- controlLeftRightMode = ConfigurationProperty.Create ("ControlLeftRightMode", defaultControlMode);
-
WordNavigationStyle defaultWordNavigation = WordNavigationStyle.Unix;
- if (Platform.IsWindows || controlLeftRightMode.Value == ControlLeftRightMode.SharpDevelop) {
+ if (Platform.IsWindows) {
defaultWordNavigation = WordNavigationStyle.Windows;
}
wordNavigationStyle = ConfigurationProperty.Create ("WordNavigationStyle", defaultWordNavigation);
@@ -439,18 +428,6 @@ namespace MonoDevelop.Ide.Editor
}
}
}
-
- ConfigurationProperty<ControlLeftRightMode> controlLeftRightMode;
- [Obsolete("Use WordNavigationStyle")]
- public ControlLeftRightMode ControlLeftRightMode {
- get {
- return controlLeftRightMode;
- }
- set {
- if (controlLeftRightMode.Set (value))
- OnChanged (EventArgs.Empty);
- }
- }
ConfigurationProperty<WordNavigationStyle> wordNavigationStyle;
public WordNavigationStyle WordNavigationStyle {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorViewContent.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorViewContent.cs
index c00d0ee970..661e23c914 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorViewContent.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorViewContent.cs
@@ -680,6 +680,7 @@ namespace MonoDevelop.Ide.Editor
[CommandUpdateHandler (EditCommands.ToggleCodeComment)]
void OnUpdateToggleComment (CommandInfo info)
{
+ info.Bypass = true;
var lineComments = TextEditorFactory.GetSyntaxProperties (textEditor.MimeType, "LineComment");
if (lineComments != null && lineComments.Length > 0) {
info.Visible = true;
@@ -801,7 +802,7 @@ namespace MonoDevelop.Ide.Editor
var anchor = textEditor.SelectionAnchorOffset;
int lines = 0;
- IDocumentLine first = null;
+ //IDocumentLine first = null;
IDocumentLine last = null;
var oldVersion = textEditor.Version;
foreach (var line in GetSelectedLines (textEditor)) {
@@ -811,7 +812,7 @@ namespace MonoDevelop.Ide.Editor
lines++;
}
- first = line;
+ //first = line;
if (last == null)
last = line;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResultWidget.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResultWidget.cs
index e1bb7cf4b4..30b9bdca95 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResultWidget.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResultWidget.cs
@@ -698,7 +698,7 @@ namespace MonoDevelop.Ide.FindInFiles
if (result != null) {
var loc = GetLocation (result);
store.SetValue (iter, DidReadColumn, true);
- IdeApp.Workbench.OpenDocument (result.FileName, loc.Line, loc.Column);
+ IdeApp.Workbench.OpenDocument (result.FileName, null, loc.Line, loc.Column);
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/LogView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/LogView.cs
index 6f48569971..e81704dc8e 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/LogView.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/LogView.cs
@@ -111,8 +111,11 @@ namespace MonoDevelop.Ide.Gui.Components
var clipboard = Clipboard.Get (Gdk.Atom.Intern ("CLIPBOARD", false));
clipboard.Text = text;
- clipboard = Clipboard.Get (Gdk.Atom.Intern ("PRIMARY", false));
- clipboard.Text = text;
+ if (Platform.IsLinux) {
+ // gtk has different clipboards for CLIPBOARD and PRIMARY only on Linux.
+ clipboard = Clipboard.Get (Gdk.Atom.Intern ("PRIMARY", false));
+ clipboard.Text = text;
+ }
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/ReferenceNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/ReferenceNodeBuilder.cs
index e6292949ca..ae7b59f8f4 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/ReferenceNodeBuilder.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ClassPad/ReferenceNodeBuilder.cs
@@ -123,7 +123,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ClassPad
ProjectReference pref = CurrentNode.DataItem as ProjectReference;
if (pref != null) {
foreach (string fileName in pref.GetReferencedFileNames (IdeApp.Workspace.ActiveConfiguration))
- IdeApp.Workbench.OpenDocument (fileName);
+ IdeApp.Workbench.OpenDocument (fileName, project: null);
}
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ImplicitFrameworkAssemblyReferenceNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ImplicitFrameworkAssemblyReferenceNodeBuilder.cs
index 08233fc98f..e42d8e6dd4 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ImplicitFrameworkAssemblyReferenceNodeBuilder.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ImplicitFrameworkAssemblyReferenceNodeBuilder.cs
@@ -74,7 +74,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad
public override void ActivateItem ()
{
var aref = (ImplicitFrameworkAssemblyReference) CurrentNode.DataItem;
- IdeApp.Workbench.OpenDocument (aref.Assembly.Location);
+ IdeApp.Workbench.OpenDocument (aref.Assembly.Location, project: null);
}
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionFolderFileNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionFolderFileNodeBuilder.cs
index 497cd3a870..353cae8399 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionFolderFileNodeBuilder.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionFolderFileNodeBuilder.cs
@@ -119,7 +119,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad
public override void ActivateItem ()
{
SolutionFolderFileNode file = (SolutionFolderFileNode) CurrentNode.DataItem;
- IdeApp.Workbench.OpenDocument (file.FileName);
+ IdeApp.Workbench.OpenDocument (file.FileName, project: null);
}
public override DragOperation CanDragNode ()
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionFolderNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionFolderNodeBuilder.cs
index d2ff61eff9..2888fc3365 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionFolderNodeBuilder.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionFolderNodeBuilder.cs
@@ -120,17 +120,27 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad
if (tb != null) tb.Update ();
}
- void OnEntryAdded (object sender, SolutionItemEventArgs e)
+ void OnEntryAdded (object sender, SolutionItemChangeEventArgs e)
{
ITreeBuilder tb = Context.GetTreeBuilder (e.SolutionItem.ParentFolder);
if (tb != null) {
- tb.AddChild (e.SolutionItem, true);
- tb.Expanded = true;
+ if (e.Reloading)
+ // When reloading we ignore the removed event, and we do an UpdateAll here. This will
+ // replace the reloaded instance and will preserve the tree status
+ tb.UpdateAll ();
+ else {
+ tb.AddChild (e.SolutionItem, true);
+ tb.Expanded = true;
+ }
}
}
- void OnEntryRemoved (object sender, SolutionItemEventArgs e)
+ void OnEntryRemoved (object sender, SolutionItemChangeEventArgs e)
{
+ // If reloading, ignore the event. We handle it in OnEntryAdded.
+ if (e.Reloading)
+ return;
+
ITreeBuilder tb = Context.GetTreeBuilder (e.SolutionItem);
if (tb != null)
tb.Remove ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionNodeBuilder.cs
index 82d17cde9c..02bd790d3b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionNodeBuilder.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SolutionNodeBuilder.cs
@@ -144,13 +144,23 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad
{
ITreeBuilder tb = Context.GetTreeBuilder (e.SolutionItem.ParentSolution);
if (tb != null) {
- tb.AddChild (e.SolutionItem, true);
- tb.Expanded = true;
+ if (e.Reloading)
+ // When reloading we ignore the removed event, and we do an UpdateAll here. This will
+ // replace the reloaded instance and will preserve the tree status
+ tb.UpdateAll ();
+ else {
+ tb.AddChild (e.SolutionItem, true);
+ tb.Expanded = true;
+ }
}
}
void OnEntryRemoved (object sender, SolutionItemChangeEventArgs e)
{
+ // If reloading, ignore the event. We handle it in OnEntryAdded.
+ if (e.Reloading)
+ return;
+
ITreeBuilder tb = Context.GetTreeBuilder (e.SolutionItem);
if (tb != null)
tb.Remove ();
@@ -311,7 +321,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad
public void OnEditSolution ()
{
var solution = (Solution) CurrentNode.DataItem;
- IdeApp.Workbench.OpenDocument (solution.FileName);
+ IdeApp.Workbench.OpenDocument (solution.FileName, project:null);
}
[CommandUpdateHandler (ProjectCommands.EditSolutionItem)]
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SystemFileNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SystemFileNodeBuilder.cs
index 393636a54f..2188ddec1f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SystemFileNodeBuilder.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/SystemFileNodeBuilder.cs
@@ -118,7 +118,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad
public override void ActivateItem ()
{
SystemFile file = CurrentNode.DataItem as SystemFile;
- IdeApp.Workbench.OpenDocument (file.Path);
+ IdeApp.Workbench.OpenDocument (file.Path, project: null);
}
public override void DeleteMultipleItems ()
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/UnknownEntryNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/UnknownEntryNodeBuilder.cs
index d831511d57..33ae288549 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/UnknownEntryNodeBuilder.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/UnknownEntryNodeBuilder.cs
@@ -151,7 +151,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad
public void OnEditUnknownSolutionItem ()
{
UnknownSolutionItem si = (UnknownSolutionItem) CurrentNode.DataItem;
- IdeApp.Workbench.OpenDocument (si.FileName);
+ IdeApp.Workbench.OpenDocument (si.FileName, project: null);
}
[CommandUpdateHandler (ProjectCommands.EditSolutionItem)]
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs
index 9282f6fc17..a17fbc3e95 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs
@@ -124,7 +124,7 @@ namespace MonoDevelop.Ide.Gui.Pads
DockItemToolbar toolbar = window.GetToolbar (DockPositionType.Top);
- errorBtn = new ToggleButton ();
+ errorBtn = new ToggleButton { Name = "toggleErrors" };
errorBtn.Active = ShowErrors;
errorBtn.Image = new Gtk.Image (Stock.Error, Gtk.IconSize.Menu);
errorBtn.Image.Show ();
@@ -133,7 +133,7 @@ namespace MonoDevelop.Ide.Gui.Pads
UpdateErrorsNum();
toolbar.Add (errorBtn);
- warnBtn = new ToggleButton ();
+ warnBtn = new ToggleButton { Name = "toggleWarnings" };
warnBtn.Active = ShowWarnings;
warnBtn.Image = new Gtk.Image (Stock.Warning, Gtk.IconSize.Menu);
warnBtn.Image.Show ();
@@ -141,8 +141,8 @@ namespace MonoDevelop.Ide.Gui.Pads
warnBtn.TooltipText = GettextCatalog.GetString ("Show Warnings");
UpdateWarningsNum();
toolbar.Add (warnBtn);
-
- msgBtn = new ToggleButton ();
+
+ msgBtn = new ToggleButton { Name = "toggleMessages" };
msgBtn.Active = ShowMessages;
msgBtn.Image = new Gtk.Image (Stock.Information, Gtk.IconSize.Menu);
msgBtn.Image.Show ();
@@ -153,7 +153,7 @@ namespace MonoDevelop.Ide.Gui.Pads
toolbar.Add (new SeparatorToolItem ());
- logBtn = new ToggleButton ();
+ logBtn = new ToggleButton { Name = "toggleBuildOutput" };
logBtn.Label = GettextCatalog.GetString ("Build Output");
logBtn.Image = ImageService.GetImage ("md-message-log", Gtk.IconSize.Menu);
logBtn.Image.Show ();
@@ -229,7 +229,7 @@ namespace MonoDevelop.Ide.Gui.Pads
control.Add1 (sw);
- outputView = new LogView ();
+ outputView = new LogView { Name = "buildOutput" };
control.Add2 (outputView);
control.ShowAll ();
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 0efff2531d..59ebe4460c 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs
@@ -54,6 +54,8 @@ using Microsoft.CodeAnalysis.Options;
using MonoDevelop.Ide.Editor;
using MonoDevelop.Ide.Editor.Highlighting;
using MonoDevelop.Core.Text;
+using MonoDevelop.Components.Extensions;
+using MonoDevelop.Projects.SharedAssetsProjects;
namespace MonoDevelop.Ide.Gui
{
@@ -237,7 +239,7 @@ namespace MonoDevelop.Ide.Gui
public Task<Microsoft.CodeAnalysis.Compilation> GetCompilationAsync(CancellationToken cancellationToken = default(CancellationToken))
{
- var project = TypeSystemService.GetCodeAnalysisProject (Project ?? adhocProject);
+ var project = TypeSystemService.GetCodeAnalysisProject (adhocProject ?? Project);
if (project == null)
return new Task<Microsoft.CodeAnalysis.Compilation> (() => null);
return project.GetCompilationAsync (cancellationToken);
@@ -720,7 +722,7 @@ namespace MonoDevelop.Ide.Gui
TypeSystemService.AddSkippedFile (currentParseFile);
var currentParseText = editor.CreateDocumentSnapshot ();
CancelOldParsing();
- var project = Project ?? adhocProject;
+ var project = adhocProject ?? Project;
var options = new ParseOptions {
Project = project,
@@ -763,7 +765,7 @@ namespace MonoDevelop.Ide.Gui
analysisDocument = null;
return SpecializedTasks.EmptyTask;
}
- if (Project != null && Editor.MimeType == "text/x-csharp") {
+ if (Project != null && Editor.MimeType == "text/x-csharp" && !IsUnreferencedSharedProject(Project)) {
RoslynWorkspace = TypeSystemService.GetWorkspace (this.Project.ParentSolution);
analysisDocument = TypeSystemService.GetDocumentId (this.Project, this.FileName);
if (analysisDocument != null) {
@@ -805,6 +807,12 @@ namespace MonoDevelop.Ide.Gui
}
return SpecializedTasks.EmptyTask;
}
+
+ bool IsUnreferencedSharedProject (Project project)
+ {
+ return project is SharedAssetsProject;
+ }
+
object adhocProjectLock = new object();
void UnloadAdhocProject ()
@@ -855,7 +863,7 @@ namespace MonoDevelop.Ide.Gui
string mimeType = editor.MimeType;
CancelOldParsing ();
var token = parseTokenSource.Token;
- var project = Project ?? adhocProject;
+ var project = adhocProject ?? Project;
var projectFile = project?.GetProjectFile (currentParseFile);
ThreadPool.QueueUserWorkItem (delegate {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/FileViewer.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/FileViewer.cs
index ea9bbf240d..dbd798402d 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/FileViewer.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/FileViewer.cs
@@ -92,7 +92,7 @@ namespace MonoDevelop.Ide.Gui
public Document OpenFile (string filePath, Encoding encoding)
{
if (binding != null)
- return IdeApp.Workbench.OpenDocument (filePath, -1, -1, OpenDocumentOptions.Default, encoding, binding);
+ return IdeApp.Workbench.OpenDocument (filePath, null, -1, -1, OpenDocumentOptions.Default, encoding, binding);
else {
app.Launch (filePath);
return null;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/StartupInfo.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/StartupInfo.cs
index abaa1b0225..9a7e1c5206 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/StartupInfo.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/StartupInfo.cs
@@ -85,7 +85,7 @@ namespace MonoDevelop.Ide.Gui
int.TryParse (fileMatch.Groups["line"].Value, out line);
if (fileMatch.Groups["column"].Success)
int.TryParse (fileMatch.Groups["column"].Value, out column);
- var file = new FileOpenInformation (filename, line, column, OpenDocumentOptions.Default);
+ var file = new FileOpenInformation (filename, null, line, column, OpenDocumentOptions.Default);
requestedFileList.Add (file);
}
} else if (a[0] == '-' || a[0] == '/') {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewFileDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewFileDialog.cs
index 693a958f71..9fa9c0c92a 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewFileDialog.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewFileDialog.cs
@@ -166,10 +166,13 @@ namespace MonoDevelop.Ide.Projects
{
string key = "Dialogs.NewFileDialog.LastSelectedCategory";
if (proj != null) {
- key += "." + proj.GetTypeTags ().First ();
- var dnp = proj as DotNetProject;
- if (dnp != null)
- key += "." + dnp.LanguageName;
+ string projectType = proj.GetTypeTags ().FirstOrDefault ();
+ if (projectType != null) {
+ key += "." + projectType;
+ var dnp = proj as DotNetProject;
+ if (dnp != null)
+ key += "." + dnp.LanguageName;
+ }
}
return key;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewProjectController.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewProjectController.cs
index 8ff86d6fbf..1f7eb8dd0a 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewProjectController.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewProjectController.cs
@@ -718,7 +718,7 @@ namespace MonoDevelop.Ide.Projects
static void RunTemplateActions (ProcessedTemplateResult templateResult)
{
foreach (string action in templateResult.Actions) {
- IdeApp.Workbench.OpenDocument (Path.Combine (templateResult.ProjectBasePath, action));
+ IdeApp.Workbench.OpenDocument (Path.Combine (templateResult.ProjectBasePath, action), project: null);
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/CommentTasksView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/CommentTasksView.cs
index 269b29b964..4d3a4e0c27 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/CommentTasksView.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/CommentTasksView.cs
@@ -526,7 +526,7 @@ namespace MonoDevelop.Ide.Tasks
{
TaskListEntry task = SelectedTask;
if (task != null && ! String.IsNullOrEmpty (task.FileName)) {
- var doc = IdeApp.Workbench.OpenDocument (task.FileName, Math.Max (1, task.Line), Math.Max (1, task.Column));
+ var doc = IdeApp.Workbench.OpenDocument (task.FileName, null, Math.Max (1, task.Line), Math.Max (1, task.Column));
if (doc != null && doc.HasProject && doc.Project is DotNetProject) {
string[] commentTags = doc.CommentTags;
if (commentTags != null && commentTags.Length == 1) {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/UserTasksView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/UserTasksView.cs
index babddca228..6f76fb1faa 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/UserTasksView.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Tasks/UserTasksView.cs
@@ -98,6 +98,7 @@ namespace MonoDevelop.Ide.Tasks
cellRendCompleted.Toggled += new ToggledHandler (UserTaskCompletedToggled);
cellRendCompleted.Activatable = true;
col = view.AppendColumn (String.Empty, cellRendCompleted, "active", Columns.Completed);
+ col.SortColumnId = (int)Columns.Completed;
cellRendDesc = view.TextRenderer;
cellRendDesc.Editable = true;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/FileTemplate.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/FileTemplate.cs
index cbc833b176..3b8517e7cd 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/FileTemplate.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/FileTemplate.cs
@@ -6,6 +6,7 @@
// Michael Hutchinson (mhutchinson@novell.com)
// Marek Sieradzki (marek.sieradzki@gmail.com)
// Viktoria Dudka (viktoriad@remobjects.com)
+// Vincent Dondain (vincent@xamarin.com)
//
// Copyright (c) 2009 RemObjects Software
//
@@ -29,229 +30,161 @@
//
//
-
using System;
-using MonoDevelop.Core;
-using Mono.Addins;
-using MonoDevelop.Ide.Gui;
-using MonoDevelop.Projects;
+using System.Collections.Generic;
using System.IO;
+using System.Linq;
+using System.Xml;
using Gtk;
-using System.Collections.Generic;
-using System.Collections;
+using Mono.Addins;
+using MonoDevelop.Core;
using MonoDevelop.Ide.Codons;
-using System.Xml;
-using System.Linq;
+using MonoDevelop.Ide.Gui;
+using MonoDevelop.Projects;
namespace MonoDevelop.Ide.Templates
{
- class FileTemplate
- {
-
-
- public static List<FileTemplate> fileTemplates = new List<FileTemplate> ();
-
-
- private List<FileDescriptionTemplate> files = new List<FileDescriptionTemplate> ();
- public List<FileDescriptionTemplate> Files
- {
- get { return files; }
- }
-
- private List<FileTemplateCondition> conditions = new List<FileTemplateCondition> ();
- public List<FileTemplateCondition> Сonditions
- {
- get { return conditions; }
- }
-
- private string id = String.Empty;
- public string Id
- {
- get { return id; }
- }
-
- private string icon = String.Empty;
- public IconId Icon
- {
- get { return icon; }
- }
-
- private string category = String.Empty;
- public string Category
- {
- get { return category; }
- }
-
- private string wizardPath = String.Empty;
- public string WizardPath
- {
- get { return wizardPath; }
- }
-
- private string description = String.Empty;
- public string Description
- {
- get { return description; }
- }
-
- private bool isFixedFilename = false;
- public bool IsFixedFilename
- {
- get { return isFixedFilename; }
- }
-
- private string defaultFilename = String.Empty;
- public string DefaultFilename
- {
- get { return defaultFilename; }
- }
-
- public string name = String.Empty;
- public string Name
- {
- get { return name; }
- }
-
- private string languageName = String.Empty;
- public string LanguageName
- {
- get { return languageName; }
- }
-
- private string originator = String.Empty;
- public string Originator
- {
- get { return originator; }
- }
-
- private string created = String.Empty;
- public string Created
- {
- get { return created; }
- }
-
- private string lastModified = String.Empty;
- public string LastModified
- {
- get { return lastModified; }
- }
-
- private string projecttype = String.Empty;
- public string ProjectType
- {
- get { return projecttype; }
- }
-
-
- private static FileTemplate LoadFileTemplate (RuntimeAddin addin, ProjectTemplateCodon codon)
- {
+ class FileTemplate
+ {
+ public string Category { get; private set; } = String.Empty;
+
+ public List<FileTemplateCondition> Conditions { get; private set; } = new List<FileTemplateCondition> ();
+
+ public string Created { get; private set; } = String.Empty;
+
+ public string DefaultFilename { get; private set; } = String.Empty;
+
+ public string Description { get; private set; } = String.Empty;
+
+ public List<FileDescriptionTemplate> Files { get; private set; } = new List<FileDescriptionTemplate> ();
+
+ public static List<FileTemplate> fileTemplates = new List<FileTemplate> ();
+
+ public IconId Icon { get; private set; } = String.Empty;
+
+ public string Id { get; private set; } = String.Empty;
+
+ public bool IsFixedFilename { get; private set; }
+
+ public string LanguageName { get; private set; } = String.Empty;
+
+ public string LastModified { get; private set; } = String.Empty;
+
+ public string Name { get; private set; } = String.Empty;
+
+ public string Originator { get; private set; } = String.Empty;
+
+ public string ProjectType { get; private set; } = String.Empty;
+
+ public string WizardPath { get; private set; } = String.Empty;
+
+ static FileTemplate LoadFileTemplate (RuntimeAddin addin, ProjectTemplateCodon codon)
+ {
XmlDocument xmlDocument = codon.GetTemplate ();
FilePath baseDirectory = codon.BaseDirectory;
- //Configuration
- XmlElement xmlNodeConfig = xmlDocument.DocumentElement["TemplateConfiguration"];
-
- FileTemplate fileTemplate = null;
- if (xmlNodeConfig["Type"] != null) {
- Type configType = addin.GetType (xmlNodeConfig["Type"].InnerText);
-
- if (typeof (FileTemplate).IsAssignableFrom (configType)) {
- fileTemplate = (FileTemplate)Activator.CreateInstance (configType);
- }
- else
- throw new InvalidOperationException (string.Format ("The file template class '{0}' must be a subclass of MonoDevelop.Ide.Templates.FileTemplate", xmlNodeConfig["Type"].InnerText));
- }
- else
- fileTemplate = new FileTemplate ();
-
- fileTemplate.originator = xmlDocument.DocumentElement.GetAttribute ("Originator");
- fileTemplate.created = xmlDocument.DocumentElement.GetAttribute ("Created");
- fileTemplate.lastModified = xmlDocument.DocumentElement.GetAttribute ("LastModified");
-
- if (xmlNodeConfig["_Name"] != null) {
- fileTemplate.name = xmlNodeConfig["_Name"].InnerText;
- }
- else {
- throw new InvalidOperationException (string.Format ("Missing element '_Name' in file template: {0}", codon.Id));
- }
-
- if (xmlNodeConfig["_Category"] != null) {
- fileTemplate.category = xmlNodeConfig["_Category"].InnerText;
- }
- else {
- throw new InvalidOperationException (string.Format ("Missing element '_Category' in file template: {0}", codon.Id));
- }
-
- if (xmlNodeConfig["LanguageName"] != null) {
- fileTemplate.languageName = xmlNodeConfig["LanguageName"].InnerText;
- }
-
- if (xmlNodeConfig["ProjectType"] != null) {
- fileTemplate.projecttype = xmlNodeConfig["ProjectType"].InnerText;
- }
-
- if (xmlNodeConfig["_Description"] != null) {
- fileTemplate.description = xmlNodeConfig["_Description"].InnerText;
- }
-
- if (xmlNodeConfig["Icon"] != null) {
- fileTemplate.icon = ImageService.GetStockId (addin, xmlNodeConfig["Icon"].InnerText, IconSize.Dnd); //xmlNodeConfig["_Description"].InnerText;
- }
-
- if (xmlNodeConfig["Wizard"] != null) {
- fileTemplate.icon = xmlNodeConfig["Wizard"].Attributes["path"].InnerText;
- }
-
- if (xmlNodeConfig["DefaultFilename"] != null) {
- fileTemplate.defaultFilename = xmlNodeConfig["DefaultFilename"].InnerText;
- string isFixed = xmlNodeConfig["DefaultFilename"].GetAttribute ("IsFixed");
+ //Configuration
+ XmlElement xmlNodeConfig = xmlDocument.DocumentElement ["TemplateConfiguration"];
+
+ FileTemplate fileTemplate;
+ if (xmlNodeConfig ["Type"] != null) {
+ Type configType = addin.GetType (xmlNodeConfig ["Type"].InnerText);
+
+ if (typeof(FileTemplate).IsAssignableFrom (configType)) {
+ fileTemplate = (FileTemplate)Activator.CreateInstance (configType);
+ } else
+ throw new InvalidOperationException (string.Format ("The file template class '{0}' must be a subclass of MonoDevelop.Ide.Templates.FileTemplate", xmlNodeConfig ["Type"].InnerText));
+ } else
+ fileTemplate = new FileTemplate ();
+
+ fileTemplate.Originator = xmlDocument.DocumentElement.GetAttribute ("Originator");
+ fileTemplate.Created = xmlDocument.DocumentElement.GetAttribute ("Created");
+ fileTemplate.LastModified = xmlDocument.DocumentElement.GetAttribute ("LastModified");
+
+ if (xmlNodeConfig ["_Name"] != null) {
+ fileTemplate.Name = xmlNodeConfig ["_Name"].InnerText;
+ } else {
+ throw new InvalidOperationException (string.Format ("Missing element '_Name' in file template: {0}", codon.Id));
+ }
+
+ if (xmlNodeConfig ["_Category"] != null) {
+ fileTemplate.Category = xmlNodeConfig ["_Category"].InnerText;
+ } else {
+ throw new InvalidOperationException (string.Format ("Missing element '_Category' in file template: {0}", codon.Id));
+ }
+
+ if (xmlNodeConfig ["LanguageName"] != null) {
+ fileTemplate.LanguageName = xmlNodeConfig ["LanguageName"].InnerText;
+ }
+
+ if (xmlNodeConfig ["ProjectType"] != null) {
+ fileTemplate.ProjectType = xmlNodeConfig ["ProjectType"].InnerText;
+ }
+
+ if (xmlNodeConfig ["_Description"] != null) {
+ fileTemplate.Description = xmlNodeConfig ["_Description"].InnerText;
+ }
+
+ if (xmlNodeConfig ["Icon"] != null) {
+ fileTemplate.Icon = ImageService.GetStockId (addin, xmlNodeConfig ["Icon"].InnerText, IconSize.Dnd);
+ }
+
+ if (xmlNodeConfig ["Wizard"] != null) {
+ fileTemplate.Icon = xmlNodeConfig ["Wizard"].Attributes ["path"].InnerText;
+ }
+
+ if (xmlNodeConfig ["DefaultFilename"] != null) {
+ fileTemplate.DefaultFilename = xmlNodeConfig ["DefaultFilename"].InnerText;
+ string isFixed = xmlNodeConfig ["DefaultFilename"].GetAttribute ("IsFixed");
if (isFixed.Length > 0) {
bool bFixed;
if (bool.TryParse (isFixed, out bFixed))
- fileTemplate.isFixedFilename = bFixed;
+ fileTemplate.IsFixedFilename = bFixed;
else
throw new InvalidOperationException ("Invalid value for IsFixed in template.");
}
- }
+ }
- //Template files
- XmlNode xmlNodeTemplates = xmlDocument.DocumentElement["TemplateFiles"];
+ //Template files
+ XmlNode xmlNodeTemplates = xmlDocument.DocumentElement ["TemplateFiles"];
- if(xmlNodeTemplates != null) {
- foreach(XmlNode xmlNode in xmlNodeTemplates.ChildNodes) {
- if(xmlNode is XmlElement) {
- fileTemplate.files.Add (
- FileDescriptionTemplate.CreateTemplate ((XmlElement)xmlNode, baseDirectory));
+ if (xmlNodeTemplates != null) {
+ foreach (XmlNode xmlNode in xmlNodeTemplates.ChildNodes) {
+ var xmlElement = xmlNode as XmlElement;
+ if (xmlElement != null) {
+ fileTemplate.Files.Add (
+ FileDescriptionTemplate.CreateTemplate (xmlElement, baseDirectory));
}
}
}
- //Conditions
- XmlNode xmlNodeConditions = xmlDocument.DocumentElement["Conditions"];
- if(xmlNodeConditions != null) {
- foreach(XmlNode xmlNode in xmlNodeConditions.ChildNodes) {
- if(xmlNode is XmlElement) {
- fileTemplate.conditions.Add (FileTemplateCondition.CreateCondition ((XmlElement)xmlNode));
+ //Conditions
+ XmlNode xmlNodeConditions = xmlDocument.DocumentElement ["Conditions"];
+ if (xmlNodeConditions != null) {
+ foreach (XmlNode xmlNode in xmlNodeConditions.ChildNodes) {
+ var xmlElement = xmlNode as XmlElement;
+ if (xmlElement != null) {
+ fileTemplate.Conditions.Add (FileTemplateCondition.CreateCondition (xmlElement));
}
}
}
- return fileTemplate;
- }
+ return fileTemplate;
+ }
- static FileTemplate()
- {
- AddinManager.AddExtensionNodeHandler ("/MonoDevelop/Ide/FileTemplates", OnExtensionChanged);
- }
+ static FileTemplate ()
+ {
+ AddinManager.AddExtensionNodeHandler ("/MonoDevelop/Ide/FileTemplates", OnExtensionChanged);
+ }
static void OnExtensionChanged (object s, ExtensionNodeEventArgs args)
- {
- if (args.Change == ExtensionChange.Add) {
- ProjectTemplateCodon codon = (ProjectTemplateCodon) args.ExtensionNode;
- try {
- FileTemplate t = LoadFileTemplate (codon.Addin, codon);
- t.id = codon.Id;
- fileTemplates.Add (t);
+ {
+ if (args.Change == ExtensionChange.Add) {
+ var codon = (ProjectTemplateCodon)args.ExtensionNode;
+ try {
+ FileTemplate t = LoadFileTemplate (codon.Addin, codon);
+ t.Id = codon.Id;
+ fileTemplates.Add (t);
} catch (Exception e) {
string extId = null, addinId = null;
if (codon != null) {
@@ -261,19 +194,18 @@ namespace MonoDevelop.Ide.Templates
addinId = codon.Addin.Id;
}
LoggingService.LogError ("Error loading template id {0} in addin {1}:\n{2}",
- extId ?? "(null)", addinId ?? "(null)", e.ToString ());
+ extId ?? "(null)", addinId ?? "(null)", e.ToString ());
+ }
+ } else {
+ var codon = (ProjectTemplateCodon)args.ExtensionNode;
+ foreach (FileTemplate t in fileTemplates) {
+ if (t.Id == codon.Id) {
+ fileTemplates.Remove (t);
+ break;
+ }
}
- }
- else {
- ProjectTemplateCodon codon = (ProjectTemplateCodon) args.ExtensionNode;
- foreach (FileTemplate t in fileTemplates) {
- if (t.Id == codon.Id) {
- fileTemplates.Remove (t);
- break;
- }
- }
- }
- }
+ }
+ }
internal static List<FileTemplate> GetFileTemplates (Project project, string projectPath)
{
@@ -286,45 +218,37 @@ namespace MonoDevelop.Ide.Templates
}
internal static FileTemplate GetFileTemplateByID (string templateID)
- {
- foreach (FileTemplate t in fileTemplates)
- if (t.Id == templateID)
- return t;
+ {
+ foreach (FileTemplate t in fileTemplates)
+ if (t.Id == templateID)
+ return t;
- return null;
- }
+ return null;
+ }
public virtual bool Create (SolutionFolderItem policyParent, Project project, string directory, string language, string name)
- {
- if (!String.IsNullOrEmpty(WizardPath)) {
- //Properties customizer = new Properties();
- //customizer.Set("Template", item);
- //customizer.Set("Creator", this);
- //WizardDialog wizard = new WizardDialog("File Wizard", customizer, item.WizardPath);
- //if (wizard.ShowDialog() == DialogResult.OK) {
- //DialogResult = DialogResult.OK;
- //}
- return false;
+ {
+ if (!String.IsNullOrEmpty (WizardPath)) {
+ return false;
} else {
- foreach (FileDescriptionTemplate newfile in Files)
- if (!CreateFile (newfile, policyParent, project, directory, language, name))
- return false;
- return true;
- }
- }
+ foreach (FileDescriptionTemplate newfile in Files)
+ if (!CreateFile (newfile, policyParent, project, directory, language, name))
+ return false;
+ return true;
+ }
+ }
public virtual bool IsValidName (string name, string language)
- {
- if (isFixedFilename)
- return (name == defaultFilename);
+ {
+ if (IsFixedFilename)
+ return (name == DefaultFilename);
- bool valid = true;
- foreach (FileDescriptionTemplate templ in Files)
- if (!templ.IsValidName (name, language))
- valid = false;
+ bool valid = true;
+ foreach (FileDescriptionTemplate templ in Files)
+ valid &= templ.IsValidName (name, language);
- return valid;
- }
+ return valid;
+ }
public static string GuessMimeType (string fileName)
{
@@ -337,17 +261,17 @@ namespace MonoDevelop.Ide.Templates
FileService.MoveFile (fn, fn + n + ext);
string mimeType = DesktopService.GetMimeTypeForUri (fn + n + ext);
FileService.DeleteFile (fn + n + ext);
- if (mimeType == null || mimeType == "")
+ if (string.IsNullOrEmpty (mimeType))
mimeType = "text";
return mimeType;
}
-
+
public virtual bool CanCreateUnsavedFiles (FileDescriptionTemplate newfile, SolutionFolderItem policyParent, Project project, string directory, string language, string name)
{
if (project != null) {
return true;
} else {
- SingleFileDescriptionTemplate singleFile = newfile as SingleFileDescriptionTemplate;
+ var singleFile = newfile as SingleFileDescriptionTemplate;
if (singleFile == null)
return false;
@@ -362,144 +286,144 @@ namespace MonoDevelop.Ide.Templates
}
protected virtual bool CreateFile (FileDescriptionTemplate newfile, SolutionFolderItem policyParent, Project project, string directory, string language, string name)
- {
- if (project != null) {
+ {
+ if (project != null) {
var model = project.GetStringTagModel (new DefaultConfigurationSelector ());
newfile.SetProjectTagModel (model);
try {
- if (newfile.AddToProject (policyParent, project, language, directory, name)) {
- newfile.Show ();
- return true;
+ if (newfile.AddToProject (policyParent, project, language, directory, name)) {
+ newfile.Show ();
+ return true;
}
} finally {
newfile.SetProjectTagModel (null);
}
} else {
- SingleFileDescriptionTemplate singleFile = newfile as SingleFileDescriptionTemplate;
- if (singleFile == null)
- throw new InvalidOperationException ("Single file template expected");
+ var singleFile = newfile as SingleFileDescriptionTemplate;
+ if (singleFile == null)
+ throw new InvalidOperationException ("Single file template expected");
- if (directory != null) {
- string fileName = singleFile.SaveFile (policyParent, project, language, directory, name);
- if (fileName != null) {
+ if (directory != null) {
+ string fileName = singleFile.SaveFile (policyParent, project, language, directory, name);
+ if (fileName != null) {
IdeApp.Workbench.OpenDocument (fileName, project);
- return true;
- }
+ return true;
+ }
} else {
- string fileName = singleFile.GetFileName (policyParent, project, language, directory, name);
- Stream stream = singleFile.CreateFileContent (policyParent, project, language, fileName, name);
+ string fileName = singleFile.GetFileName (policyParent, project, language, directory, name);
+ Stream stream = singleFile.CreateFileContent (policyParent, project, language, fileName, name);
string mimeType = GuessMimeType (fileName);
IdeApp.Workbench.NewDocument (fileName, mimeType, stream);
return true;
- }
- }
- return false;
- }
+ }
+ }
+ return false;
+ }
protected virtual bool IsValidForProject (Project project, string projectPath)
- {
- // When there is no project, only single template files can be created.
- if (project == null) {
- foreach (FileDescriptionTemplate f in files)
- if (!(f is SingleFileDescriptionTemplate))
- return false;
- }
-
- // Filter on templates
- foreach (FileDescriptionTemplate f in files)
- if (!f.SupportsProject (project, projectPath))
- return false;
-
- //filter on conditions
- if (project != null) {
- if (!string.IsNullOrEmpty (projecttype) && project.GetTypeTags ().All (p => p != projecttype))
- return false;
-
- foreach (FileTemplateCondition condition in conditions)
- if (!condition.ShouldEnableFor (project, projectPath))
- return false;
- }
-
- return true;
- }
+ {
+ // When there is no project, only single template files can be created.
+ if (project == null) {
+ foreach (FileDescriptionTemplate f in Files)
+ if (!(f is SingleFileDescriptionTemplate))
+ return false;
+ }
+
+ // Filter on templates
+ foreach (FileDescriptionTemplate f in Files)
+ if (!f.SupportsProject (project, projectPath))
+ return false;
+
+ //filter on conditions
+ if (project != null) {
+ if (!string.IsNullOrEmpty (ProjectType) && project.GetTypeTags ().All (p => p != ProjectType))
+ return false;
+
+ foreach (FileTemplateCondition condition in Conditions)
+ if (!condition.ShouldEnableFor (project, projectPath))
+ return false;
+ }
+
+ return true;
+ }
public virtual List<string> GetCompatibleLanguages (Project project, string projectPath)
- {
- if (project == null)
- return SupportedLanguages;
-
- //find the languages that both the template and the project support
- List<string> langMatches = MatchLanguagesWithProject (project);
-
- //filter on conditions
- List<string> filtered = new List<string> ();
- foreach (string lang in langMatches) {
- bool shouldEnable = true;
- foreach (FileTemplateCondition condition in conditions) {
- if (!condition.ShouldEnableFor (project, projectPath, lang)) {
- shouldEnable = false;
- break;
- }
- }
- if (shouldEnable)
- filtered.Add (lang);
- }
-
- return filtered;
- }
-
- //The languages that the template supports
- //FIXME: would it be memory-effective to cache this?
+ {
+ if (project == null)
+ return SupportedLanguages;
+
+ //find the languages that both the template and the project support
+ List<string> langMatches = MatchLanguagesWithProject (project);
+
+ //filter on conditions
+ var filtered = new List<string> ();
+ foreach (string lang in langMatches) {
+ bool shouldEnable = true;
+ foreach (FileTemplateCondition condition in Conditions) {
+ if (!condition.ShouldEnableFor (project, projectPath, lang)) {
+ shouldEnable = false;
+ break;
+ }
+ }
+ if (shouldEnable)
+ filtered.Add (lang);
+ }
+
+ return filtered;
+ }
+
+ //The languages that the template supports
+ //FIXME: would it be memory-effective to cache this?
List<string> SupportedLanguages {
get {
- List<string> templateLangs = new List<string> ();
- foreach (string s in this.LanguageName.Split (','))
- templateLangs.Add (s.Trim ());
- ExpandLanguageWildcards (templateLangs);
- return templateLangs;
- }
- }
+ var templateLangs = new List<string> ();
+ foreach (string s in LanguageName.Split (','))
+ templateLangs.Add (s.Trim ());
+ ExpandLanguageWildcards (templateLangs);
+ return templateLangs;
+ }
+ }
List<string> MatchLanguagesWithProject (Project project)
- {
- //The languages that the project supports
- List<string> projectLangs = new List<string> (project.SupportedLanguages);
- ExpandLanguageWildcards (projectLangs);
-
- List<string> templateLangs = SupportedLanguages;
-
- //Find all matches between the language strings of project and template
- List<string> langMatches = new List<string> ();
-
- foreach (string templLang in templateLangs)
- foreach (string projLang in projectLangs)
- if (templLang == projLang)
- langMatches.Add (projLang);
-
- //Eliminate duplicates
- int pos = 0;
- while (pos < langMatches.Count) {
- int next = langMatches.IndexOf (langMatches [pos], pos +1);
- if (next != -1)
- langMatches.RemoveAt (next);
- else
- pos++;
- }
-
- return langMatches;
- }
-
- void ExpandLanguageWildcards (List<string> list)
- {
- //Template can match all CodeDom .NET languages with a "*"
- if (list.Contains ("*")) {
- foreach (var lb in LanguageBindingService.LanguageBindings) {
- if (lb.GetCodeDomProvider () != null)
- list.Add (lb.Language);
- list.Remove ("*");
- }
- }
- }
- }
+ {
+ //The languages that the project supports
+ var projectLangs = new List<string> (project.SupportedLanguages);
+ ExpandLanguageWildcards (projectLangs);
+
+ List<string> templateLangs = SupportedLanguages;
+
+ //Find all matches between the language strings of project and template
+ var langMatches = new List<string> ();
+
+ foreach (string templLang in templateLangs)
+ foreach (string projLang in projectLangs)
+ if (templLang == projLang)
+ langMatches.Add (projLang);
+
+ //Eliminate duplicates
+ int pos = 0;
+ while (pos < langMatches.Count) {
+ int next = langMatches.IndexOf (langMatches [pos], pos + 1);
+ if (next != -1)
+ langMatches.RemoveAt (next);
+ else
+ pos++;
+ }
+
+ return langMatches;
+ }
+
+ static void ExpandLanguageWildcards (ICollection<string> list)
+ {
+ //Template can match all CodeDom .NET languages with a "*"
+ if (list.Contains ("*")) {
+ foreach (var lb in LanguageBindingService.LanguageBindings) {
+ if (lb.GetCodeDomProvider () != null)
+ list.Add (lb.Language);
+ list.Remove ("*");
+ }
+ }
+ }
+ }
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectTemplate.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectTemplate.cs
index d4ba526f26..dfb83e7deb 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectTemplate.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectTemplate.cs
@@ -312,7 +312,7 @@ namespace MonoDevelop.Ide.Templates
{
if (await IdeApp.Workspace.OpenWorkspaceItem (createdSolutionName)) {
foreach (string action in actions)
- IdeApp.Workbench.OpenDocument (Path.Combine (createdProjectInformation.ProjectBasePath, action));
+ IdeApp.Workbench.OpenDocument (Path.Combine (createdProjectInformation.ProjectBasePath, action), project:null);
return true;
}
return false;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/SingleFileDescriptionTemplate.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/SingleFileDescriptionTemplate.cs
index db7cc01c6b..e01f260840 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/SingleFileDescriptionTemplate.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/SingleFileDescriptionTemplate.cs
@@ -185,7 +185,7 @@ namespace MonoDevelop.Ide.Templates
public override void Show ()
{
if (!suppressAutoOpen)
- IdeApp.Workbench.OpenDocument (generatedFile);
+ IdeApp.Workbench.OpenDocument (generatedFile, project: null);
}
// Creates a file and saves it to disk. Returns the path to the new file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/Ambience.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/Ambience.cs
index fe53a0c8e4..8d206a8efe 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/Ambience.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/Ambience.cs
@@ -240,7 +240,7 @@ namespace MonoDevelop.Ide.TypeSystem
if (entity != null) {
var ambience = new ICSharpCode.NRefactory.CSharp.CSharpAmbience ();
ambience.ConversionFlags = ICSharpCode.NRefactory.TypeSystem.ConversionFlags.ShowParameterList | ICSharpCode.NRefactory.TypeSystem.ConversionFlags.ShowParameterNames | ICSharpCode.NRefactory.TypeSystem.ConversionFlags.ShowTypeParameterList;
- return ambience.ConvertEntity (entity);
+ return ambience.ConvertSymbol (entity);
}
} catch (Exception e) {
LoggingService.LogWarning ("Invalid cref:" + cref, e);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MetadataReferenceCache.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MetadataReferenceCache.cs
index 77d8e818eb..57c1bd4d58 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MetadataReferenceCache.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MetadataReferenceCache.cs
@@ -80,11 +80,11 @@ namespace MonoDevelop.Ide.TypeSystem
}
}
- static Timer timer;
+ //static Timer timer;
static MetadataReferenceCache ()
{
- timer = new Timer ((o) => CheckForChanges (), null, 10000, 10000);
+ //timer = new Timer ((o) => CheckForChanges (), null, 10000, 10000);
}
//TODO: Call this method when focus returns to MD or even better use FileSystemWatcher
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 b701bd8ecc..2eac2636ac 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs
@@ -435,7 +435,7 @@ namespace MonoDevelop.Ide.TypeSystem
static DocumentInfo CreateDocumentInfo (SolutionData data, string projectName, ProjectData id, MonoDevelop.Projects.ProjectFile f)
{
var filePath = f.FilePath;
- var sourceCodeKind = filePath.Extension == ".sketchcs" ? SourceCodeKind.Interactive : SourceCodeKind.Regular;
+ var sourceCodeKind = filePath.Extension == ".sketchcs" ? SourceCodeKind.Script : SourceCodeKind.Regular;
return DocumentInfo.Create (
id.GetOrCreateDocumentId (filePath),
f.FilePath,
@@ -756,9 +756,9 @@ namespace MonoDevelop.Ide.TypeSystem
startOffset = originalOffset;
}
if (change.NewText.Length == 0) {
- formatter.OnTheFlyFormat ((TextEditor)data, documentContext, Math.Max (0, startOffset - 1), Math.Min (data.Length, startOffset + 1));
+ formatter.OnTheFlyFormat ((TextEditor)data, documentContext, TextSegment.FromBounds (Math.Max (0, startOffset - 1), Math.Min (data.Length, startOffset + 1)));
} else {
- formatter.OnTheFlyFormat ((TextEditor)data, documentContext, startOffset, startOffset + change.NewText.Length);
+ formatter.OnTheFlyFormat ((TextEditor)data, documentContext, new TextSegment (startOffset, change.NewText.Length));
}
}
}
@@ -801,8 +801,6 @@ namespace MonoDevelop.Ide.TypeSystem
IdeApp.ProjectOperations.SaveAsync (mdProject);
});
}
-
- OnDocumentAdded (info.WithTextLoader (new MonoDevelopTextLoader (path)));
}
string DetermineFilePath (DocumentId id, string name, string filePath, IReadOnlyList<string> docFolders, bool createDirectory = false)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/ProjectCacheService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/ProjectCacheService.cs
index 533731445f..14021cc0a4 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/ProjectCacheService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/ProjectCacheService.cs
@@ -538,8 +538,8 @@ namespace MonoDevelop.Ide.TypeSystem
private static Action<Exception> s_fatalHandler;
private static Action<Exception> s_nonFatalHandler;
- private static Exception s_reportedException;
- private static string s_reportedExceptionMessage;
+ //private static Exception s_reportedException;
+ //private static string s_reportedExceptionMessage;
/// <summary>
/// Set by the host to a fail fast trigger,
@@ -658,8 +658,8 @@ namespace MonoDevelop.Ide.TypeSystem
private static void Report (Exception exception, Action<Exception> handler)
{
// hold onto last exception to make investigation easier
- s_reportedException = exception;
- s_reportedExceptionMessage = exception.ToString ();
+ //s_reportedException = exception;
+ //s_reportedExceptionMessage = exception.ToString ();
handler?.Invoke (exception);
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/StockIcons.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/StockIcons.cs
index 52e572386b..94208220a0 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/StockIcons.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/StockIcons.cs
@@ -26,161 +26,57 @@
using System;
using MonoDevelop.Core;
using Mono.Cecil;
+using Microsoft.CodeAnalysis;
namespace MonoDevelop.Ide.TypeSystem
{
public static class Stock
{
- static readonly IconId Class = "md-class";
- static readonly IconId Enum = "md-enum";
- static readonly IconId Event = "md-event";
- static readonly IconId Field = "md-field";
- static readonly IconId Interface = "md-interface";
- static readonly IconId Method = "md-method";
- static readonly IconId ExtensionMethod = "md-extensionmethod";
- static readonly IconId Property = "md-property";
- static readonly IconId Struct = "md-struct";
- static readonly IconId Delegate = "md-delegate";
public static readonly IconId Namespace = "md-name-space";
- static readonly IconId InternalClass = "md-internal-class";
- static readonly IconId InternalDelegate = "md-internal-delegate";
- static readonly IconId InternalEnum = "md-internal-enum";
- static readonly IconId InternalEvent = "md-internal-event";
- static readonly IconId InternalField = "md-internal-field";
- static readonly IconId InternalInterface = "md-internal-interface";
- static readonly IconId InternalMethod = "md-internal-method";
- static readonly IconId InternalExtensionMethod = "md-internal-extensionmethod";
- static readonly IconId InternalProperty = "md-internal-property";
- static readonly IconId InternalStruct = "md-internal-struct";
-
- static readonly IconId InternalAndProtectedClass = "md-InternalAndProtected-class";
- static readonly IconId InternalAndProtectedDelegate = "md-InternalAndProtected-delegate";
- static readonly IconId InternalAndProtectedEnum = "md-InternalAndProtected-enum";
- static readonly IconId InternalAndProtectedEvent = "md-InternalAndProtected-event";
- static readonly IconId InternalAndProtectedField = "md-InternalAndProtected-field";
- static readonly IconId InternalAndProtectedInterface = "md-InternalAndProtected-interface";
- static readonly IconId InternalAndProtectedMethod = "md-InternalAndProtected-method";
- static readonly IconId InternalAndProtectedExtensionMethod = "md-InternalAndProtected-extensionmethod";
- static readonly IconId InternalAndProtectedProperty = "md-InternalAndProtected-property";
- static readonly IconId InternalAndProtectedStruct = "md-InternalAndProtected-struct";
-
- static readonly IconId PrivateClass = "md-private-class";
- static readonly IconId PrivateDelegate = "md-private-delegate";
- static readonly IconId PrivateEnum = "md-private-enum";
- static readonly IconId PrivateEvent = "md-private-event";
- static readonly IconId PrivateField = "md-private-field";
- static readonly IconId PrivateInterface = "md-private-interface";
- static readonly IconId PrivateMethod = "md-private-method";
- static readonly IconId PrivateExtensionMethod = "md-private-extensionmethod";
- static readonly IconId PrivateProperty = "md-private-property";
- static readonly IconId PrivateStruct = "md-private-struct";
-
- static readonly IconId ProtectedClass = "md-protected-class";
- static readonly IconId ProtectedDelegate = "md-protected-delegate";
- static readonly IconId ProtectedEnum = "md-protected-enum";
- static readonly IconId ProtectedEvent = "md-protected-event";
- static readonly IconId ProtectedField = "md-protected-field";
- static readonly IconId ProtectedInterface = "md-protected-interface";
- static readonly IconId ProtectedMethod = "md-protected-method";
- static readonly IconId ProtectedExtensionMethod = "md-protected-extensionmethod";
- static readonly IconId ProtectedProperty = "md-protected-property";
- static readonly IconId ProtectedStruct = "md-protected-struct";
-
- static readonly IconId ProtectedOrInternalClass = "md-ProtectedOrInternal-class";
- static readonly IconId ProtectedOrInternalDelegate = "md-ProtectedOrInternal-delegate";
- static readonly IconId ProtectedOrInternalEnum = "md-ProtectedOrInternal-enum";
- static readonly IconId ProtectedOrInternalEvent = "md-ProtectedOrInternal-event";
- static readonly IconId ProtectedOrInternalField = "md-ProtectedOrInternal-field";
- static readonly IconId ProtectedOrInternalInterface = "md-ProtectedOrInternal-interface";
- static readonly IconId ProtectedOrInternalMethod = "md-ProtectedOrInternal-method";
- static readonly IconId ProtectedOrInternalExtensionMethod = "md-ProtectedOrInternal-extensionmethod";
- static readonly IconId ProtectedOrInternalProperty = "md-ProtectedOrInternal-property";
- static readonly IconId ProtectedOrInternalStruct = "md-ProtectedOrInternal-struct";
-
- static IconId[,] typeIconTable = new IconId[,] {
- {Class, PrivateClass, Class, ProtectedClass, InternalClass, ProtectedOrInternalClass, InternalAndProtectedClass}, // class
- {Enum, PrivateEnum, Enum, ProtectedEnum, InternalEnum, ProtectedOrInternalEnum, InternalAndProtectedEnum}, // enum
- {Interface, PrivateInterface, Interface, ProtectedInterface, InternalInterface, ProtectedOrInternalInterface, InternalAndProtectedInterface}, // interface
- {Struct, PrivateStruct, Struct, ProtectedStruct, InternalStruct, ProtectedOrInternalStruct, InternalAndProtectedStruct}, // struct
- {Delegate, PrivateDelegate, Delegate, ProtectedDelegate, InternalDelegate, ProtectedOrInternalDelegate, InternalAndProtectedDelegate} // delegate
- };
- static readonly IconId[] fieldIconTable = {
- Stock.Field, Stock.PrivateField, Stock.Field, Stock.ProtectedField, Stock.InternalField, Stock.ProtectedOrInternalField, Stock.InternalAndProtectedField
- };
- static readonly IconId[] methodIconTable = {
- Stock.Method, Stock.PrivateMethod, Stock.Method, Stock.ProtectedMethod, Stock.InternalMethod, Stock.ProtectedOrInternalMethod, Stock.InternalAndProtectedMethod
- };
- static readonly IconId[] extensionMethodIconTable = {
- Stock.ExtensionMethod, Stock.PrivateExtensionMethod, Stock.ExtensionMethod, Stock.ProtectedExtensionMethod, Stock.InternalExtensionMethod, Stock.ProtectedOrInternalExtensionMethod, Stock.InternalAndProtectedExtensionMethod
- };
- static readonly IconId[] propertyIconTable = {
- Stock.Property, Stock.PrivateProperty, Stock.Property, Stock.ProtectedProperty, Stock.InternalProperty, Stock.ProtectedOrInternalProperty, Stock.InternalAndProtectedProperty
- };
- static readonly IconId[] eventIconTable = {
- Stock.Event, Stock.PrivateEvent, Stock.Event, Stock.ProtectedEvent, Stock.InternalEvent, Stock.ProtectedOrInternalEvent, Stock.InternalAndProtectedEvent
- };
-
-// public static IconId GetStockIcon (this INamedElement element)
-// {
-// if (element is IType)
-// return ((IType)element).GetStockIcon ();
-// if (element is ITypeParameter)
-// return ((ITypeParameter)element).GetStockIcon ();
-// if (element is IUnresolvedEntity)
-// return ((IUnresolvedEntity)element).GetStockIcon ();
-// return ((IEntity)element).GetStockIcon ();
-// }
-//
-// public static IconId GetStockIcon (this ITypeDefinition entity)
-// {
-// return GetStockIcon ((IType)entity);
-// }
-//
-// public static IconId GetStockIcon (this IType entity)
-// {
-// var def = entity.GetDefinition ();
-// if (def == null)
-// return Class;
-// switch (def.Kind) {
-// case TypeKind.Class:
-// return typeIconTable [0, (int)def.Accessibility];
-// case TypeKind.Enum:
-// return typeIconTable [1, (int)def.Accessibility];
-// case TypeKind.Interface:
-// return typeIconTable [2, (int)def.Accessibility];
-// case TypeKind.Struct:
-// return typeIconTable [3, (int)def.Accessibility];
-// case TypeKind.Delegate:
-// return typeIconTable [4, (int)def.Accessibility];
-// default:
-// return typeIconTable [0, (int)def.Accessibility];
-// }
-// }
+ public static IconId GetStockIcon (this Microsoft.CodeAnalysis.ISymbol symbol)
+ {
+ return "md-" + GetAccess (symbol.DeclaredAccessibility) + GetGlobal (symbol) + GetSource (symbol);
+ }
- static int GetIndex (Microsoft.CodeAnalysis.Accessibility accessibility)
+ internal static string GetAccess (Accessibility accessibility)
{
switch (accessibility) {
case Microsoft.CodeAnalysis.Accessibility.NotApplicable:
- return 0;
+ return "";
case Microsoft.CodeAnalysis.Accessibility.Private:
- return 1;
+ return "private-";
case Microsoft.CodeAnalysis.Accessibility.ProtectedAndInternal:
- return 5;
+ return "ProtectedOrInternal-";
case Microsoft.CodeAnalysis.Accessibility.Protected:
- return 3;
+ return "protected-";
case Microsoft.CodeAnalysis.Accessibility.Internal:
- return 4;
+ return "internal-";
case Microsoft.CodeAnalysis.Accessibility.ProtectedOrInternal:
- return 5;
+ return "ProtectedOrInternal-";
case Microsoft.CodeAnalysis.Accessibility.Public:
- return 2;
+ return "";
default:
throw new ArgumentOutOfRangeException ();
+ }
+ }
+
+ static string GetGlobal (ISymbol symbol)
+ {
+ switch (symbol.Kind) {
+ case Microsoft.CodeAnalysis.SymbolKind.NamedType:
+ return "";
+ case Microsoft.CodeAnalysis.SymbolKind.Event:
+ case Microsoft.CodeAnalysis.SymbolKind.Field:
+ case Microsoft.CodeAnalysis.SymbolKind.Method:
+ case Microsoft.CodeAnalysis.SymbolKind.Property:
+ return symbol.IsStatic ? "static-" : "";
+ default:
+ return "";
}
}
- public static IconId GetStockIcon (this Microsoft.CodeAnalysis.ISymbol symbol)
+ static string GetSource(Microsoft.CodeAnalysis.ISymbol symbol)
{
switch (symbol.Kind) {
case Microsoft.CodeAnalysis.SymbolKind.Alias:
@@ -192,69 +88,40 @@ namespace MonoDevelop.Ide.TypeSystem
case Microsoft.CodeAnalysis.SymbolKind.Local:
case Microsoft.CodeAnalysis.SymbolKind.NetModule:
case Microsoft.CodeAnalysis.SymbolKind.PointerType:
- return Field;
- case Microsoft.CodeAnalysis.SymbolKind.NamedType:
- var namedTypeSymbol = (Microsoft.CodeAnalysis.INamedTypeSymbol)symbol;
- return typeIconTable [GetTypeIndex(namedTypeSymbol.TypeKind ), GetIndex (namedTypeSymbol.DeclaredAccessibility)];
- case Microsoft.CodeAnalysis.SymbolKind.Event:
- var evtSymbol = (Microsoft.CodeAnalysis.IEventSymbol)symbol;
- return eventIconTable [GetIndex (evtSymbol.DeclaredAccessibility)];
case Microsoft.CodeAnalysis.SymbolKind.Field:
- var fieldSymbol = (Microsoft.CodeAnalysis.IFieldSymbol)symbol;
- return fieldIconTable [GetIndex (fieldSymbol.DeclaredAccessibility)];
- case Microsoft.CodeAnalysis.SymbolKind.Method:
- var methodSymbol = (Microsoft.CodeAnalysis.IMethodSymbol)symbol;
- return methodIconTable [GetIndex (methodSymbol.DeclaredAccessibility)];
- case Microsoft.CodeAnalysis.SymbolKind.Namespace:
- return Namespace;
case Microsoft.CodeAnalysis.SymbolKind.Parameter:
- return Field;
- case Microsoft.CodeAnalysis.SymbolKind.Property:
- var propertySymbol = (Microsoft.CodeAnalysis.IPropertySymbol)symbol;
- return propertyIconTable [GetIndex (propertySymbol.DeclaredAccessibility)];
case Microsoft.CodeAnalysis.SymbolKind.RangeVariable:
- return Field;
case Microsoft.CodeAnalysis.SymbolKind.TypeParameter:
- return Stock.typeIconTable [0, 0];
case Microsoft.CodeAnalysis.SymbolKind.Preprocessing:
- return Field;
- default:
- throw new ArgumentOutOfRangeException ();
- }
- }
-
- static int GetTypeIndex (Microsoft.CodeAnalysis.TypeKind typeKind)
- {
- switch (typeKind) {
- case Microsoft.CodeAnalysis.TypeKind.Unknown:
- case Microsoft.CodeAnalysis.TypeKind.Array:
- return 0;
- case Microsoft.CodeAnalysis.TypeKind.Class:
- return 0;
- case Microsoft.CodeAnalysis.TypeKind.Delegate:
- return 4;
- case Microsoft.CodeAnalysis.TypeKind.Dynamic:
- return 0;
- case Microsoft.CodeAnalysis.TypeKind.Enum:
- return 1;
- case Microsoft.CodeAnalysis.TypeKind.Error:
- return 0;
- case Microsoft.CodeAnalysis.TypeKind.Interface:
- return 2;
- case Microsoft.CodeAnalysis.TypeKind.Module:
- return 0;
- case Microsoft.CodeAnalysis.TypeKind.Pointer:
- return 0;
- case Microsoft.CodeAnalysis.TypeKind.Struct:
- return 3;
- case Microsoft.CodeAnalysis.TypeKind.TypeParameter:
- return 0;
- case Microsoft.CodeAnalysis.TypeKind.Submission:
- return 0;
+ return "field";
+ case Microsoft.CodeAnalysis.SymbolKind.NamedType:
+ var namedTypeSymbol = (Microsoft.CodeAnalysis.INamedTypeSymbol)symbol;
+ switch (namedTypeSymbol.TypeKind) {
+ case Microsoft.CodeAnalysis.TypeKind.Class:
+ return "class";
+ case Microsoft.CodeAnalysis.TypeKind.Delegate:
+ return "delegate";
+ case Microsoft.CodeAnalysis.TypeKind.Enum:
+ return "enum";
+ case Microsoft.CodeAnalysis.TypeKind.Interface:
+ return "interface";
+ case Microsoft.CodeAnalysis.TypeKind.Struct:
+ return "struct";
+ default:
+ return "class";
+ }
+
+ case Microsoft.CodeAnalysis.SymbolKind.Method:
+ return "method";
+ case Microsoft.CodeAnalysis.SymbolKind.Namespace:
+ return "name-space";
+ case Microsoft.CodeAnalysis.SymbolKind.Property:
+ return "property";
+ case Microsoft.CodeAnalysis.SymbolKind.Event:
+ return "event";
default:
throw new ArgumentOutOfRangeException ();
}
}
-
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
index 8efc231214..6516c0abb4 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
@@ -3507,8 +3507,8 @@
<Compile Include="MonoDevelop.Components.AutoTest.Operations\SelectedOperation.cs" />
<Compile Include="MonoDevelop.Components\Windows\GtkWPFWidget.cs" />
<Compile Include="MonoDevelop.Components\Windows\GtkWin32Interop.cs" />
- <Compile Include="MonoDevelop.Components.Docking\DockPositionType.cs" />
<Compile Include="MonoDevelop.Components\FileChooserAction.cs" />
+ <Compile Include="MonoDevelop.Components.Docking\DockPositionType.cs" />
<Compile Include="MonoDevelop.Components\ButtonEvent.cs" />
<Compile Include="MonoDevelop.Components\Window.cs" />
<Compile Include="MonoDevelop.Components\Dialog.cs" />
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Ide.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Ide.cs
index 4b2c18a232..b5ce18e2e7 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Ide.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Ide.cs
@@ -344,7 +344,7 @@ namespace MonoDevelop.Ide
foreach (var file in filteredFiles) {
try {
- Workbench.OpenDocument (file.FileName, file.Line, file.Column, file.Options);
+ Workbench.OpenDocument (file.FileName, null, file.Line, file.Column, file.Options);
} catch (Exception ex) {
MessageService.ShowError (GettextCatalog.GetString ("Could not open file: {0}", file.FileName), ex);
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdePreferences.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdePreferences.cs
index 0f7395e565..1b79545e62 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdePreferences.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdePreferences.cs
@@ -143,7 +143,7 @@ namespace MonoDevelop.Ide
public readonly ConfigurationProperty<bool> IncludeEditorBrowsableAdvancedMembers = ConfigurationProperty.Create ("IncludeEditorBrowsableAdvancedMembers", true);
public readonly ConfigurationProperty<int> CompletionListRows = ConfigurationProperty.Create ("CompletionListRows", 7);
- public readonly ConfigurationProperty<bool> EnableSourceAnalysis = ConfigurationProperty.Create ("MonoDevelop.AnalysisCore.AnalysisEnabled", false);
+ public readonly ConfigurationProperty<bool> EnableSourceAnalysis = ConfigurationProperty.Create ("MonoDevelop.AnalysisCore.AnalysisEnabled", true);
public readonly ConfigurationProperty<bool> EnableUnitTestEditorIntegration = ConfigurationProperty.Create ("Testing.EnableUnitTestEditorIntegration", false);
public readonly ConfigurationProperty<string> ColorScheme = ConfigurationProperty.Create ("ColorScheme", "Default");
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs
index f0d27c6c1a..3cb1ce17ab 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs
@@ -1346,7 +1346,7 @@ namespace MonoDevelop.Ide
}
//wait for any custom tools that were triggered by the save, since the build may depend on them
- MonoDevelop.Ide.CustomTools.CustomToolService.WaitForRunningTools (monitor);
+ await MonoDevelop.Ide.CustomTools.CustomToolService.WaitForRunningTools (monitor);
if (skipPrebuildCheck || result.ErrorCount == 0) {
tt.Trace ("Building item");
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs
index 317e98810e..369bdd3200 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs
@@ -226,7 +226,12 @@ namespace MonoDevelop.Ide
monitor.Dispose ();
}
}
-
+
+ bool IBuildTarget.CanBuild (ConfigurationSelector configuration)
+ {
+ return true;
+ }
+
bool IBuildTarget.CanExecute (ExecutionContext context, ConfigurationSelector configuration)
{
if (IdeApp.ProjectOperations.CurrentSelectedSolution != null)
@@ -488,7 +493,7 @@ namespace MonoDevelop.Ide
}
if (closedDocs != null) {
foreach (string doc in closedDocs) {
- IdeApp.Workbench.OpenDocument (doc, false);
+ IdeApp.Workbench.OpenDocument (doc, null, false);
}
}
}
@@ -1062,20 +1067,23 @@ namespace MonoDevelop.Ide
void NotifyItemRemovedFromSolution (object sender, SolutionItemChangeEventArgs args)
{
- NotifyItemRemovedFromSolutionRec (sender, args.SolutionItem, args.Solution);
+ NotifyItemRemovedFromSolutionRec (sender, args.SolutionItem, args.Solution, args);
}
- void NotifyItemRemovedFromSolutionRec (object sender, SolutionFolderItem e, Solution sol)
+ void NotifyItemRemovedFromSolutionRec (object sender, SolutionFolderItem e, Solution sol, SolutionItemChangeEventArgs originalArgs)
{
if (e == IdeApp.ProjectOperations.CurrentSelectedSolutionItem)
IdeApp.ProjectOperations.CurrentSelectedSolutionItem = null;
if (e is SolutionFolder) {
foreach (SolutionFolderItem ce in ((SolutionFolder)e).Items)
- NotifyItemRemovedFromSolutionRec (sender, ce, sol);
+ NotifyItemRemovedFromSolutionRec (sender, ce, sol, null);
}
+
+ // For the root item send the original args, since they contain reload information
+
if (ItemRemovedFromSolution != null)
- ItemRemovedFromSolution (sender, new SolutionItemChangeEventArgs (e, sol, false));
+ ItemRemovedFromSolution (sender, originalArgs ?? new SolutionItemChangeEventArgs (e, sol, false));
}
void NotifyDescendantItemAdded (object s, WorkspaceItemEventArgs args)
diff --git a/main/tests/Ide.Tests/FileTransferTests.cs b/main/tests/Ide.Tests/FileTransferTests.cs
index 073cf7ab8b..3b55cb24d5 100644
--- a/main/tests/Ide.Tests/FileTransferTests.cs
+++ b/main/tests/Ide.Tests/FileTransferTests.cs
@@ -87,6 +87,68 @@ namespace Ide.Tests
Assert.IsFalse (lib2.Files.GetFile (sourceDir) != null);
Assert.IsFalse (lib2.Files.GetFile (sourceFile) != null);
}
+
+ [Test]
+ public async Task MoveFileFromOneFolderToAnotherAndSaveProject ()
+ {
+ string solFile = Util.GetSampleProject ("transfer-tests", "console-with-libs.sln");
+ var sol = (Solution) await MonoDevelop.Projects.Services.ProjectService.ReadWorkspaceItem (Util.GetMonitor (), solFile);
+ var lib2 = (DotNetProject) sol.FindProjectByName ("library2");
+
+ var sourceDir = lib2.ItemDirectory.Combine ("f2");
+ var targetDir = lib2.ItemDirectory.Combine ("f2-empty");
+ var sourceFile = sourceDir.Combine ("a.cs");
+ var targetFile = targetDir.Combine ("a.cs");
+
+ // Git can't commit empty folders, so that folder has a dummy file that needs to be deleted
+ File.Delete (targetDir.Combine ("delete-me"));
+
+ Assert.IsTrue (lib2.Files.GetFile (sourceFile) != null);
+ Assert.IsFalse (lib2.Files.GetFile (targetFile) != null);
+
+ ProjectOperations.TransferFilesInternal (Util.GetMonitor (), lib2, sourceFile, lib2, targetFile, true, true);
+
+ Assert.IsFalse (lib2.Files.GetFile (sourceFile) != null);
+ Assert.IsTrue (lib2.Files.GetFile (targetFile) != null);
+
+ await lib2.SaveAsync (Util.GetMonitor ());
+ sol = (Solution) await MonoDevelop.Projects.Services.ProjectService.ReadWorkspaceItem (Util.GetMonitor (), solFile);
+ var reloadedLib2 = (DotNetProject) sol.FindProjectByName ("library2");
+
+ Assert.IsTrue (reloadedLib2.Files.GetFile (targetFile) != null);
+ Assert.IsFalse (reloadedLib2.Files.GetFile (sourceFile) != null);
+ }
+
+ [Test]
+ public async Task CopyFileFromOneFolderToAnotherAndSaveProject ()
+ {
+ string solFile = Util.GetSampleProject ("transfer-tests", "console-with-libs.sln");
+ var sol = (Solution) await MonoDevelop.Projects.Services.ProjectService.ReadWorkspaceItem (Util.GetMonitor (), solFile);
+ var lib2 = (DotNetProject) sol.FindProjectByName ("library2");
+
+ var sourceDir = lib2.ItemDirectory.Combine ("f2");
+ var targetDir = lib2.ItemDirectory.Combine ("f2-empty");
+ var sourceFile = sourceDir.Combine ("a.cs");
+ var targetFile = targetDir.Combine ("a.cs");
+
+ // Git can't commit empty folders, so that folder has a dummy file that needs to be deleted
+ File.Delete (targetDir.Combine ("delete-me"));
+
+ Assert.IsTrue (lib2.Files.GetFile (sourceFile) != null);
+ Assert.IsFalse (lib2.Files.GetFile (targetFile) != null);
+
+ ProjectOperations.TransferFilesInternal (Util.GetMonitor (), lib2, sourceFile, lib2, targetFile, false, true);
+
+ Assert.IsTrue (lib2.Files.GetFile (sourceFile) != null);
+ Assert.IsTrue (lib2.Files.GetFile (targetFile) != null);
+
+ await lib2.SaveAsync (Util.GetMonitor ());
+ sol = (Solution) await MonoDevelop.Projects.Services.ProjectService.ReadWorkspaceItem (Util.GetMonitor (), solFile);
+ var reloadedLib2 = (DotNetProject) sol.FindProjectByName ("library2");
+
+ Assert.IsTrue (reloadedLib2.Files.GetFile (targetFile) != null);
+ Assert.IsTrue (reloadedLib2.Files.GetFile (sourceFile) != null);
+ }
}
}