diff options
31 files changed, 553 insertions, 365 deletions
diff --git a/main/external/guiunit b/main/external/guiunit -Subproject d7e684423ec8e7a6aaf9ed0bf585b09abb5120f +Subproject 8877cb04f6f2486830eb79af0db81a2196bc06a diff --git a/main/external/mono-addins b/main/external/mono-addins -Subproject f21821cb82e8525ba3899c9840f24f3de5e3d99 +Subproject 387f8db55c0d4bb542c979945411dc62f7eb6e0 diff --git a/main/external/ngit b/main/external/ngit -Subproject 278c05fd8e31c09bce840d348a8677e36f246ab +Subproject 292a4e4ff81d1c4f59b04cd2b9bc1a1f588fa4e diff --git a/main/external/nrefactory b/main/external/nrefactory -Subproject 5aded3faae91519fdd15f5b8b0f0daf1ffa3444 +Subproject c5ca3ac73640dbb7d2ed8c689097c27c6b16eb1 diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicy.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicy.cs index 6cfbed3307..0b8fe8afe2 100644 --- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicy.cs +++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicy.cs @@ -195,25 +195,15 @@ namespace MonoDevelop.CSharp.Formatting } [ItemProperty] - public bool AlignEmbeddedUsingStatements { + public bool AlignEmbeddedStatements { get { - return options.AlignEmbeddedUsingStatements; + return options.AlignEmbeddedStatements; } set { - options.AlignEmbeddedUsingStatements = value; + options.AlignEmbeddedStatements = value; } } - - [ItemProperty] - public bool AlignEmbeddedIfStatements { - get { - return options.AlignEmbeddedIfStatements; - } - set { - options.AlignEmbeddedIfStatements = value; - } - } - + [ItemProperty] public PropertyFormatting SimplePropertyFormatting { get { diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingProfileDialog.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingProfileDialog.cs index e0207f3a6e..9ab1ff5477 100644 --- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingProfileDialog.cs +++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingProfileDialog.cs @@ -552,8 +552,7 @@ class Test { } "); - AddOption (indentOptions, category, "AlignEmbeddedIfStatements", GettextCatalog.GetString ("Align embedded 'if' statements"), "class AClass { void AMethod () { if (a) if (b) { int c; } } } "); - AddOption (indentOptions, category, "AlignEmbeddedUsingStatements", GettextCatalog.GetString ("Align embedded 'using' statements"), "class AClass { void AMethod () {using (IDisposable a = null) using (IDisposable b = null) { int c; } } }"); + AddOption (indentOptions, category, "AlignEmbeddedStatements", GettextCatalog.GetString ("Align embedded statements"), "class AClass { void AMethod () { if (a) if (b) { int c; } } } "); treeviewIndentOptions.ExpandAll (); #endregion diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/AllmanCSharpPolicy.xml b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/AllmanCSharpPolicy.xml index 1c04f1b65a..1b15cfd6de 100644 --- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/AllmanCSharpPolicy.xml +++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/AllmanCSharpPolicy.xml @@ -39,8 +39,7 @@ THE SOFTWARE. <IndentSwitchBody>True</IndentSwitchBody> <IndentCaseBody>True</IndentCaseBody> <IndentBreakStatements>True</IndentBreakStatements> - <AlignEmbeddedUsingStatements>True</AlignEmbeddedUsingStatements> - <AlignEmbeddedIfStatements>True</AlignEmbeddedIfStatements> + <AlignEmbeddedStatements>True</AlignEmbeddedStatements> <SimplePropertyFormatting>AllowOneLine</SimplePropertyFormatting> <AutoPropertyFormatting>AllowOneLine</AutoPropertyFormatting> <NamespaceBraceStyle>NextLine</NamespaceBraceStyle> diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/GNUCSharpPolicy.xml b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/GNUCSharpPolicy.xml index 53f4997373..e0b0645814 100644 --- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/GNUCSharpPolicy.xml +++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/GNUCSharpPolicy.xml @@ -40,8 +40,7 @@ THE SOFTWARE. <IndentSwitchBody>True</IndentSwitchBody> <IndentCaseBody>True</IndentCaseBody> <IndentBreakStatements>True</IndentBreakStatements> - <AlignEmbeddedUsingStatements>True</AlignEmbeddedUsingStatements> - <AlignEmbeddedIfStatements>True</AlignEmbeddedIfStatements> + <AlignEmbeddedStatements>True</AlignEmbeddedStatements> <PropertyFormatting>AllowOneLine</PropertyFormatting> <NamespaceBraceStyle>NextLine</NamespaceBraceStyle> <ClassBraceStyle>NextLine</ClassBraceStyle> diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/KRCSharpPolicy.xml b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/KRCSharpPolicy.xml index 5b8c345fed..13c33bf4f3 100644 --- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/KRCSharpPolicy.xml +++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/KRCSharpPolicy.xml @@ -39,8 +39,7 @@ THE SOFTWARE. <IndentSwitchBody>True</IndentSwitchBody> <IndentCaseBody>True</IndentCaseBody> <IndentBreakStatements>True</IndentBreakStatements> - <AlignEmbeddedUsingStatements>True</AlignEmbeddedUsingStatements> - <AlignEmbeddedIfStatements>True</AlignEmbeddedIfStatements> + <AlignEmbeddedStatements>True</AlignEmbeddedStatements> <SimplePropertyFormatting>AllowOneLine</SimplePropertyFormatting> <AutoPropertyFormatting>AllowOneLine</AutoPropertyFormatting> <NamespaceBraceStyle>NextLine</NamespaceBraceStyle> diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/MonoCSharpPolicy.xml b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/MonoCSharpPolicy.xml index 2e4955d933..eafb844b4e 100644 --- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/MonoCSharpPolicy.xml +++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/MonoCSharpPolicy.xml @@ -39,8 +39,7 @@ THE SOFTWARE. <IndentSwitchBody>False</IndentSwitchBody> <IndentCaseBody>True</IndentCaseBody> <IndentBreakStatements>True</IndentBreakStatements> - <AlignEmbeddedUsingStatements>True</AlignEmbeddedUsingStatements> - <AlignEmbeddedIfStatements>True</AlignEmbeddedIfStatements> + <AlignEmbeddedStatements>True</AlignEmbeddedStatements> <SimplePropertyFormatting>AllowOneLine</SimplePropertyFormatting> <AutoPropertyFormatting>AllowOneLine</AutoPropertyFormatting> <NamespaceBraceStyle>NextLine</NamespaceBraceStyle> diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/SharpDevelopCSharpPolicy.xml b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/SharpDevelopCSharpPolicy.xml index 9485f76f7c..6ad525fc92 100644 --- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/SharpDevelopCSharpPolicy.xml +++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/SharpDevelopCSharpPolicy.xml @@ -39,8 +39,7 @@ THE SOFTWARE. <IndentSwitchBody>True</IndentSwitchBody> <IndentCaseBody>True</IndentCaseBody> <IndentBreakStatements>True</IndentBreakStatements> - <AlignEmbeddedUsingStatements>True</AlignEmbeddedUsingStatements> - <AlignEmbeddedIfStatements>True</AlignEmbeddedIfStatements> + <AlignEmbeddedStatements>True</AlignEmbeddedStatements> <SimplePropertyFormatting>AllowOneLine</SimplePropertyFormatting> <AutoPropertyFormatting>AllowOneLine</AutoPropertyFormatting> <NamespaceBraceStyle>NextLine</NamespaceBraceStyle> diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/WhitesmithsCSharpPolicy.xml b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/WhitesmithsCSharpPolicy.xml index 027251b724..cee3c898eb 100644 --- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/WhitesmithsCSharpPolicy.xml +++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/WhitesmithsCSharpPolicy.xml @@ -39,8 +39,7 @@ THE SOFTWARE. <IndentSwitchBody>True</IndentSwitchBody> <IndentCaseBody>True</IndentCaseBody> <IndentBreakStatements>True</IndentBreakStatements> - <AlignEmbeddedUsingStatements>True</AlignEmbeddedUsingStatements> - <AlignEmbeddedIfStatements>True</AlignEmbeddedIfStatements> + <AlignEmbeddedStatements>True</AlignEmbeddedStatements> <SimplePropertyFormatting>AllowOneLine</SimplePropertyFormatting> <AutoPropertyFormatting>AllowOneLine</AutoPropertyFormatting> <NamespaceBraceStyle>NextLineShifted</NamespaceBraceStyle> diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/SignatureMarkupCreator.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/SignatureMarkupCreator.cs index c85426a764..6d32abf020 100644 --- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/SignatureMarkupCreator.cs +++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/SignatureMarkupCreator.cs @@ -58,6 +58,7 @@ namespace MonoDevelop.CSharp } int highlightParameter = -1; + public int HighlightParameter { get { return highlightParameter; @@ -97,9 +98,7 @@ namespace MonoDevelop.CSharp } catch (Exception e) { var compilation = GetCompilation (type); if (compilation == null) { - - Console.WriteLine ("type:"+type.GetType ()); - Console.WriteLine ("got exception while conversion:" + e); + LoggingService.LogWarning ("type:" + type.GetType (), e); return "?"; } astType = new TypeSystemAstBuilder (new CSharpResolver (compilation)).ConvertType (type); @@ -169,7 +168,7 @@ namespace MonoDevelop.CSharp } string reason; if (entity.IsObsolete (out reason)) { - var attr = reason == null ? "[Obsolete]" : "[Obsolete(\"" + reason + "\")]"; + var attr = reason == null ? "[Obsolete]" : "[Obsolete(\"" + reason + "\")]"; result = "<span size=\"smaller\">" + attr + "</span>" + Environment.NewLine + result; } return result; @@ -310,9 +309,9 @@ namespace MonoDevelop.CSharp return result; } - static bool IsObjectOrValueType(IType type) + static bool IsObjectOrValueType (IType type) { - var d = type.GetDefinition(); + var d = type.GetDefinition (); return d != null && (d.KnownTypeCode == KnownTypeCode.Object || d.KnownTypeCode == KnownTypeCode.ValueType); } @@ -321,7 +320,7 @@ namespace MonoDevelop.CSharp if (t == null) throw new ArgumentNullException ("t"); var result = new StringBuilder (); - var highlightedTypeName = Highlight (CSharpAmbience.FilterName (t.Name), colorStyle.UserTypes); + var highlightedTypeName = Highlight (FilterEntityName (t.Name), colorStyle.UserTypes); result.Append (highlightedTypeName); var color = AlphaBlend (colorStyle.PlainText.Foreground, colorStyle.PlainText.Background, optionalAlpha); @@ -346,7 +345,7 @@ namespace MonoDevelop.CSharp result.Append (Highlight ("struct", colorStyle.KeywordDeclaration)); } foreach (var bt in tp.DirectBaseTypes) { - if (!IsObjectOrValueType(bt)) { + if (!IsObjectOrValueType (bt)) { if (constraints > 0) { result.Append (","); if (constraints % 5 == 0) { @@ -382,7 +381,7 @@ namespace MonoDevelop.CSharp parameters = parameters.Skip (def.DeclaringTypeDefinition.TypeParameterCount); AppendTypeParameters (result, parameters); } - + void AppendTypeArgumentList (StringBuilder result, IType def) { IEnumerable<IType> parameters = def.TypeArguments; @@ -394,7 +393,7 @@ namespace MonoDevelop.CSharp string GetTypeNameWithParameters (IType t) { StringBuilder result = new StringBuilder (); - result.Append (Highlight (CSharpAmbience.FilterName (t.Name), colorStyle.UserTypesTypeParameters)); + result.Append (Highlight (FilterEntityName (t.Name), colorStyle.UserTypesTypeParameters)); if (t.TypeParameterCount > 0) { if (t.TypeArguments.Count > 0) { AppendTypeArgumentList (result, t); @@ -404,7 +403,7 @@ namespace MonoDevelop.CSharp } return result.ToString (); } - + string GetTypeMarkup (IType t, bool includeDeclaringTypes = false) { if (t == null) @@ -504,8 +503,7 @@ namespace MonoDevelop.CSharp if (i % 5 == 0) { result.AppendLine (","); result.Append ("\t"); - } - else { + } else { result.Append (", "); } } @@ -527,8 +525,7 @@ namespace MonoDevelop.CSharp if (i % 5 == 0) { result.AppendLine (","); result.Append ("\t"); - } - else { + } else { result.Append (", "); } } @@ -540,6 +537,11 @@ namespace MonoDevelop.CSharp result.Append (">"); } + static string FilterEntityName (string name) + { + return AmbienceService.EscapeText (CSharpAmbience.FilterName (name)); + } + public string GetDelegateInfo (IType type) { if (type == null) @@ -557,7 +559,7 @@ namespace MonoDevelop.CSharp } - result.Append (CSharpAmbience.FilterName (t.Name)); + result.Append (FilterEntityName (t.Name)); AppendTypeParameters (result, method.TypeParameters); @@ -565,7 +567,7 @@ namespace MonoDevelop.CSharp result.Append (" "); result.Append ('('); - AppendParameterList (result, method.Parameters, formattingOptions.SpaceBeforeDelegateDeclarationParameterComma, formattingOptions.SpaceAfterDelegateDeclarationParameterComma, false); + AppendParameterList (result, method.Parameters, formattingOptions.SpaceBeforeDelegateDeclarationParameterComma, formattingOptions.SpaceAfterDelegateDeclarationParameterComma, false); result.Append (')'); return result.ToString (); } @@ -587,7 +589,7 @@ namespace MonoDevelop.CSharp } - result.Append (CSharpAmbience.FilterName (delegateType.Name)); + result.Append (FilterEntityName (delegateType.Name)); if (delegateType.TypeArguments.Count > 0) { AppendTypeArgumentList (result, delegateType); @@ -599,7 +601,7 @@ namespace MonoDevelop.CSharp result.Append (" "); result.Append ('('); - AppendParameterList (result, method.Parameters, formattingOptions.SpaceBeforeDelegateDeclarationParameterComma, formattingOptions.SpaceAfterDelegateDeclarationParameterComma); + AppendParameterList (result, method.Parameters, formattingOptions.SpaceBeforeDelegateDeclarationParameterComma, formattingOptions.SpaceAfterDelegateDeclarationParameterComma); result.Append (')'); return result.ToString (); } @@ -621,7 +623,7 @@ namespace MonoDevelop.CSharp result.Append (" "); } - result.Append (CSharpAmbience.FilterName (variable.Name)); + result.Append (FilterEntityName (variable.Name)); if (variable.IsConst) { if (formattingOptions.SpaceAroundAssignment) { @@ -634,7 +636,7 @@ namespace MonoDevelop.CSharp return result.ToString (); } - + string GetFieldMarkup (IField field) { @@ -655,9 +657,9 @@ namespace MonoDevelop.CSharp result.Append (" "); } - result.Append (HighlightSemantically (CSharpAmbience.FilterName (field.Name), colorStyle.UserFieldDeclaration)); + result.Append (HighlightSemantically (FilterEntityName (field.Name), colorStyle.UserFieldDeclaration)); - if (field.IsFixed){ + if (field.IsFixed) { if (formattingOptions.SpaceBeforeArrayDeclarationBrackets) { result.Append (" ["); } else { @@ -704,14 +706,14 @@ namespace MonoDevelop.CSharp result.Append ("operator "); result.Append (CSharpAmbience.GetOperator (method.Name)); } else { - result.Append (HighlightSemantically (CSharpAmbience.FilterName (method.Name), colorStyle.UserMethodDeclaration)); + result.Append (HighlightSemantically (FilterEntityName (method.Name), colorStyle.UserMethodDeclaration)); } if (method.TypeArguments.Count > 0) { result.Append ("<"); for (int i = 0; i < method.TypeArguments.Count; i++) { if (i > 0) result.Append (", "); - result.Append (HighlightSemantically (GetTypeReferenceString (method.TypeArguments[i], false), colorStyle.UserTypes)); + result.Append (HighlightSemantically (GetTypeReferenceString (method.TypeArguments [i], false), colorStyle.UserTypes)); } result.Append (">"); } else { @@ -723,7 +725,7 @@ namespace MonoDevelop.CSharp result.Append ('('); IList<IParameter> parameters = method.Parameters; - AppendParameterList (result, parameters, formattingOptions.SpaceBeforeMethodDeclarationParameterComma, formattingOptions.SpaceAfterMethodDeclarationParameterComma); + AppendParameterList (result, parameters, formattingOptions.SpaceBeforeMethodDeclarationParameterComma, formattingOptions.SpaceAfterMethodDeclarationParameterComma); result.Append (')'); return result.ToString (); } @@ -737,7 +739,7 @@ namespace MonoDevelop.CSharp var result = new StringBuilder (); AppendModifiers (result, method); - result.Append (CSharpAmbience.FilterName (method.DeclaringType.Name)); + result.Append (FilterEntityName (method.DeclaringType.Name)); if (formattingOptions.SpaceBeforeConstructorDeclarationParentheses) result.Append (" "); @@ -768,13 +770,13 @@ namespace MonoDevelop.CSharp } result.Append ("~"); - result.Append (CSharpAmbience.FilterName (method.DeclaringType.Name)); + result.Append (FilterEntityName (method.DeclaringType.Name)); if (formattingOptions.SpaceBeforeConstructorDeclarationParentheses) result.Append (" "); result.Append ('('); - AppendParameterList (result, method.Parameters, formattingOptions.SpaceBeforeConstructorDeclarationParameterComma, formattingOptions.SpaceAfterConstructorDeclarationParameterComma); + AppendParameterList (result, method.Parameters, formattingOptions.SpaceBeforeConstructorDeclarationParameterComma, formattingOptions.SpaceAfterConstructorDeclarationParameterComma); result.Append (')'); return result.ToString (); } @@ -805,7 +807,7 @@ namespace MonoDevelop.CSharp if (property.SymbolKind == SymbolKind.Indexer) { result.Append (Highlight ("this", colorStyle.KeywordAccessors)); } else { - result.Append (HighlightSemantically (CSharpAmbience.FilterName (property.Name), colorStyle.UserPropertyDeclaration)); + result.Append (HighlightSemantically (FilterEntityName (property.Name), colorStyle.UserPropertyDeclaration)); } if (property.Parameters.Count > 0) { @@ -826,7 +828,7 @@ namespace MonoDevelop.CSharp result.Append (Highlight (" get", colorStyle.KeywordProperty) + ";"); } - if (property.CanSet && IsAccessibleOrHasSourceCode(property.Setter)) { + if (property.CanSet && IsAccessibleOrHasSourceCode (property.Setter)) { if (property.Setter.Accessibility != property.Accessibility) { result.Append (" "); AppendAccessibility (result, property.Setter); @@ -856,6 +858,7 @@ namespace MonoDevelop.CSharp return result; } + public TooltipInformation GetKeywordTooltip (AstNode node) { return GetKeywordTooltip (node.ToString (), node); @@ -870,24 +873,24 @@ namespace MonoDevelop.CSharp var keywordSign = "<span foreground=\"" + colorString + "\">" + " (keyword)</span>"; - switch (keyword){ + switch (keyword) { case "abstract": result.SignatureMarkup = Highlight ("abstract", colorStyle.KeywordModifiers) + keywordSign; result.SummaryMarkup = "The " + Highlight ("abstract", colorStyle.KeywordModifiers) + " modifier can be used with classes, methods, properties, indexers, and events."; break; case "add": - result.SignatureMarkup = Highlight ("add", colorStyle.KeywordContext) + keywordSign;
- result.AddCategory("Form", "[modifiers] " + Highlight("add", colorStyle.KeywordContext) + " { accessor-body }");
- result.SummaryMarkup = "The " + Highlight("add", colorStyle.KeywordContext) + " keyword is used to define a custom accessor for when an event is subscribed to. If supplied, a remove accessor must also be supplied."; + result.SignatureMarkup = Highlight ("add", colorStyle.KeywordContext) + keywordSign; + result.AddCategory ("Form", "[modifiers] " + Highlight ("add", colorStyle.KeywordContext) + " { accessor-body }"); + result.SummaryMarkup = "The " + Highlight ("add", colorStyle.KeywordContext) + " keyword is used to define a custom accessor for when an event is subscribed to. If supplied, a remove accessor must also be supplied."; break; case "ascending": - result.SignatureMarkup = Highlight ("ascending", colorStyle.KeywordContext) + keywordSign;
- result.AddCategory("Query Form", Highlight("orderby", colorStyle.KeywordContext) + " ordering-statement " + Highlight("ascending", colorStyle.KeywordContext));
- result.SummaryMarkup = "The " + Highlight("ascending", colorStyle.KeywordContext) + " keyword is used to set the sorting order from smallest to largest in a query expression. This is the default behaviour."; + result.SignatureMarkup = Highlight ("ascending", colorStyle.KeywordContext) + keywordSign; + result.AddCategory ("Query Form", Highlight ("orderby", colorStyle.KeywordContext) + " ordering-statement " + Highlight ("ascending", colorStyle.KeywordContext)); + result.SummaryMarkup = "The " + Highlight ("ascending", colorStyle.KeywordContext) + " keyword is used to set the sorting order from smallest to largest in a query expression. This is the default behaviour."; break; case "async": - result.SignatureMarkup = Highlight ("async", colorStyle.KeywordContext) + keywordSign;
- result.SummaryMarkup = "The " + Highlight("async", colorStyle.KeywordContext) + " modifier is used to specify that a class method, anonymous method, or lambda expression is asynchronous."; + result.SignatureMarkup = Highlight ("async", colorStyle.KeywordContext) + keywordSign; + result.SummaryMarkup = "The " + Highlight ("async", colorStyle.KeywordContext) + " modifier is used to specify that a class method, anonymous method, or lambda expression is asynchronous."; break; case "as": result.SignatureMarkup = Highlight ("as", colorStyle.KeywordOperators) + keywordSign; @@ -895,9 +898,9 @@ namespace MonoDevelop.CSharp result.SummaryMarkup = "The " + Highlight ("as", colorStyle.KeywordOperators) + " operator is used to perform conversions between compatible types. "; break; case "await": - result.SignatureMarkup = Highlight ("await", colorStyle.KeywordContext) + keywordSign;
- result.SummaryMarkup = "The " + Highlight("await", colorStyle.KeywordContext) + " operator is used to specify that an " + Highlight("async", colorStyle.KeywordContext) + " method is to have its execution suspended until the " + Highlight("await", colorStyle.KeywordContext) +
- " task has completed."; + result.SignatureMarkup = Highlight ("await", colorStyle.KeywordContext) + keywordSign; + result.SummaryMarkup = "The " + Highlight ("await", colorStyle.KeywordContext) + " operator is used to specify that an " + Highlight ("async", colorStyle.KeywordContext) + " method is to have its execution suspended until the " + Highlight ("await", colorStyle.KeywordContext) + + " task has completed."; break; case "base": result.SignatureMarkup = Highlight ("base", colorStyle.KeywordAccessors) + keywordSign; @@ -911,24 +914,24 @@ namespace MonoDevelop.CSharp case "case": result.SignatureMarkup = Highlight ("case", colorStyle.KeywordSelection) + keywordSign; result.AddCategory ("Form", Highlight ("case", colorStyle.KeywordSelection) + " constant-expression:" + Environment.NewLine + - " statement" + Environment.NewLine + - " jump-statement"); + " statement" + Environment.NewLine + + " jump-statement"); result.SummaryMarkup = ""; break; case "catch": result.SignatureMarkup = Highlight ("catch", colorStyle.KeywordException) + keywordSign; result.AddCategory ("Form", Highlight ("try", colorStyle.KeywordException) + " try-block" + Environment.NewLine + - " " + Highlight ("catch", colorStyle.KeywordException) + " (exception-declaration-1) catch-block-1" + Environment.NewLine + - " " + Highlight ("catch", colorStyle.KeywordException) + " (exception-declaration-2) catch-block-2" + Environment.NewLine + - " ..." + Environment.NewLine + - Highlight ("try", colorStyle.KeywordException) + " try-block " + Highlight ("catch", colorStyle.KeywordException) + " catch-block"); + " " + Highlight ("catch", colorStyle.KeywordException) + " (exception-declaration-1) catch-block-1" + Environment.NewLine + + " " + Highlight ("catch", colorStyle.KeywordException) + " (exception-declaration-2) catch-block-2" + Environment.NewLine + + " ..." + Environment.NewLine + + Highlight ("try", colorStyle.KeywordException) + " try-block " + Highlight ("catch", colorStyle.KeywordException) + " catch-block"); result.SummaryMarkup = ""; break; case "checked": result.SignatureMarkup = Highlight ("checked", colorStyle.KeywordOther) + keywordSign; result.AddCategory ("Form", Highlight ("checked", colorStyle.KeywordOther) + " block" + Environment.NewLine + - "or" + Environment.NewLine + - Highlight ("checked", colorStyle.KeywordOther) + " (expression)"); + "or" + Environment.NewLine + + Highlight ("checked", colorStyle.KeywordOther) + " (expression)"); result.SummaryMarkup = "The " + Highlight ("checked", colorStyle.KeywordOther) + " keyword is used to control the overflow-checking context for integral-type arithmetic operations and conversions. It can be used as an operator or a statement."; break; case "class": @@ -952,32 +955,32 @@ namespace MonoDevelop.CSharp if (hintNode != null) { if (hintNode.Parent is DefaultValueExpression) { result.AddCategory ("Form", - Highlight ("default", colorStyle.KeywordSelection) + " (Type)"); + Highlight ("default", colorStyle.KeywordSelection) + " (Type)"); break; } else if (hintNode.Parent is CaseLabel) { result.AddCategory ("Form", - Highlight ("switch", colorStyle.KeywordSelection) + " (expression) { "+ Environment.NewLine + - " " + Highlight ("case", colorStyle.KeywordSelection) + " constant-expression:" + Environment.NewLine + - " statement"+ Environment.NewLine + - " jump-statement" + Environment.NewLine + - " [" + Highlight ("default", colorStyle.KeywordSelection) + ":" + Environment.NewLine + - " statement" + Environment.NewLine + - " jump-statement]" + Environment.NewLine + - "}"); + Highlight ("switch", colorStyle.KeywordSelection) + " (expression) { " + Environment.NewLine + + " " + Highlight ("case", colorStyle.KeywordSelection) + " constant-expression:" + Environment.NewLine + + " statement" + Environment.NewLine + + " jump-statement" + Environment.NewLine + + " [" + Highlight ("default", colorStyle.KeywordSelection) + ":" + Environment.NewLine + + " statement" + Environment.NewLine + + " jump-statement]" + Environment.NewLine + + "}"); break; } } result.AddCategory ("Form", - Highlight ("default", colorStyle.KeywordSelection) + " (Type)" + Environment.NewLine + Environment.NewLine + - "or" + Environment.NewLine + Environment.NewLine + - Highlight ("switch", colorStyle.KeywordSelection) + " (expression) { "+ Environment.NewLine + - " " + Highlight ("case", colorStyle.KeywordSelection) + " constant-expression:" + Environment.NewLine + - " statement"+ Environment.NewLine + - " jump-statement" + Environment.NewLine + - " [" + Highlight ("default", colorStyle.KeywordSelection) + ":" + Environment.NewLine + - " statement" + Environment.NewLine + - " jump-statement]" + Environment.NewLine + - "}"); + Highlight ("default", colorStyle.KeywordSelection) + " (Type)" + Environment.NewLine + Environment.NewLine + + "or" + Environment.NewLine + Environment.NewLine + + Highlight ("switch", colorStyle.KeywordSelection) + " (expression) { " + Environment.NewLine + + " " + Highlight ("case", colorStyle.KeywordSelection) + " constant-expression:" + Environment.NewLine + + " statement" + Environment.NewLine + + " jump-statement" + Environment.NewLine + + " [" + Highlight ("default", colorStyle.KeywordSelection) + ":" + Environment.NewLine + + " statement" + Environment.NewLine + + " jump-statement]" + Environment.NewLine + + "}"); break; case "delegate": result.SignatureMarkup = Highlight ("delegate", colorStyle.KeywordDeclaration) + keywordSign; @@ -985,13 +988,13 @@ namespace MonoDevelop.CSharp result.SummaryMarkup = "A " + Highlight ("delegate", colorStyle.KeywordDeclaration) + " declaration defines a reference type that can be used to encapsulate a method with a specific signature."; break; case "dynamic": - result.SignatureMarkup = Highlight ("dynamic", colorStyle.KeywordContext) + keywordSign;
- result.SummaryMarkup = "The " + Highlight("dynamic", colorStyle.KeywordContext) + " type allows for an object to bypass compile-time type checking and resolve type checking during run-time."; + result.SignatureMarkup = Highlight ("dynamic", colorStyle.KeywordContext) + keywordSign; + result.SummaryMarkup = "The " + Highlight ("dynamic", colorStyle.KeywordContext) + " type allows for an object to bypass compile-time type checking and resolve type checking during run-time."; break; case "descending": - result.SignatureMarkup = Highlight ("descending", colorStyle.KeywordContext) + keywordSign;
- result.AddCategory("Query Form", Highlight("orderby", colorStyle.KeywordContext) + " ordering-statement " + Highlight("descending", colorStyle.KeywordContext));
- result.SummaryMarkup = "The " + Highlight("descending", colorStyle.KeywordContext) + " keyword is used to set the sorting order from largest to smallest in a query expression."; + result.SignatureMarkup = Highlight ("descending", colorStyle.KeywordContext) + keywordSign; + result.AddCategory ("Query Form", Highlight ("orderby", colorStyle.KeywordContext) + " ordering-statement " + Highlight ("descending", colorStyle.KeywordContext)); + result.SummaryMarkup = "The " + Highlight ("descending", colorStyle.KeywordContext) + " keyword is used to set the sorting order from largest to smallest in a query expression."; break; case "do": result.SignatureMarkup = Highlight ("do", colorStyle.KeywordIteration) + keywordSign; @@ -1001,9 +1004,9 @@ namespace MonoDevelop.CSharp case "else": result.SignatureMarkup = Highlight ("else", colorStyle.KeywordSelection) + keywordSign; result.AddCategory ("Form", Highlight ("if", colorStyle.KeywordSelection) + " (expression)" + Environment.NewLine + - " statement1" + Environment.NewLine + - " [" + Highlight ("else", colorStyle.KeywordSelection) + Environment.NewLine + - " statement2]"); + " statement1" + Environment.NewLine + + " [" + Highlight ("else", colorStyle.KeywordSelection) + Environment.NewLine + + " statement2]"); result.SummaryMarkup = ""; break; case "enum": @@ -1014,7 +1017,7 @@ namespace MonoDevelop.CSharp case "event": result.SignatureMarkup = Highlight ("event", colorStyle.KeywordModifiers) + keywordSign; result.AddCategory ("Form", "[attributes] [modifiers] " + Highlight ("event", colorStyle.KeywordModifiers) + " type declarator;" + Environment.NewLine + - "[attributes] [modifiers] " + Highlight ("event", colorStyle.KeywordModifiers) + " type member-name {accessor-declarations};"); + "[attributes] [modifiers] " + Highlight ("event", colorStyle.KeywordModifiers) + " type member-name {accessor-declarations};"); result.SummaryMarkup = "Specifies an event."; break; case "explicit": @@ -1046,48 +1049,48 @@ namespace MonoDevelop.CSharp result.SummaryMarkup = "The " + Highlight ("foreach", colorStyle.KeywordIteration) + " statement repeats a group of embedded statements for each element in an array or an object collection. "; break; case "from": - result.SignatureMarkup = Highlight ("from", colorStyle.KeywordContext) + keywordSign;
- result.AddCategory("Form", Highlight("from", colorStyle.KeywordContext) + " range-variable " + Highlight("in", colorStyle.KeywordIteration)
- + " data-source [query clauses] " + Highlight("select", colorStyle.KeywordContext) + " product-expression");
- result.SummaryMarkup = "The " + Highlight("from", colorStyle.KeywordContext) + " keyword marks the beginning of a query expression and defines the data source and local variable to represent the elements in the sequence."; + result.SignatureMarkup = Highlight ("from", colorStyle.KeywordContext) + keywordSign; + result.AddCategory ("Form", Highlight ("from", colorStyle.KeywordContext) + " range-variable " + Highlight ("in", colorStyle.KeywordIteration) + + " data-source [query clauses] " + Highlight ("select", colorStyle.KeywordContext) + " product-expression"); + result.SummaryMarkup = "The " + Highlight ("from", colorStyle.KeywordContext) + " keyword marks the beginning of a query expression and defines the data source and local variable to represent the elements in the sequence."; break; case "get": - result.SignatureMarkup = Highlight ("get", colorStyle.KeywordContext) + keywordSign;
- result.AddCategory("Form", "[modifiers] " + Highlight("get", colorStyle.KeywordContext) + " [ { accessor-body } ]");
- result.SummaryMarkup = "The " + Highlight("get", colorStyle.KeywordContext) + " keyword is used to define an accessor method to retrieve the value of the property or indexer element."; + result.SignatureMarkup = Highlight ("get", colorStyle.KeywordContext) + keywordSign; + result.AddCategory ("Form", "[modifiers] " + Highlight ("get", colorStyle.KeywordContext) + " [ { accessor-body } ]"); + result.SummaryMarkup = "The " + Highlight ("get", colorStyle.KeywordContext) + " keyword is used to define an accessor method to retrieve the value of the property or indexer element."; break; case "global": - result.SignatureMarkup = Highlight ("global", colorStyle.KeywordContext) + keywordSign;
- result.AddCategory("Form", Highlight("global", colorStyle.KeywordContext) + " :: type");
- result.SummaryMarkup = "The " + Highlight("global", colorStyle.KeywordContext) + " keyword is used to specify a type is within the global namespace."; + result.SignatureMarkup = Highlight ("global", colorStyle.KeywordContext) + keywordSign; + result.AddCategory ("Form", Highlight ("global", colorStyle.KeywordContext) + " :: type"); + result.SummaryMarkup = "The " + Highlight ("global", colorStyle.KeywordContext) + " keyword is used to specify a type is within the global namespace."; break; case "goto": result.SignatureMarkup = Highlight ("goto", colorStyle.KeywordJump) + keywordSign; result.AddCategory ("Form", Highlight ("goto", colorStyle.KeywordJump) + " identifier;" + Environment.NewLine + - Highlight ("goto", colorStyle.KeywordJump) + " " + Highlight ("case", colorStyle.KeywordSelection) + " constant-expression;" + Environment.NewLine + - Highlight ("goto", colorStyle.KeywordJump) + " " + Highlight ("default", colorStyle.KeywordSelection) + ";"); + Highlight ("goto", colorStyle.KeywordJump) + " " + Highlight ("case", colorStyle.KeywordSelection) + " constant-expression;" + Environment.NewLine + + Highlight ("goto", colorStyle.KeywordJump) + " " + Highlight ("default", colorStyle.KeywordSelection) + ";"); result.SummaryMarkup = "The " + Highlight ("goto", colorStyle.KeywordJump) + " statement transfers the program control directly to a labeled statement. "; break; case "group": - result.SignatureMarkup = Highlight ("group", colorStyle.KeywordContext) + keywordSign;
- result.AddCategory("Query Form", Highlight("group", colorStyle.KeywordContext) + " range-variable " + Highlight("by", colorStyle.KeywordContext) + "key-value"
- +Environment.NewLine + Environment.NewLine + "or" + Environment.NewLine + Environment.NewLine +
- Highlight("group", colorStyle.KeywordContext) + " range-variable " + Highlight("by", colorStyle.KeywordContext) + " key-value " + Highlight("into", colorStyle.KeywordContext) + " group-name ");
- result.SummaryMarkup = "The " + Highlight("group", colorStyle.KeywordContext) + " keyword groups elements together from a query which match the key value and stores the result in an " - + Highlight ("IGrouping<TKey, TElement>", colorStyle.KeywordTypes) + ". It can also be stored in a group for further use in the query with 'into'."; + result.SignatureMarkup = Highlight ("group", colorStyle.KeywordContext) + keywordSign; + result.AddCategory ("Query Form", Highlight ("group", colorStyle.KeywordContext) + " range-variable " + Highlight ("by", colorStyle.KeywordContext) + "key-value" + + Environment.NewLine + Environment.NewLine + "or" + Environment.NewLine + Environment.NewLine + + Highlight ("group", colorStyle.KeywordContext) + " range-variable " + Highlight ("by", colorStyle.KeywordContext) + " key-value " + Highlight ("into", colorStyle.KeywordContext) + " group-name "); + result.SummaryMarkup = "The " + Highlight ("group", colorStyle.KeywordContext) + " keyword groups elements together from a query which match the key value and stores the result in an " + + Highlight ("IGrouping<TKey, TElement>", colorStyle.KeywordTypes) + ". It can also be stored in a group for further use in the query with 'into'."; break; case "if": result.SignatureMarkup = Highlight ("if", colorStyle.KeywordSelection) + keywordSign; result.AddCategory ("Form", Highlight ("if", colorStyle.KeywordSelection) + " (expression)" + Environment.NewLine + " statement1" + Environment.NewLine + " [" + Highlight ("else", colorStyle.KeywordSelection) + Environment.NewLine + - " statement2]"); + " statement2]"); result.SummaryMarkup = "The " + Highlight ("if", colorStyle.KeywordSelection) + " statement selects a statement for execution based on the value of a Boolean expression. "; break; case "into": result.SignatureMarkup = Highlight ("into", colorStyle.KeywordContext) + keywordSign; - result.AddCategory("Query Form", Highlight("group", colorStyle.KeywordContext) + " range-variable " + Highlight("by", colorStyle.KeywordContext) + " key-value " + Highlight("into", colorStyle.KeywordContext) + " group-name ");
- result.SummaryMarkup = "The " + Highlight("into", colorStyle.KeywordContext) + " keyword stores the result of a group statement for further use in the query."; + result.AddCategory ("Query Form", Highlight ("group", colorStyle.KeywordContext) + " range-variable " + Highlight ("by", colorStyle.KeywordContext) + " key-value " + Highlight ("into", colorStyle.KeywordContext) + " group-name "); + result.SummaryMarkup = "The " + Highlight ("into", colorStyle.KeywordContext) + " keyword stores the result of a group statement for further use in the query."; break; case "implicit": result.SignatureMarkup = Highlight ("implicit", colorStyle.KeywordOperatorDeclaration) + keywordSign; @@ -1098,26 +1101,26 @@ namespace MonoDevelop.CSharp if (hintNode != null) { if (hintNode.Parent is ForeachStatement) { result.AddCategory ("Form", - Highlight ("foreach", colorStyle.KeywordIteration) + " (type identifier " + Highlight ("in", colorStyle.KeywordIteration) + " expression) statement"); + Highlight ("foreach", colorStyle.KeywordIteration) + " (type identifier " + Highlight ("in", colorStyle.KeywordIteration) + " expression) statement"); break; } if (hintNode.Parent is QueryFromClause) { result.AddCategory ("Form", - Highlight ("from", colorStyle.KeywordContext) + " range-variable " + Highlight ("in", colorStyle.KeywordIteration) + " data-source [query clauses] " + Highlight ("select", colorStyle.KeywordContext) + " product-expression"); + Highlight ("from", colorStyle.KeywordContext) + " range-variable " + Highlight ("in", colorStyle.KeywordIteration) + " data-source [query clauses] " + Highlight ("select", colorStyle.KeywordContext) + " product-expression"); break; } if (hintNode.Parent is TypeParameterDeclaration) { result.AddCategory ("Form", - Highlight ("interface", colorStyle.KeywordDeclaration) + " IMyInterface<" + Highlight ("in", colorStyle.KeywordIteration) + " T> {}"); + Highlight ("interface", colorStyle.KeywordDeclaration) + " IMyInterface<" + Highlight ("in", colorStyle.KeywordIteration) + " T> {}"); break; } } - result.AddCategory ("Form", Highlight ("foreach", colorStyle.KeywordIteration) + " (type identifier " + Highlight ("in", colorStyle.KeywordIteration) + " expression) statement"+ Environment.NewLine + Environment.NewLine + - "or" + Environment.NewLine + Environment.NewLine + - Highlight ("from", colorStyle.KeywordContext) + " range-variable " + Highlight ("in", colorStyle.KeywordIteration) + " data-source [query clauses] " + Highlight ("select", colorStyle.KeywordContext) + " product-expression" + Environment.NewLine + Environment.NewLine + - "or" + Environment.NewLine + Environment.NewLine + - Highlight ("interface", colorStyle.KeywordDeclaration) + " IMyInterface<" + Highlight ("in", colorStyle.KeywordIteration) + " T> {}" - ); + result.AddCategory ("Form", Highlight ("foreach", colorStyle.KeywordIteration) + " (type identifier " + Highlight ("in", colorStyle.KeywordIteration) + " expression) statement" + Environment.NewLine + Environment.NewLine + + "or" + Environment.NewLine + Environment.NewLine + + Highlight ("from", colorStyle.KeywordContext) + " range-variable " + Highlight ("in", colorStyle.KeywordIteration) + " data-source [query clauses] " + Highlight ("select", colorStyle.KeywordContext) + " product-expression" + Environment.NewLine + Environment.NewLine + + "or" + Environment.NewLine + Environment.NewLine + + Highlight ("interface", colorStyle.KeywordDeclaration) + " IMyInterface<" + Highlight ("in", colorStyle.KeywordIteration) + " T> {}" + ); break; case "interface": result.SignatureMarkup = Highlight ("interface", colorStyle.KeywordDeclaration) + keywordSign; @@ -1134,15 +1137,15 @@ namespace MonoDevelop.CSharp result.SummaryMarkup = "The " + Highlight ("is", colorStyle.KeywordOperators) + " operator is used to check whether the run-time type of an object is compatible with a given type."; break; case "join": - result.SignatureMarkup = Highlight ("join", colorStyle.KeywordContext) + keywordSign;
- result.AddCategory("Query Form", Highlight("join", colorStyle.KeywordContext) + " range-variable2 " + Highlight("in", colorStyle.KeywordContext) + " range2 " + Highlight("on", colorStyle.KeywordContext)
- + " statement1 " + Highlight("equals", colorStyle.KeywordContext) + " statement2 [ " + Highlight("into", colorStyle.KeywordContext) + " group-name ]");
- result.SummaryMarkup = "The " + Highlight("join", colorStyle.KeywordContext) + " clause produces a new sequence of elements from two source sequences on a given equality condition."; + result.SignatureMarkup = Highlight ("join", colorStyle.KeywordContext) + keywordSign; + result.AddCategory ("Query Form", Highlight ("join", colorStyle.KeywordContext) + " range-variable2 " + Highlight ("in", colorStyle.KeywordContext) + " range2 " + Highlight ("on", colorStyle.KeywordContext) + + " statement1 " + Highlight ("equals", colorStyle.KeywordContext) + " statement2 [ " + Highlight ("into", colorStyle.KeywordContext) + " group-name ]"); + result.SummaryMarkup = "The " + Highlight ("join", colorStyle.KeywordContext) + " clause produces a new sequence of elements from two source sequences on a given equality condition."; break; case "let": - result.SignatureMarkup = Highlight ("let", colorStyle.KeywordContext) + keywordSign;
- result.AddCategory("Query Form", Highlight("let", colorStyle.KeywordContext) + " range-variable = expression");
- result.SummaryMarkup = "The " + Highlight("let", colorStyle.KeywordContext) + " clause allows for a sub-expression to have its value stored in a new range variable for use later in the query."; + result.SignatureMarkup = Highlight ("let", colorStyle.KeywordContext) + keywordSign; + result.AddCategory ("Query Form", Highlight ("let", colorStyle.KeywordContext) + " range-variable = expression"); + result.SummaryMarkup = "The " + Highlight ("let", colorStyle.KeywordContext) + " clause allows for a sub-expression to have its value stored in a new range variable for use later in the query."; break; case "lock": result.SignatureMarkup = Highlight ("lock", colorStyle.KeywordOther) + keywordSign; @@ -1153,7 +1156,7 @@ namespace MonoDevelop.CSharp result.SignatureMarkup = Highlight ("namespace", colorStyle.KeywordNamespace) + keywordSign; result.AddCategory ("Form", Highlight ("namespace", colorStyle.KeywordNamespace) + " name[.name1] ...] {" + Environment.NewLine + "type-declarations" + Environment.NewLine + - " }"); + " }"); result.SummaryMarkup = "The " + Highlight ("namespace", colorStyle.KeywordNamespace) + " keyword is used to declare a scope. "; break; case "new": @@ -1167,40 +1170,41 @@ namespace MonoDevelop.CSharp case "operator": result.SignatureMarkup = Highlight ("operator", colorStyle.KeywordOperatorDeclaration) + keywordSign; result.AddCategory ("Form", Highlight ("public static ", colorStyle.KeywordModifiers) + "result-type " + Highlight ("operator", colorStyle.KeywordOperatorDeclaration) + " unary-operator ( op-type operand )" + Environment.NewLine + - Highlight ("public static ", colorStyle.KeywordModifiers) + "result-type " + Highlight ("operator", colorStyle.KeywordOperatorDeclaration) + " binary-operator (" + Environment.NewLine + + Highlight ("public static ", colorStyle.KeywordModifiers) + "result-type " + Highlight ("operator", colorStyle.KeywordOperatorDeclaration) + " binary-operator (" + Environment.NewLine + "op-type operand," + Environment.NewLine + "op-type2 operand2" + Environment.NewLine + " )" + Environment.NewLine + Highlight ("public static ", colorStyle.KeywordModifiers) + Highlight ("implicit operator", colorStyle.KeywordOperatorDeclaration) + " conv-type-out ( conv-type-in operand )" + Environment.NewLine + - Highlight ("public static ", colorStyle.KeywordModifiers) + Highlight ("explicit operator", colorStyle.KeywordOperatorDeclaration) + " conv-type-out ( conv-type-in operand )"); + Highlight ("public static ", colorStyle.KeywordModifiers) + Highlight ("explicit operator", colorStyle.KeywordOperatorDeclaration) + " conv-type-out ( conv-type-in operand )" + ); result.SummaryMarkup = "The " + Highlight ("operator", colorStyle.KeywordOperatorDeclaration) + " keyword is used to declare an operator in a class or struct declaration."; break; case "orderby": - result.SignatureMarkup = Highlight ("orderby", colorStyle.KeywordContext) + keywordSign;
- result.AddCategory("Query Form", Highlight("orderby", colorStyle.KeywordContext) + " order-key1 [ " + Highlight("ascending", colorStyle.KeywordContext) + "|" + Highlight("descending", colorStyle.KeywordContext) + " , [order-key2, ...]");
- result.SummaryMarkup = "The " + Highlight("orderby", colorStyle.KeywordContext) + " clause specifies for the returned sequence to be sorted on a given element in either ascending or descending order."; + result.SignatureMarkup = Highlight ("orderby", colorStyle.KeywordContext) + keywordSign; + result.AddCategory ("Query Form", Highlight ("orderby", colorStyle.KeywordContext) + " order-key1 [ " + Highlight ("ascending", colorStyle.KeywordContext) + "|" + Highlight ("descending", colorStyle.KeywordContext) + " , [order-key2, ...]"); + result.SummaryMarkup = "The " + Highlight ("orderby", colorStyle.KeywordContext) + " clause specifies for the returned sequence to be sorted on a given element in either ascending or descending order."; break; case "out": result.SignatureMarkup = Highlight ("out", colorStyle.KeywordParameter) + keywordSign; if (hintNode != null) { if (hintNode.Parent is TypeParameterDeclaration) { result.AddCategory ("Form", - Highlight ("interface", colorStyle.KeywordDeclaration) + " IMyInterface<" + Highlight ("out", colorStyle.KeywordParameter) + " T> {}"); + Highlight ("interface", colorStyle.KeywordDeclaration) + " IMyInterface<" + Highlight ("out", colorStyle.KeywordParameter) + " T> {}"); break; } if (hintNode.Parent is ParameterDeclaration) { result.AddCategory ("Form", - Highlight ("out", colorStyle.KeywordParameter) + " parameter-name"); + Highlight ("out", colorStyle.KeywordParameter) + " parameter-name"); result.SummaryMarkup = "The " + Highlight ("out", colorStyle.KeywordParameter) + " method parameter keyword on a method parameter causes a method to refer to the same variable that was passed into the method."; break; } } result.AddCategory ("Form", - Highlight ("out", colorStyle.KeywordParameter) + " parameter-name" + Environment.NewLine + Environment.NewLine + - "or" + Environment.NewLine + Environment.NewLine + - Highlight ("interface", colorStyle.KeywordDeclaration) + " IMyInterface<" + Highlight ("out", colorStyle.KeywordParameter) + " T> {}" - ); + Highlight ("out", colorStyle.KeywordParameter) + " parameter-name" + Environment.NewLine + Environment.NewLine + + "or" + Environment.NewLine + Environment.NewLine + + Highlight ("interface", colorStyle.KeywordDeclaration) + " IMyInterface<" + Highlight ("out", colorStyle.KeywordParameter) + " T> {}" + ); break; case "override": result.SignatureMarkup = Highlight ("override", colorStyle.KeywordModifiers) + keywordSign; @@ -1211,24 +1215,19 @@ namespace MonoDevelop.CSharp result.SummaryMarkup = "The " + Highlight ("params", colorStyle.KeywordParameter) + " keyword lets you specify a method parameter that takes an argument where the number of arguments is variable."; break; case "partial": - result.SignatureMarkup = Highlight ("partial", colorStyle.KeywordContext) + keywordSign;
- if (hintNode != null)
- {
- if (hintNode.Parent is TypeDeclaration)
- {
- result.AddCategory("Form", "[modifiers] " + Highlight("partial", colorStyle.KeywordContext) + " type-declaration");
- result.SummaryMarkup = "The " + Highlight("partial", colorStyle.KeywordContext) + " keyword on a type declaration allows for the definition to be split into multiple files.";
- break;
- }
- else if(hintNode.Parent is MethodDeclaration)
- {
- result.AddCategory("Form", Highlight("partial", colorStyle.KeywordContext) + " method-declaration");
- result.SummaryMarkup = "The " + Highlight("partial", colorStyle.KeywordContext) + " keyword on a method declaration allows for the implementation of a method to be defined in another part of the partial class.";
- }
- }
- else
- result.AddCategory("Form", "[modifiers] " + Highlight("partial", colorStyle.KeywordContext) + " type-declaration" + Environment.NewLine + Environment.NewLine + "or" + Environment.NewLine + Environment.NewLine +
- Highlight("partial", colorStyle.KeywordContext) + " method-declaration"); + result.SignatureMarkup = Highlight ("partial", colorStyle.KeywordContext) + keywordSign; + if (hintNode != null) { + if (hintNode.Parent is TypeDeclaration) { + result.AddCategory ("Form", "[modifiers] " + Highlight ("partial", colorStyle.KeywordContext) + " type-declaration"); + result.SummaryMarkup = "The " + Highlight ("partial", colorStyle.KeywordContext) + " keyword on a type declaration allows for the definition to be split into multiple files."; + break; + } else if (hintNode.Parent is MethodDeclaration) { + result.AddCategory ("Form", Highlight ("partial", colorStyle.KeywordContext) + " method-declaration"); + result.SummaryMarkup = "The " + Highlight ("partial", colorStyle.KeywordContext) + " keyword on a method declaration allows for the implementation of a method to be defined in another part of the partial class."; + } + } else + result.AddCategory ("Form", "[modifiers] " + Highlight ("partial", colorStyle.KeywordContext) + " type-declaration" + Environment.NewLine + Environment.NewLine + "or" + Environment.NewLine + Environment.NewLine + + Highlight ("partial", colorStyle.KeywordContext) + " method-declaration"); break; case "private": result.SignatureMarkup = Highlight ("private", colorStyle.KeywordModifiers) + keywordSign; @@ -1251,9 +1250,9 @@ namespace MonoDevelop.CSharp result.SummaryMarkup = "The " + Highlight ("ref", colorStyle.KeywordParameter) + " method parameter keyword on a method parameter causes a method to refer to the same variable that was passed into the method."; break; case "remove": - result.SignatureMarkup = Highlight ("remove", colorStyle.KeywordContext) + keywordSign;
- result.AddCategory("Form", "[modifiers] " + Highlight("remove", colorStyle.KeywordContext) + " { accessor-body }");
- result.SummaryMarkup = "The " + Highlight("remove", colorStyle.KeywordContext) + " keyword is used to define a custom accessor for when an event is unsubscribed from. If supplied, an add accessor must also be supplied."; + result.SignatureMarkup = Highlight ("remove", colorStyle.KeywordContext) + keywordSign; + result.AddCategory ("Form", "[modifiers] " + Highlight ("remove", colorStyle.KeywordContext) + " { accessor-body }"); + result.SummaryMarkup = "The " + Highlight ("remove", colorStyle.KeywordContext) + " keyword is used to define a custom accessor for when an event is unsubscribed from. If supplied, an add accessor must also be supplied."; break; case "return": result.SignatureMarkup = Highlight ("return", colorStyle.KeywordJump) + keywordSign; @@ -1261,18 +1260,18 @@ namespace MonoDevelop.CSharp result.SummaryMarkup = "The " + Highlight ("return", colorStyle.KeywordJump) + " statement terminates execution of the method in which it appears and returns control to the calling method."; break; case "select": - result.SignatureMarkup = Highlight ("select", colorStyle.KeywordContext) + keywordSign;
- result.AddCategory("Query Form", Highlight("select", colorStyle.KeywordContext) + " return-type");
- result.SummaryMarkup = "The " + Highlight("select", colorStyle.KeywordContext) + " clause specifies the type of value to return from the query."; + result.SignatureMarkup = Highlight ("select", colorStyle.KeywordContext) + keywordSign; + result.AddCategory ("Query Form", Highlight ("select", colorStyle.KeywordContext) + " return-type"); + result.SummaryMarkup = "The " + Highlight ("select", colorStyle.KeywordContext) + " clause specifies the type of value to return from the query."; break; case "sealed": result.SignatureMarkup = Highlight ("sealed", colorStyle.KeywordModifiers) + keywordSign; result.SummaryMarkup = "A sealed class cannot be inherited."; break; case "set": - result.SignatureMarkup = Highlight ("set", colorStyle.KeywordContext) + keywordSign;
- result.AddCategory("Form", "[modifiers] " + Highlight("set", colorStyle.KeywordContext) + " [ { accessor-body } ]");
- result.SummaryMarkup = "The " + Highlight("set", colorStyle.KeywordContext) + " keyword is used to define an accessor method to assign to the value of the property or indexer element."; + result.SignatureMarkup = Highlight ("set", colorStyle.KeywordContext) + keywordSign; + result.AddCategory ("Form", "[modifiers] " + Highlight ("set", colorStyle.KeywordContext) + " [ { accessor-body } ]"); + result.SummaryMarkup = "The " + Highlight ("set", colorStyle.KeywordContext) + " keyword is used to define an accessor method to assign to the value of the property or indexer element."; break; case "sizeof": result.SignatureMarkup = Highlight ("sizeof", colorStyle.KeywordOperators) + keywordSign; @@ -1295,15 +1294,15 @@ namespace MonoDevelop.CSharp break; case "switch": result.SignatureMarkup = Highlight ("switch", colorStyle.KeywordSelection) + keywordSign; - result.AddCategory ("Form", Highlight ("switch", colorStyle.KeywordSelection) + " (expression)" + Environment.NewLine + - " {" + Environment.NewLine + - " " + Highlight ("case", colorStyle.KeywordSelection) + " constant-expression:" + Environment.NewLine + - " statement" + Environment.NewLine + - " jump-statement" + Environment.NewLine + - " [" + Highlight ("default", colorStyle.KeywordSelection) + ":" + Environment.NewLine + - " statement" + Environment.NewLine + - " jump-statement]" + Environment.NewLine + - " }"); + result.AddCategory ("Form", Highlight ("switch", colorStyle.KeywordSelection) + " (expression)" + Environment.NewLine + + " {" + Environment.NewLine + + " " + Highlight ("case", colorStyle.KeywordSelection) + " constant-expression:" + Environment.NewLine + + " statement" + Environment.NewLine + + " jump-statement" + Environment.NewLine + + " [" + Highlight ("default", colorStyle.KeywordSelection) + ":" + Environment.NewLine + + " statement" + Environment.NewLine + + " jump-statement]" + Environment.NewLine + + " }"); result.SummaryMarkup = "The " + Highlight ("switch", colorStyle.KeywordSelection) + " statement is a control statement that handles multiple selections by passing control to one of the " + Highlight ("case", colorStyle.KeywordSelection) + " statements within its body."; break; case "this": @@ -1317,11 +1316,11 @@ namespace MonoDevelop.CSharp break; case "try": result.SignatureMarkup = Highlight ("try", colorStyle.KeywordException) + keywordSign; - result.AddCategory ("Form", Highlight ("try", colorStyle.KeywordException) + " try-block" + Environment.NewLine + - " " + Highlight ("catch", colorStyle.KeywordException) + " (exception-declaration-1) catch-block-1 " + Environment.NewLine + - " " + Highlight ("catch", colorStyle.KeywordException) + " (exception-declaration-2) catch-block-2 " + Environment.NewLine + - "..." + Environment.NewLine + - Highlight ("try", colorStyle.KeywordException) + " try-block " + Highlight ("catch", colorStyle.KeywordException) + " catch-block"); + result.AddCategory ("Form", Highlight ("try", colorStyle.KeywordException) + " try-block" + Environment.NewLine + + " " + Highlight ("catch", colorStyle.KeywordException) + " (exception-declaration-1) catch-block-1 " + Environment.NewLine + + " " + Highlight ("catch", colorStyle.KeywordException) + " (exception-declaration-2) catch-block-2 " + Environment.NewLine + + "..." + Environment.NewLine + + Highlight ("try", colorStyle.KeywordException) + " try-block " + Highlight ("catch", colorStyle.KeywordException) + " catch-block"); result.SummaryMarkup = "The try-catch statement consists of a " + Highlight ("try", colorStyle.KeywordException) + " block followed by one or more " + Highlight ("catch", colorStyle.KeywordException) + " clauses, which specify handlers for different exceptions."; break; case "typeof": @@ -1332,8 +1331,8 @@ namespace MonoDevelop.CSharp case "unchecked": result.SignatureMarkup = Highlight ("unchecked", colorStyle.KeywordOther) + keywordSign; result.AddCategory ("Form", Highlight ("unchecked", colorStyle.KeywordOther) + " block" + Environment.NewLine + - Highlight ("unchecked", colorStyle.KeywordOther) + " (expression)"); - result.SummaryMarkup = "The "+ Highlight ("unchecked", colorStyle.KeywordOther) + " keyword is used to control the overflow-checking context for integral-type arithmetic operations and conversions."; + Highlight ("unchecked", colorStyle.KeywordOther) + " (expression)"); + result.SummaryMarkup = "The " + Highlight ("unchecked", colorStyle.KeywordOther) + " keyword is used to control the overflow-checking context for integral-type arithmetic operations and conversions."; break; case "unsafe": result.SignatureMarkup = Highlight ("unsafe", colorStyle.KeywordOther) + keywordSign; @@ -1342,7 +1341,7 @@ namespace MonoDevelop.CSharp case "using": result.SignatureMarkup = Highlight ("using", colorStyle.KeywordNamespace) + keywordSign; result.AddCategory ("Form", Highlight ("using", colorStyle.KeywordNamespace) + " (expression | type identifier = initializer) statement" + Environment.NewLine + - Highlight ("using", colorStyle.KeywordNamespace) + " [alias = ]class_or_namespace;"); + Highlight ("using", colorStyle.KeywordNamespace) + " [alias = ]class_or_namespace;"); result.SummaryMarkup = "The " + Highlight ("using", colorStyle.KeywordNamespace) + " directive creates an alias for a namespace or imports types defined in other namespaces. The " + Highlight ("using", colorStyle.KeywordNamespace) + " statement defines a scope at the end of which an object will be disposed."; break; case "virtual": @@ -1358,35 +1357,30 @@ namespace MonoDevelop.CSharp result.SignatureMarkup = Highlight ("void", colorStyle.KeywordTypes) + keywordSign; break; case "where": - result.SignatureMarkup = Highlight ("where", colorStyle.KeywordContext) + keywordSign;
- if (hintNode != null)
- {
- if (hintNode.Parent is QueryWhereClause)
- {
- result.AddCategory("Query Form", Highlight("where", colorStyle.KeywordContext) + " condition");
- result.SummaryMarkup = "The " + Highlight("where", colorStyle.KeywordContext) + " clause specifies which elements from the data source to be returned according to a given condition.";
- break;
- }
- if(hintNode.Parent is Constraint)
- {
- result.AddCategory("Form", "generic-class-declaration " + Highlight("where", colorStyle.KeywordContext) + " type-parameter : type-constraint");
- result.SummaryMarkup = "The " + Highlight("where", colorStyle.KeywordContext) + " clause constrains which types can be used as the type parameter in a generic declaration.";
- break;
- }
- }
- else
- {
- result.AddCategory("Form", "generic-class-declaration " + Highlight("where", colorStyle.KeywordContext) + " type-parameter : type-constraint"
- +Environment.NewLine + Environment.NewLine + "or" + Environment.NewLine + Environment.NewLine + "query-clauses " + Highlight("where", colorStyle.KeywordContext) +
- " condition" + " [query-clauses]");
- } + result.SignatureMarkup = Highlight ("where", colorStyle.KeywordContext) + keywordSign; + if (hintNode != null) { + if (hintNode.Parent is QueryWhereClause) { + result.AddCategory ("Query Form", Highlight ("where", colorStyle.KeywordContext) + " condition"); + result.SummaryMarkup = "The " + Highlight ("where", colorStyle.KeywordContext) + " clause specifies which elements from the data source to be returned according to a given condition."; + break; + } + if (hintNode.Parent is Constraint) { + result.AddCategory ("Form", "generic-class-declaration " + Highlight ("where", colorStyle.KeywordContext) + " type-parameter : type-constraint"); + result.SummaryMarkup = "The " + Highlight ("where", colorStyle.KeywordContext) + " clause constrains which types can be used as the type parameter in a generic declaration."; + break; + } + } else { + result.AddCategory ("Form", "generic-class-declaration " + Highlight ("where", colorStyle.KeywordContext) + " type-parameter : type-constraint" + + Environment.NewLine + Environment.NewLine + "or" + Environment.NewLine + Environment.NewLine + "query-clauses " + Highlight ("where", colorStyle.KeywordContext) + + " condition" + " [query-clauses]"); + } break; case "yield": result.SignatureMarkup = Highlight ("yield", colorStyle.KeywordContext) + keywordSign; - result.AddCategory("Form", Highlight("yield", colorStyle.KeywordContext) + Highlight("break", colorStyle.KeywordJump) + Environment.NewLine - + Environment.NewLine + "or" + Environment.NewLine + Environment.NewLine - + Highlight("yield", colorStyle.KeywordContext) + Highlight("return", colorStyle.KeywordJump) + " expression");
- result.SummaryMarkup = "The " + Highlight("yield", colorStyle.KeywordContext) + " keyword is used to indicate that a method, get accessor, or operator is an iterator."; + result.AddCategory ("Form", Highlight ("yield", colorStyle.KeywordContext) + Highlight ("break", colorStyle.KeywordJump) + Environment.NewLine + + Environment.NewLine + "or" + Environment.NewLine + Environment.NewLine + + Highlight ("yield", colorStyle.KeywordContext) + Highlight ("return", colorStyle.KeywordJump) + " expression"); + result.SummaryMarkup = "The " + Highlight ("yield", colorStyle.KeywordContext) + " keyword is used to indicate that a method, get accessor, or operator is an iterator."; break; case "while": result.SignatureMarkup = Highlight ("while", colorStyle.KeywordIteration) + keywordSign; @@ -1441,7 +1435,7 @@ namespace MonoDevelop.CSharp result.AddCategory (GettextCatalog.GetString ("Alias information"), GettextCatalog.GetString ("Resolved using alias '{0}'", resolveResult.Alias)); return result; } - + public TooltipInformation GetAliasedTypeTooltip (AliasTypeResolveResult resolveResult) { var result = new TooltipInformation (); @@ -1449,7 +1443,7 @@ namespace MonoDevelop.CSharp result.AddCategory (GettextCatalog.GetString ("Alias information"), GettextCatalog.GetString ("Resolved using alias '{0}'", resolveResult.Alias)); return result; } - + string GetEventMarkup (IEvent evt) { if (evt == null) @@ -1465,11 +1459,12 @@ namespace MonoDevelop.CSharp } AppendExplicitInterfaces (result, evt); - result.Append (HighlightSemantically (CSharpAmbience.FilterName (evt.Name), colorStyle.UserEventDeclaration)); + result.Append (HighlightSemantically (FilterEntityName (evt.Name), colorStyle.UserEventDeclaration)); return result.ToString (); } bool grayOut; + bool GrayOut { get { return grayOut; @@ -1491,7 +1486,7 @@ namespace MonoDevelop.CSharp result.Append (new string (' ', 2)); var doHighightParameter = i == HighlightParameter || HighlightParameter >= i && i == parameterList.Count - 1 && parameter.IsParams; if (doHighightParameter) - result.Append("<u>"); + result.Append ("<u>"); /* if (parameter.IsOptional) { GrayOut = true; var color = AlphaBlend (colorStyle.Default.Color, colorStyle.Default.BackgroundColor, optionalAlpha); @@ -1510,7 +1505,7 @@ namespace MonoDevelop.CSharp // result.Append ("</span>"); } if (doHighightParameter) - result.Append("</u>"); + result.Append ("</u>"); if (i + 1 < parameterList.Count) { if (spaceBefore) result.Append (' '); @@ -1526,7 +1521,7 @@ namespace MonoDevelop.CSharp if (newLine) result.AppendLine (); } - + void AppendParameter (StringBuilder result, IParameter parameter) { if (parameter == null) @@ -1540,7 +1535,7 @@ namespace MonoDevelop.CSharp } result.Append (GetTypeReferenceString (parameter.Type)); result.Append (" "); - result.Append (CSharpAmbience.FilterName (parameter.Name)); + result.Append (FilterEntityName (parameter.Name)); } void AppendExplicitInterfaces (StringBuilder sb, IMember member) @@ -1590,15 +1585,15 @@ namespace MonoDevelop.CSharp return; } - while (NullableType.IsNullable (constantType)) + while (NullableType.IsNullable (constantType)) constantType = NullableType.GetUnderlyingType (constantType); if (constantType.Kind == TypeKind.Enum) { foreach (var field in constantType.GetFields ()) { - if (field.ConstantValue == constantValue){ + if (field.ConstantValue == constantValue) { if (useNumericalEnumValue) { sb.Append (Highlight (string.Format ("0x{0:X}", field.ConstantValue), colorStyle.Number)); } else { - sb.Append (GetTypeReferenceString (constantType) + "." + CSharpAmbience.FilterName (field.Name)); + sb.Append (GetTypeReferenceString (constantType) + "." + FilterEntityName (field.Name)); } return; } @@ -1622,8 +1617,8 @@ namespace MonoDevelop.CSharp for (int i = 0; i < fields.Count; i++) { if (i > 0) sb.Append (" | "); - var field = fields[i]; - sb.Append (GetTypeReferenceString (constantType) + "." + CSharpAmbience.FilterName (field.Name)); + var field = fields [i]; + sb.Append (GetTypeReferenceString (constantType) + "." + FilterEntityName (field.Name)); } return; } @@ -1638,9 +1633,9 @@ namespace MonoDevelop.CSharp void AppendVariance (StringBuilder sb, VarianceModifier variance) { - if (variance == VarianceModifier.Contravariant) { + if (variance == VarianceModifier.Contravariant) { sb.Append (Highlight ("in ", colorStyle.KeywordParameter)); - } else if (variance == VarianceModifier.Covariant) { + } else if (variance == VarianceModifier.Covariant) { sb.Append (Highlight ("out ", colorStyle.KeywordParameter)); } } @@ -1651,12 +1646,12 @@ namespace MonoDevelop.CSharp (byte)((alpha * color.Red + (1 - alpha) * color2.Red) / 256), (byte)((alpha * color.Green + (1 - alpha) * color2.Green) / 256), (byte)((alpha * color.Blue + (1 - alpha) * color2.Blue) / 256) - ); + ); } Gdk.Color AlphaBlend (Cairo.Color color, Cairo.Color color2, double alpha) { - return AlphaBlend ((Gdk.Color) ((HslColor)color), (Gdk.Color) ((HslColor)color2), alpha); + return AlphaBlend ((Gdk.Color)((HslColor)color), (Gdk.Color)((HslColor)color2), alpha); } public string GetArrayIndexerMarkup (ArrayType arrayType) @@ -1697,10 +1692,10 @@ namespace MonoDevelop.CSharp string Highlight (string str, ChunkStyle style) { - var color = (Gdk.Color) ((HslColor)colorStyle.GetForeground (style)); + var color = (Gdk.Color)((HslColor)colorStyle.GetForeground (style)); if (grayOut) { - color = AlphaBlend (color, (Gdk.Color) ((HslColor)colorStyle.PlainText.Background), optionalAlpha); + color = AlphaBlend (color, (Gdk.Color)((HslColor)colorStyle.PlainText.Background), optionalAlpha); } var colorString = Mono.TextEditor.HelperMethods.GetColorString (color); @@ -1725,14 +1720,12 @@ namespace MonoDevelop.CSharp if (def.TryGetSourceProject (out project)) { var relPath = FileService.AbsoluteToRelativePath (project.BaseDirectory, def.Region.FileName); - return - (string.IsNullOrEmpty (def.Namespace) ? "" : "<small>" + GettextCatalog.GetString ("Namespace:\t{0}", AmbienceService.EscapeText (def.Namespace)) + "</small>" + Environment.NewLine) + + return (string.IsNullOrEmpty (def.Namespace) ? "" : "<small>" + GettextCatalog.GetString ("Namespace:\t{0}", AmbienceService.EscapeText (def.Namespace)) + "</small>" + Environment.NewLine) + "<small>" + GettextCatalog.GetString ("Project:\t{0}", AmbienceService.EscapeText (def.ParentAssembly.AssemblyName)) + "</small>" + Environment.NewLine + "<small>" + GettextCatalog.GetString ("File:\t\t{0} (line {1})", AmbienceService.EscapeText (relPath), def.Region.Begin.Line) + "</small>"; } } - return - (string.IsNullOrEmpty (def.Namespace) ? "" : "<small>" + GettextCatalog.GetString ("Namespace:\t{0}", AmbienceService.EscapeText (def.Namespace)) + "</small>" + Environment.NewLine) + + return (string.IsNullOrEmpty (def.Namespace) ? "" : "<small>" + GettextCatalog.GetString ("Namespace:\t{0}", AmbienceService.EscapeText (def.Namespace)) + "</small>" + Environment.NewLine) + "<small>" + GettextCatalog.GetString ("Assembly:\t{0}", AmbienceService.EscapeText (def.ParentAssembly.AssemblyName)) + "</small>"; } return null; @@ -1743,14 +1736,12 @@ namespace MonoDevelop.CSharp MonoDevelop.Projects.Project project; if (entity.DeclaringTypeDefinition.TryGetSourceProject (out project)) { var relPath = FileService.AbsoluteToRelativePath (project.BaseDirectory, entity.Region.FileName); - return - "<small>" + GettextCatalog.GetString ("Project:\t{0}", AmbienceService.EscapeText (project.Name)) + "</small>" + Environment.NewLine + + return "<small>" + GettextCatalog.GetString ("Project:\t{0}", AmbienceService.EscapeText (project.Name)) + "</small>" + Environment.NewLine + "<small>" + GettextCatalog.GetString ("From type:\t{0}", AmbienceService.EscapeText (entity.DeclaringTypeDefinition.FullName)) + "</small>" + Environment.NewLine + "<small>" + GettextCatalog.GetString ("File:\t\t{0} (line {1})", AmbienceService.EscapeText (relPath), entity.Region.Begin.Line) + "</small>"; } } - return - "<small>" + GettextCatalog.GetString ("From type:\t{0}", AmbienceService.EscapeText (entity.DeclaringTypeDefinition.FullName)) + "</small>" + Environment.NewLine + + return "<small>" + GettextCatalog.GetString ("From type:\t{0}", AmbienceService.EscapeText (entity.DeclaringTypeDefinition.FullName)) + "</small>" + Environment.NewLine + "<small>" + GettextCatalog.GetString ("Assembly:\t{0}", AmbienceService.EscapeText (entity.DeclaringTypeDefinition.ParentAssembly.AssemblyName)) + "</small>"; } return null; diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/AnalysisCommands.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/AnalysisCommands.cs index 5293b3db58..4fe2c5f86f 100644 --- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/AnalysisCommands.cs +++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/AnalysisCommands.cs @@ -41,6 +41,9 @@ using MonoDevelop.CodeIssues; using ICSharpCode.NRefactory.Refactoring; using MonoDevelop.CodeActions; using System.Threading; +using System.IO; +using MonoDevelop.Refactoring; +using MonoDevelop.Ide.Gui.Dialogs; namespace MonoDevelop.AnalysisCore { @@ -48,7 +51,8 @@ namespace MonoDevelop.AnalysisCore { FixOperations, ShowFixes, - QuickFix + QuickFix, + ExportRules } class ShowFixesHandler : CommandHandler @@ -270,5 +274,70 @@ namespace MonoDevelop.AnalysisCore } } } + + class ExportRulesHandler : CommandHandler + { + protected override void Run () + { + var lang = "text/x-csharp"; + + OpenFileDialog dlg = new OpenFileDialog ("Export Rules", FileChooserAction.Save); + dlg.InitialFileName = "rules.html"; + if (!dlg.Run ()) + return; + + Dictionary<BaseCodeIssueProvider, Severity> severities = new Dictionary<BaseCodeIssueProvider, Severity> (); + + foreach (var node in RefactoringService.GetInspectors (lang)) { + severities [node] = node.GetSeverity (); + if (node.HasSubIssues) { + foreach (var subIssue in node.SubIssues) { + severities [subIssue] = subIssue.GetSeverity (); + } + } + } + + var grouped = severities.Keys.OfType<CodeIssueProvider> () + .GroupBy (node => node.Category) + .OrderBy (g => g.Key, StringComparer.Ordinal); + + using (var sw = new StreamWriter (dlg.SelectedFile)) { + sw.WriteLine ("<h1>Code Rules</h1>"); + foreach (var g in grouped) { + sw.WriteLine ("<h2>" + g.Key + "</h2>"); + sw.WriteLine ("<table border='1'>"); + + foreach (var node in g.OrderBy (n => n.Title, StringComparer.Ordinal)) { + var title = node.Title; + var desc = node.Description != title ? node.Description : ""; + sw.WriteLine ("<tr><td>" + title + "</td><td>" + desc + "</td><td>" + node.GetSeverity () + "</td></tr>"); + if (node.HasSubIssues) { + foreach (var subIssue in node.SubIssues) { + title = subIssue.Title; + desc = subIssue.Description != title ? subIssue.Description : ""; + sw.WriteLine ("<tr><td> - " + title + "</td><td>" + desc + "</td><td>" + subIssue.GetSeverity () + "</td></tr>"); + } + } + } + sw.WriteLine ("</table>"); + } + + Dictionary<CodeActionProvider, bool> providerStates = new Dictionary<CodeActionProvider, bool> (); + string disabledNodes = PropertyService.Get ("ContextActions." + lang, ""); + foreach (var node in RefactoringService.ContextAddinNodes.Where (n => n.MimeType == lang)) { + providerStates [node] = disabledNodes.IndexOf (node.IdString, StringComparison.Ordinal) < 0; + } + + sw.WriteLine ("<h1>Code Actions</h1>"); + sw.WriteLine ("<table border='1'>"); + var sortedAndFiltered = providerStates.Keys.OrderBy (n => n.Title, StringComparer.Ordinal); + foreach (var node in sortedAndFiltered) { + var desc = node.Title != node.Description ? node.Description : ""; + sw.WriteLine ("<tr><td>" + node.Title + "</td><td>" + desc + "</td></tr>"); + } + sw.WriteLine ("</table>"); + } + } + } } diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.addin.xml b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.addin.xml index 8ce7b43b8e..fc75465d12 100644 --- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.addin.xml +++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.addin.xml @@ -114,7 +114,12 @@ _label = "Import Symbol..." shortcut = "Control|Alt|space" macShortcut = "Control|Alt|space" /> - + + <Command id = "MonoDevelop.AnalysisCore.AnalysisCommands.ExportRules" + defaultHandler = "MonoDevelop.AnalysisCore.ExportRulesHandler" + _label = "Export C# Code Rules to a File" + _description = "Generates an HTML file that contains a list of all code rules" + /> </Category> </Extension> diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/ImportSymbolHandler.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/ImportSymbolHandler.cs index 68161f9ad5..1a2960a688 100644 --- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/ImportSymbolHandler.cs +++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/ImportSymbolHandler.cs @@ -226,7 +226,7 @@ namespace MonoDevelop.Refactoring var lookup = new MemberLookup (null, doc.Compilation.MainAssembly); List<ImportSymbolCompletionData> typeList = new List<ImportSymbolCompletionData> (); - foreach (var type in dom.GetAllTypeDefinitions ()) { + foreach (var type in dom.GetTopLevelTypeDefinitons ()) { if (!lookup.IsAccessible (type, false)) continue; typeList.Add (new ImportSymbolCompletionData (doc, cache, type)); diff --git a/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.Xml.StateEngine/Parser.cs b/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.Xml.StateEngine/Parser.cs index 09f01d61f8..6c6e481965 100755 --- a/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.Xml.StateEngine/Parser.cs +++ b/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.Xml.StateEngine/Parser.cs @@ -270,14 +270,6 @@ namespace MonoDevelop.Xml.StateEngine return new TextLocation (line, col); } - DomRegion LocationCurrentChar { - get { - int col = Location.Column - 1; - System.Diagnostics.Debug.Assert (col > 0); - return new DomRegion (Location.Line, col, Location.Line, Location.Column); - } - } - StringBuilder IParseContext.KeywordBuilder { get { return keywordBuilder; } } @@ -294,13 +286,13 @@ namespace MonoDevelop.Xml.StateEngine void IParseContext.LogError (string message) { if (errors != null || ErrorLogged != null) - InternalLogError (new Error (ErrorType.Error, message, LocationCurrentChar)); + InternalLogError (new Error (ErrorType.Error, message, Location)); } void IParseContext.LogWarning (string message) { if (errors != null || ErrorLogged != null) - InternalLogError (new Error (ErrorType.Warning, message, LocationCurrentChar)); + InternalLogError (new Error (ErrorType.Warning, message, Location)); } void IParseContext.LogError (string message, TextLocation location) diff --git a/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Gui/BaseXmlEditorExtension.cs b/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Gui/BaseXmlEditorExtension.cs index 33b26f8916..adb0166fd7 100644 --- a/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Gui/BaseXmlEditorExtension.cs +++ b/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor.Gui/BaseXmlEditorExtension.cs @@ -60,6 +60,12 @@ namespace MonoDevelop.XmlEditor.Gui Gtk.TreeStore outlineTreeStore; #region Setup and teardown + + public override bool ExtendsEditor (MonoDevelop.Ide.Gui.Document doc, IEditableTextBuffer editor) + { + //can only attach if there is not already an attached BaseXmlEditorExtension + return doc.GetContent<BaseXmlEditorExtension> () == null; + } protected virtual RootState CreateRootState () { diff --git a/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor/XmlTextEditorExtension.cs b/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor/XmlTextEditorExtension.cs index 68842a16e7..51317c5625 100644 --- a/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor/XmlTextEditorExtension.cs +++ b/main/src/addins/MonoDevelop.XmlEditor/MonoDevelop.XmlEditor/XmlTextEditorExtension.cs @@ -54,15 +54,11 @@ namespace MonoDevelop.XmlEditor XmlSchemaCompletionData defaultSchemaCompletionData; string defaultNamespacePrefix; InferredXmlCompletionProvider inferredCompletionData; - bool inferenceQueued = false; - -// bool showSchemaAnnotation; - + bool inferenceQueued; + public override bool ExtendsEditor (MonoDevelop.Ide.Gui.Document doc, IEditableTextBuffer editor) { - if (doc == null) - return false; - return IsFileNameHandled (doc.Name); + return IsFileNameHandled (doc.Name) && base.ExtendsEditor (doc, editor); } public override void Initialize () @@ -450,8 +446,6 @@ namespace MonoDevelop.XmlEditor foreach (var m in DesktopService.GetMimeTypeInheritanceChain (mimeType)) { if (m == TextXmlMimeType || m == ApplicationXmlMimeType) return true; - if (m == MonoDevelop.XmlEditor.MSBuild.MSBuildTextEditorExtension.MSBuildMimeType) - return false; } return false; } diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/CommitDialog.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/CommitDialog.cs index fd3ae7c6f5..65fecab444 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/CommitDialog.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/CommitDialog.cs @@ -49,6 +49,7 @@ namespace MonoDevelop.VersionControl.Dialogs ArrayList extensions = new ArrayList (); ChangeSet changeSet; string oldMessage; + bool responseSensitive; public CommitDialog (ChangeSet changeSet) { @@ -132,6 +133,7 @@ namespace MonoDevelop.VersionControl.Dialogs Message = changeSet.GlobalComment; textview.Buffer.Changed += OnTextChanged; + responseSensitive = !string.IsNullOrEmpty (Message); // Focus the text view and move the insert point to the beginning. Makes it easier to insert // a comment header. @@ -139,11 +141,13 @@ namespace MonoDevelop.VersionControl.Dialogs textview.Buffer.MoveMark (textview.Buffer.SelectionBound, textview.Buffer.StartIter); textview.GrabFocus (); textview.Buffer.MarkSet += OnMarkSet; + + SetResponseSensitive (ResponseType.Ok, responseSensitive); } void HandleAllowCommitChanged (object sender, EventArgs e) { - bool allowCommit = true; + bool allowCommit = responseSensitive; foreach (CommitDialogExtension ext in extensions) allowCommit &= ext.AllowCommit; SetResponseSensitive (Gtk.ResponseType.Ok, allowCommit); @@ -153,11 +157,13 @@ namespace MonoDevelop.VersionControl.Dialogs { if (type != Gtk.ResponseType.Ok) { changeSet.GlobalComment = oldMessage; - } + } else if (!ButtonCommitClicked ()) + return; + base.OnResponse (type); } - protected void OnButtonCommitClicked (object sender, System.EventArgs e) + bool ButtonCommitClicked () { // In case we have local unsaved files with changes, throw a dialog for the user. System.Collections.Generic.List<Document> docList = new System.Collections.Generic.List<Document> (); @@ -180,7 +186,7 @@ namespace MonoDevelop.VersionControl.Dialogs ); if (response == AlertButton.Cancel) - return; + return false; if (response == AlertButton.Save) { // Go through all the items and save them. @@ -192,7 +198,7 @@ namespace MonoDevelop.VersionControl.Dialogs if (item.IsDirty) { MessageService.ShowMessage (GettextCatalog.GetString ( "Some files could not be saved. Commit operation aborted")); - return; + return false; } } @@ -229,11 +235,10 @@ namespace MonoDevelop.VersionControl.Dialogs ext.OnEndCommit (changeSet, false); } catch {} } - return; + return false; } - Hide (); } - Respond (Gtk.ResponseType.Ok); + return true; } void UpdatePositionLabel (TextIter iter) @@ -254,6 +259,8 @@ namespace MonoDevelop.VersionControl.Dialogs void OnTextChanged (object s, EventArgs args) { changeSet.GlobalComment = Message; + responseSensitive = !string.IsNullOrEmpty (Message); + SetResponseSensitive (ResponseType.Ok, responseSensitive); UpdatePositionLabel (textview.Buffer.GetIterAtOffset (textview.Buffer.CursorPosition)); } diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/gtk-gui/MonoDevelop.VersionControl.Dialogs.CommitDialog.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/gtk-gui/MonoDevelop.VersionControl.Dialogs.CommitDialog.cs index 10ad380cee..69b893645f 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/gtk-gui/MonoDevelop.VersionControl.Dialogs.CommitDialog.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/gtk-gui/MonoDevelop.VersionControl.Dialogs.CommitDialog.cs @@ -144,6 +144,7 @@ namespace MonoDevelop.VersionControl.Dialogs this.buttonCommit.Name = "buttonCommit"; this.buttonCommit.UseUnderline = true; this.buttonCommit.Label = global::Mono.Unix.Catalog.GetString ("C_ommit"); + this.AddActionWidget (this.buttonCommit, -5); w12.Add (this.buttonCommit); global::Gtk.ButtonBox.ButtonBoxChild w14 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w12 [this.buttonCommit])); w14.Position = 1; @@ -157,7 +158,6 @@ namespace MonoDevelop.VersionControl.Dialogs this.label2.MnemonicWidget = this.textview; this.label3.MnemonicWidget = this.textview; this.Hide (); - this.buttonCommit.Clicked += new global::System.EventHandler (this.OnButtonCommitClicked); } } } diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/gtk-gui/gui.stetic b/main/src/addins/VersionControl/MonoDevelop.VersionControl/gtk-gui/gui.stetic index 1153fdedb6..f094d26872 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/gtk-gui/gui.stetic +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/gtk-gui/gui.stetic @@ -1192,8 +1192,7 @@ <property name="Type">TextOnly</property> <property name="Label" translatable="yes">C_ommit</property> <property name="UseUnderline">True</property> - <property name="ResponseId">-1</property> - <signal name="Clicked" handler="OnButtonCommitClicked" /> + <property name="ResponseId">-5</property> </widget> <packing> <property name="Position">1</property> diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FileService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FileService.cs index e37545a5c0..f71406d752 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FileService.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FileService.cs @@ -586,6 +586,7 @@ namespace MonoDevelop.Core /// <summary>
/// Creates a directory if it does not already exist.
/// </summary>
+ [Obsolete("Use Directory.CreateDirectory")]
public static void EnsureDirectoryExists (string directory)
{
if (!Directory.Exists (directory))
@@ -597,7 +598,7 @@ namespace MonoDevelop.Core /// </summary>
public static string MakePathSeparatorsNative (string path)
{
- if (path == null || path.Length == 0)
+ if (string.IsNullOrEmpty (path))
return path;
char c = Path.DirectorySeparatorChar == '\\'? '/' : '\\';
return path.Replace (c, Path.DirectorySeparatorChar);
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/LoggingService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/LoggingService.cs index 311b293132..1a1fe87cf2 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/LoggingService.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/LoggingService.cs @@ -30,16 +30,16 @@ using System; using System.Collections; using System.Collections.Generic; using System.IO; -using System.Net; -using System.Web; using System.Linq; using System.Diagnostics; + +#if ENABLE_RAYGUN using System.Threading; -using System.IO.Compression; using Mindscape.Raygun4Net; -using Mindscape.Raygun4Net.Messages; +#endif using MonoDevelop.Core.Logging; +using Mono.Unix.Native; namespace MonoDevelop.Core { @@ -49,10 +49,13 @@ namespace MonoDevelop.Core const string ReportCrashesKey = "MonoDevelop.LogAgent.ReportCrashes"; const string ReportUsageKey = "MonoDevelop.LogAgent.ReportUsage"; - static RaygunClient raygunClient = null; +#if ENABLE_RAYGUN + static RaygunClient raygunClient; +#endif static List<ILogger> loggers = new List<ILogger> (); static RemoteLogger remoteLogger; static DateTime timestamp; + static int logFileSuffix; static TextWriter defaultError; static TextWriter defaultOut; static bool reporting; @@ -65,7 +68,7 @@ namespace MonoDevelop.Core static LoggingService () { - ConsoleLogger consoleLogger = new ConsoleLogger (); + var consoleLogger = new ConsoleLogger (); loggers.Add (consoleLogger); loggers.Add (new InstrumentationLogger ()); @@ -73,7 +76,9 @@ namespace MonoDevelop.Core if (!string.IsNullOrEmpty (consoleLogLevelEnv)) { try { consoleLogger.EnabledLevel = (EnabledLoggingLevel) Enum.Parse (typeof (EnabledLoggingLevel), consoleLogLevelEnv, true); - } catch {} + } catch (Exception e) { + LogError ("Error setting log level", e); + } } string consoleLogUseColourEnv = Environment.GetEnvironmentVariable ("MONODEVELOP_CONSOLE_LOG_USE_COLOUR"); @@ -86,12 +91,12 @@ namespace MonoDevelop.Core string logFileEnv = Environment.GetEnvironmentVariable ("MONODEVELOP_LOG_FILE"); if (!string.IsNullOrEmpty (logFileEnv)) { try { - FileLogger fileLogger = new FileLogger (logFileEnv); + var fileLogger = new FileLogger (logFileEnv); loggers.Add (fileLogger); string logFileLevelEnv = Environment.GetEnvironmentVariable ("MONODEVELOP_FILE_LOG_LEVEL"); fileLogger.EnabledLevel = (EnabledLoggingLevel) Enum.Parse (typeof (EnabledLoggingLevel), logFileLevelEnv, true); } catch (Exception e) { - LogError (e.ToString ()); + LogError ("Error setting custom log file", e); } } @@ -105,10 +110,10 @@ namespace MonoDevelop.Core #endif //remove the default trace listener on .NET, it throws up horrible dialog boxes for asserts - System.Diagnostics.Debug.Listeners.Clear (); + Debug.Listeners.Clear (); //add a new listener that just logs failed asserts - System.Diagnostics.Debug.Listeners.Add (new AssertLoggingTraceListener ()); + Debug.Listeners.Add (new AssertLoggingTraceListener ()); } public static bool? ReportCrashes { @@ -121,19 +126,56 @@ namespace MonoDevelop.Core set { PropertyService.Set (ReportUsageKey, value); } } - static string GenericLogFile { - get { return "Ide.log"; } - } - + [Obsolete ("Use CreateLogFile")] public static DateTime LogTimestamp { get { return timestamp; } } - static string UniqueLogFile { - get { - return string.Format ("Ide.{0}.log", timestamp.ToString ("yyyy-MM-dd__HH-mm-ss")); + /// <summary> + /// Creates a session log file with the given identifier. + /// </summary> + /// <returns>A TextWriter, null if the file cannot be created.</returns> + public static TextWriter CreateLogFile (string identifier) + { + string filename; + return CreateLogFile (identifier, out filename); + } + + public static TextWriter CreateLogFile (string identifier, out string filename) + { + FilePath logDir = UserProfile.Current.LogDir; + Directory.CreateDirectory (logDir); + + int oldIdx = logFileSuffix; + + while (true) { + filename = logDir.Combine (GetSessionLogFileName (identifier)); + try { + var stream = File.Open (filename, FileMode.Create, FileAccess.Write, FileShare.Read); + return new StreamWriter (stream) { AutoFlush = true }; + } catch (Exception ex) { + // if the file already exists, retry with a suffix, up to 10 times + if (logFileSuffix < oldIdx + 10) { + const int ERROR_FILE_EXISTS = 80; + const int ERROR_SHARING_VIOLATION = 32; + var err = System.Runtime.InteropServices.Marshal.GetHRForException (ex) & 0xFFFF; + if (err == ERROR_FILE_EXISTS || err == ERROR_SHARING_VIOLATION) { + logFileSuffix++; + continue; + } + } + LogInternalError ("Failed to create log file.", ex); + return null; + } } } + + static string GetSessionLogFileName (string logName) + { + if (logFileSuffix == 0) + return string.Format ("{0}.{1}.log", logName, timestamp.ToString ("yyyy-MM-dd__HH-mm-ss")); + return string.Format ("{0}.{1}-{2}.log", logName, timestamp.ToString ("yyyy-MM-dd__HH-mm-ss"), logFileSuffix); + } public static void Initialize (bool redirectOutput) { @@ -181,11 +223,13 @@ namespace MonoDevelop.Core foreach (var cd in SystemInformation.GetDescription ()) customData[cd.Title ?? ""] = cd.Description; +#if ENABLE_RAYGUN if (raygunClient != null) { ThreadPool.QueueUserWorkItem (delegate { raygunClient.Send (ex, tags, customData, Runtime.Version.ToString ()); }); } +#endif //ensure we don't lose the setting if (ReportCrashes != oldReportCrashes) { @@ -220,27 +264,24 @@ namespace MonoDevelop.Core static void RedirectOutputToLogFile () { - FilePath logDir = UserProfile.Current.LogDir; - if (!Directory.Exists (logDir)) - Directory.CreateDirectory (logDir); - try { if (Platform.IsWindows) { //TODO: redirect the file descriptors on Windows, just plugging in a textwriter won't get everything - RedirectOutputToFileWindows (logDir, UniqueLogFile); + RedirectOutputToFileWindows (); } else { - RedirectOutputToFileUnix (logDir, UniqueLogFile); + RedirectOutputToFileUnix (); } } catch (Exception ex) { - Console.Error.WriteLine (ex); + LogInternalError ("Failed to redirect output to log file", ex); } } - static void RedirectOutputToFileWindows (FilePath logDirectory, string logName) + static void RedirectOutputToFileWindows () { - var stream = File.Open (logDirectory.Combine (logName), FileMode.Create, FileAccess.Write, FileShare.Read); - var writer = new StreamWriter (stream) { AutoFlush = true }; - + var writer = CreateLogFile ("Ide"); + if (writer == Console.Out) + return; + var stderr = new MonoDevelop.Core.ProgressMonitoring.LogTextWriter (); stderr.ChainWriter (Console.Error); stderr.ChainWriter (writer); @@ -254,41 +295,66 @@ namespace MonoDevelop.Core Console.SetOut (stdout); } - static void RedirectOutputToFileUnix (FilePath logDirectory, string logName) + static void RedirectOutputToFileUnix () { const int STDOUT_FILENO = 1; const int STDERR_FILENO = 2; - Mono.Unix.Native.OpenFlags flags = Mono.Unix.Native.OpenFlags.O_WRONLY - | Mono.Unix.Native.OpenFlags.O_CREAT | Mono.Unix.Native.OpenFlags.O_TRUNC; - var mode = Mono.Unix.Native.FilePermissions.S_IFREG - | Mono.Unix.Native.FilePermissions.S_IRUSR | Mono.Unix.Native.FilePermissions.S_IWUSR - | Mono.Unix.Native.FilePermissions.S_IRGRP | Mono.Unix.Native.FilePermissions.S_IWGRP; - - var file = logDirectory.Combine (logName); - int fd = Mono.Unix.Native.Syscall.open (file, flags, mode); - if (fd < 0) - //error - return; + const OpenFlags flags = OpenFlags.O_WRONLY | OpenFlags.O_CREAT | OpenFlags.O_TRUNC; + + const FilePermissions mode = + FilePermissions.S_IFREG | FilePermissions.S_IRUSR | FilePermissions.S_IWUSR | + FilePermissions.S_IRGRP | FilePermissions.S_IWGRP; + + FilePath logDir = UserProfile.Current.LogDir; + Directory.CreateDirectory (logDir); + + int fd; + string logFile; + int oldIdx = logFileSuffix; + + while (true) { + logFile = logDir.Combine (GetSessionLogFileName ("Ide")); + + // if the file already exists, retry with a suffix, up to 10 times + fd = Syscall.open (logFile, flags, mode); + if (fd >= 0) + break; + + var err = Stdlib.GetLastError (); + if (logFileSuffix >= oldIdx + 10 || err != Errno.EEXIST) { + logFileSuffix++; + continue; + } + throw new IOException ("Unable to open file: " + err); + } + try { - int res = Mono.Unix.Native.Syscall.dup2 (fd, STDOUT_FILENO); + int res = Syscall.dup2 (fd, STDOUT_FILENO); if (res < 0) - //error - return; + throw new IOException ("Unable to redirect stdout: " + Stdlib.GetLastError ()); - res = Mono.Unix.Native.Syscall.dup2 (fd, STDERR_FILENO); + res = Syscall.dup2 (fd, STDERR_FILENO); if (res < 0) - //error - return; + throw new IOException ("Unable to redirect stderr: " + Stdlib.GetLastError ()); - var genericLog = logDirectory.Combine (GenericLogFile); - File.Delete (genericLog); - Mono.Unix.Native.Syscall.symlink (file, genericLog); + //try to symlink timestamped file to generic one. NBD if it fails. + SymlinkWithRetry (logFile, logDir.Combine ("Ide.log"), 10); } finally { - Mono.Unix.Native.Syscall.close (fd); + Syscall.close (fd); } } + static bool SymlinkWithRetry (string from, string to, int retries) + { + for (int i = 0; i < retries; i++) { + Syscall.unlink (to); + if (Syscall.symlink (from, to) >= 0) + return true; + } + return false; + } + static void RestoreOutputRedirection () { if (defaultError != null) @@ -309,7 +375,7 @@ namespace MonoDevelop.Core public static bool IsLevelEnabled (LogLevel level) { - EnabledLoggingLevel l = (EnabledLoggingLevel) level; + var l = (EnabledLoggingLevel) level; foreach (ILogger logger in loggers) if ((logger.EnabledLevel & l) == l) return true; @@ -318,7 +384,7 @@ namespace MonoDevelop.Core public static void Log (LogLevel level, string message) { - EnabledLoggingLevel l = (EnabledLoggingLevel) level; + var l = (EnabledLoggingLevel) level; foreach (ILogger logger in loggers) if ((logger.EnabledLevel & l) == l) logger.Log (level, message); @@ -420,17 +486,17 @@ namespace MonoDevelop.Core public static void LogDebug (string message, Exception ex) { - Log (LogLevel.Debug, message + (ex != null? System.Environment.NewLine + ex.ToString () : string.Empty)); + Log (LogLevel.Debug, message + (ex != null? Environment.NewLine + ex : string.Empty)); } public static void LogInfo (string message, Exception ex) { - Log (LogLevel.Info, message + (ex != null? System.Environment.NewLine + ex.ToString () : string.Empty)); + Log (LogLevel.Info, message + (ex != null? Environment.NewLine + ex : string.Empty)); } public static void LogWarning (string message, Exception ex) { - Log (LogLevel.Warn, message + (ex != null? System.Environment.NewLine + ex.ToString () : string.Empty)); + Log (LogLevel.Warn, message + (ex != null? Environment.NewLine + ex : string.Empty)); } public static void LogError (string message, Exception ex) @@ -440,13 +506,13 @@ namespace MonoDevelop.Core public static void LogUserError (string message, Exception ex) { - Log (LogLevel.Error, message + (ex != null? System.Environment.NewLine + ex.ToString () : string.Empty)); + Log (LogLevel.Error, message + (ex != null? Environment.NewLine + ex : string.Empty)); } public static void LogInternalError (Exception ex) { if (ex != null) { - Log (LogLevel.Error, System.Environment.NewLine + ex.ToString ()); + Log (LogLevel.Error, Environment.NewLine + ex); } ReportUnhandledException (ex, false, true, "internal"); @@ -454,21 +520,21 @@ namespace MonoDevelop.Core public static void LogInternalError (string message, Exception ex) { - Log (LogLevel.Error, message + (ex != null? System.Environment.NewLine + ex.ToString () : string.Empty)); + Log (LogLevel.Error, message + (ex != null? Environment.NewLine + ex : string.Empty)); ReportUnhandledException (ex, false, true, "internal"); } public static void LogCriticalError (string message, Exception ex) { - Log (LogLevel.Error, message + (ex != null? System.Environment.NewLine + ex.ToString () : string.Empty)); + Log (LogLevel.Error, message + (ex != null? Environment.NewLine + ex : string.Empty)); ReportUnhandledException (ex, false, false, "critical"); } public static void LogFatalError (string message, Exception ex) { - Log (LogLevel.Error, message + (ex != null? System.Environment.NewLine + ex.ToString () : string.Empty)); + Log (LogLevel.Error, message + (ex != null? Environment.NewLine + ex : string.Empty)); ReportUnhandledException (ex, true, false, "fatal"); } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/CustomTool.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/CustomTool.cs index e57fdd39b2..81bf74609c 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/CustomTool.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/CustomTool.cs @@ -49,6 +49,11 @@ namespace MonoDevelop.Ide.CustomTools /// The absolute name of the generated file. Must be in same directory as source file. /// </summary> public FilePath GeneratedFilePath { get; set; } + + /// <summary> + /// Overrides the default action on the generated file. + /// </summary> + public string OverrideBuildAction { get; private set; } /// <summary> /// Any unhandled exception from the generator. 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 4ce5b97135..873e6c7002 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/CustomToolService.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/CustomToolService.cs @@ -210,7 +210,7 @@ namespace MonoDevelop.Ide.CustomTools if (!result.GeneratedFilePath.IsNullOrEmpty && File.Exists (result.GeneratedFilePath)) { Gtk.Application.Invoke (delegate { if (genFile == null) { - genFile = file.Project.AddFile (result.GeneratedFilePath); + genFile = file.Project.AddFile (result.GeneratedFilePath, result.OverrideBuildAction); } else if (result.GeneratedFilePath != genFile.FilePath) { genFile.Name = result.GeneratedFilePath; } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Desktop/PlatformService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Desktop/PlatformService.cs index b4e9b4042f..b0c8333362 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Desktop/PlatformService.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Desktop/PlatformService.cs @@ -65,12 +65,12 @@ namespace MonoDevelop.Ide.Desktop public virtual void OpenFile (string filename) { - Process.Start ("file://" + filename); + Process.Start (filename); } public virtual void OpenFolder (FilePath folderPath) { - Process.Start ("file://" + folderPath); + Process.Start (folderPath); } public virtual void ShowUrl (string url) @@ -466,4 +466,4 @@ namespace MonoDevelop.Ide.Desktop } } } -}
\ No newline at end of file +} diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectReferenceNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectReferenceNodeBuilder.cs index e5631f1acc..768ac88f87 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectReferenceNodeBuilder.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectReferenceNodeBuilder.cs @@ -134,8 +134,10 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad { ProjectReference pref = CurrentNode.DataItem as ProjectReference; if (pref != null) { - foreach (string fileName in pref.GetReferencedFileNames (IdeApp.Workspace.ActiveConfiguration)) - IdeApp.Workbench.OpenDocument (fileName, pref.OwnerProject); + foreach (string fileName in pref.GetReferencedFileNames (IdeApp.Workspace.ActiveConfiguration)) { + if (File.Exists (fileName)) + IdeApp.Workbench.OpenDocument (fileName, pref.OwnerProject); + } } } 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 5295ba809a..6db6c7322d 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs @@ -634,18 +634,19 @@ namespace MonoDevelop.Ide.Gui foreach (TextEditorExtensionNode extNode in extensions) { if (!extNode.Supports (FileName, mimetypeChain)) continue; - TextEditorExtension ext = (TextEditorExtension)extNode.CreateInstance (); + var ext = (TextEditorExtension)extNode.CreateInstance (); if (ext.ExtendsEditor (this, editor)) { - if (editorExtension == null) - editorExtension = ext; - if (last != null) + if (last != null) { + ext.Next = last.Next; last.Next = ext; - last = ext; + last = ext; + } else { + editorExtension = last = ext; + last.Next = editor.AttachExtension (editorExtension); + } ext.Initialize (this); } } - if (editorExtension != null) - last.Next = editor.AttachExtension (editorExtension); } void DetachExtensionChain () diff --git a/main/tests/UnitTests/MonoDevelop.Xml.StateEngine/ParsingTests.cs b/main/tests/UnitTests/MonoDevelop.Xml.StateEngine/ParsingTests.cs index 10f6ad9f6b..3d09ae4610 100644 --- a/main/tests/UnitTests/MonoDevelop.Xml.StateEngine/ParsingTests.cs +++ b/main/tests/UnitTests/MonoDevelop.Xml.StateEngine/ParsingTests.cs @@ -26,9 +26,6 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -using System; -using System.Collections.Generic; -using MonoDevelop.Ide.Gui.Content; using System.Linq; using NUnit.Framework; @@ -235,7 +232,77 @@ namespace MonoDevelop.Xml.StateEngine Assert.AreEqual (3, el.Attributes.Count ());
parser.AssertErrorCount (1); Assert.AreEqual (1, parser.Errors [0].Region.BeginLine); - Assert.AreEqual (25, parser.Errors [0].Region.BeginColumn);
+ Assert.AreEqual (26, parser.Errors [0].Region.BeginColumn);
+ } + + [Test] + public void SimpleTree () + { + var parser = new TestParser (CreateRootState (), true); + parser.Parse (@" +<doc> + <a> + <b> + <c/> + <d> + <e/> + </d> + <f> + <g/> + </f> + </b> + </a> +</doc>"); + parser.AssertErrorCount (0); + + var doc = ((XDocument)parser.Nodes.Peek ()).RootElement; + Assert.NotNull (doc); + Assert.AreEqual ("doc", doc.Name.Name); + Assert.True (doc.IsEnded); + + var a = (XElement)doc.FirstChild; + Assert.NotNull (a); + Assert.AreEqual ("a", a.Name.Name); + Assert.True (a.IsEnded); + Assert.False (a.IsSelfClosing); + Assert.IsNull (a.NextSibling); + + var b = (XElement)a.FirstChild; + Assert.NotNull (b); + Assert.AreEqual ("b", b.Name.Name); + Assert.True (b.IsEnded); + Assert.False (b.IsSelfClosing); + Assert.IsNull (b.NextSibling); + + var c = (XElement) b.FirstChild; + Assert.NotNull (c); + Assert.AreEqual ("c", c.Name.Name); + Assert.True (c.IsEnded); + Assert.True (c.IsSelfClosing); + Assert.IsNull (c.FirstChild); + + var d = (XElement) c.NextSibling; + Assert.True (d.IsEnded); + Assert.False (d.IsSelfClosing); + Assert.AreEqual ("d", d.Name.Name); + + var e = (XElement) d.FirstChild; + Assert.NotNull (e); + Assert.True (e.IsEnded); + Assert.True (e.IsSelfClosing); + Assert.AreEqual ("e", e.Name.Name); + + var f = (XElement) d.NextSibling; + Assert.AreEqual (f, b.LastChild); + Assert.True (f.IsEnded); + Assert.False (f.IsSelfClosing); + Assert.AreEqual ("f", f.Name.Name); + + var g = (XElement) f.FirstChild; + Assert.NotNull (g); + Assert.True (g.IsEnded); + Assert.True (g.IsSelfClosing); + Assert.AreEqual ("g", g.Name.Name); } } } diff --git a/version-checks b/version-checks index 7df7dd2aac..1173a7a9c3 100755 --- a/version-checks +++ b/version-checks @@ -17,7 +17,7 @@ DEP[0]=md-addins DEP_NAME[0]=MDADDINS DEP_PATH[0]=${top_srcdir}/../md-addins DEP_MODULE[0]=git@github.com:xamarin/md-addins.git -DEP_NEEDED_VERSION[0]=b7f715089882fdc1aab8075aee14ba056bc6601b +DEP_NEEDED_VERSION[0]=0266b1ead2360d405ac8abe9525adbd34d7ed10c DEP_BRANCH_AND_REMOTE[0]="retina origin/retina" # heap-shot |