diff --git a/src/EditorFeatures/Test/MetadataAsSource/DocCommentFormatterTests.cs b/src/EditorFeatures/Test/MetadataAsSource/DocCommentFormatterTests.cs index efe7cff81af0e8d7b87d7325b4cc7a1f509373a6..2f6caf2d13840b0eb2171482bcf69360c9e7de06 100644 --- a/src/EditorFeatures/Test/MetadataAsSource/DocCommentFormatterTests.cs +++ b/src/EditorFeatures/Test/MetadataAsSource/DocCommentFormatterTests.cs @@ -135,6 +135,18 @@ public void Returns() TestFormat(comment, expected); } + [Fact, Trait(Traits.Feature, Traits.Features.MetadataAsSource)] + public void Value() + { + var comment = @"A string value"; + + var expected = +$@"{FeaturesResources.Value_colon} + A string value"; + + TestFormat(comment, expected); + } + [Fact, Trait(Traits.Feature, Traits.Features.MetadataAsSource)] public void SummaryAndParams() { @@ -189,6 +201,7 @@ public void FormatEverything() Another type parameter. This returns nothing. +This has no value. Thrown for an unknown reason Thrown when blah blah blah @@ -219,6 +232,9 @@ public void FormatEverything() {FeaturesResources.Returns_colon} This returns nothing. +{FeaturesResources.Value_colon} + This has no value. + {FeaturesResources.Exceptions_colon} System.GooException: Thrown for an unknown reason diff --git a/src/Features/Core/Portable/FeaturesResources.Designer.cs b/src/Features/Core/Portable/FeaturesResources.Designer.cs index e60d49f059d08284dcf013bcdcf2e15b5c77860b..c425dea746a06a40bdfc239d2b6c41d70ca0cb49 100644 --- a/src/Features/Core/Portable/FeaturesResources.Designer.cs +++ b/src/Features/Core/Portable/FeaturesResources.Designer.cs @@ -4569,6 +4569,15 @@ internal class FeaturesResources { } } + /// + /// Looks up a localized string similar to Value:. + /// + internal static string Value_colon { + get { + return ResourceManager.GetString("Value_colon", resourceCulture); + } + } + /// /// Looks up a localized string similar to Variable declaration can be deconstructed. /// diff --git a/src/Features/Core/Portable/FeaturesResources.resx b/src/Features/Core/Portable/FeaturesResources.resx index 54d212b889e3095ec536f664799cb04610c461f5..0bf967e52a83a9764b4f854fbe1d5cd3ba26b6df 100644 --- a/src/Features/Core/Portable/FeaturesResources.resx +++ b/src/Features/Core/Portable/FeaturesResources.resx @@ -1669,4 +1669,7 @@ This version used in: {2} A type that implements System.IDisposable declares fields that are of types that also implement IDisposable. The Dispose method of the field is not called by the Dispose method of the declaring type. To fix a violation of this rule, call Dispose on fields that are of types that implement IDisposable if you are responsible for allocating and releasing the unmanaged resources held by the field. + + Value: + \ No newline at end of file diff --git a/src/Features/Core/Portable/MetadataAsSource/AbstractMetadataAsSourceService.DocCommentFormatter.cs b/src/Features/Core/Portable/MetadataAsSource/AbstractMetadataAsSourceService.DocCommentFormatter.cs index bfc989f90554c1d31eea186b2f340d72cd709f44..65e481e77944367b5a645e22faf3d891ad9895e4 100644 --- a/src/Features/Core/Portable/MetadataAsSource/AbstractMetadataAsSourceService.DocCommentFormatter.cs +++ b/src/Features/Core/Portable/MetadataAsSource/AbstractMetadataAsSourceService.DocCommentFormatter.cs @@ -20,6 +20,7 @@ internal class DocCommentFormatter private const string s_labelFormat = "{0}:"; private static readonly string s_typeParameterHeader = FeaturesResources.Type_parameters_colon; private static readonly string s_returnsHeader = FeaturesResources.Returns_colon; + private static readonly string s_valueHeader = FeaturesResources.Value_colon; private static readonly string s_exceptionsHeader = FeaturesResources.Exceptions_colon; private static readonly string s_remarksHeader = FeaturesResources.Remarks_colon; @@ -97,6 +98,14 @@ internal static ImmutableArray Format(IDocumentationCommentFormattingSer formattedCommentLinesBuilder.AddRange(CreateWrappedTextFromRawText(formattedReturnsText)); } + var formattedValueText = docCommentFormattingService.Format(docComment.ValueText); + if (!string.IsNullOrWhiteSpace(formattedValueText)) + { + formattedCommentLinesBuilder.Add(string.Empty); + formattedCommentLinesBuilder.Add(s_valueHeader); + formattedCommentLinesBuilder.AddRange(CreateWrappedTextFromRawText(formattedValueText)); + } + var exceptionTypes = docComment.ExceptionTypes; if (exceptionTypes.Length > 0) { diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf index c92f72bb732dbe2b83ce57345e1e78b7a5c9f145..aaa08266f5fbaf28164c0be3e8c0f78e67a3ac6c 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf @@ -527,6 +527,11 @@ Use simple 'using' statement + + Value: + Value: + + Warning: Changing namespace may produce invalid code and change code meaning. Upozornění: Změna oboru názvů může vést k vytvoření neplatného kódu a změnit význam kódu. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf index 6bdcdd6d6baf6f8930e5e89cbe305f55ea5357bf..3fddab186dc56b3cc491885e47800ffb0d76831c 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf @@ -527,6 +527,11 @@ Use simple 'using' statement + + Value: + Value: + + Warning: Changing namespace may produce invalid code and change code meaning. Warnung: Durch die Änderung des Namespaces kann der Code ungültig werden oder seine Bedeutung verändern. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf index 056fcc6690adb3d7d3de645c52c2e007c794a9f0..202da739463e1dc6c5058f4e8adc0f1cf1d2d0b0 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf @@ -527,6 +527,11 @@ Use simple 'using' statement + + Value: + Value: + + Warning: Changing namespace may produce invalid code and change code meaning. Advertencia: si cambia Cambiar el espacio de nombres puede producir código inválido y cambiar el significado del código. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf index cf4022fd5c56745ed196f692dfee2964628d3864..9b9ab0853a2ff35de8c3a89cd996a180b525b888 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf @@ -527,6 +527,11 @@ Use simple 'using' statement + + Value: + Value: + + Warning: Changing namespace may produce invalid code and change code meaning. Avertissement : Le changement d’espace de noms peut produire du code non valide et changer la signification du code. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf index 316e2b682191e025aa8f244fbdf61270b880a15f..501f3344effbdea7d12bec8615a21b7025565e4e 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf @@ -527,6 +527,11 @@ Use simple 'using' statement + + Value: + Value: + + Warning: Changing namespace may produce invalid code and change code meaning. Avviso: la modifica dello spazio dei nomi può comportare la creazione di codice non valido e modificare il significato del codice. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf index 19c0122d9c498ff9ccea8a820e9370b7abe05bd3..108692141eec1c9571232556cee94447d27dc846 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf @@ -527,6 +527,11 @@ Use simple 'using' statement + + Value: + Value: + + Warning: Changing namespace may produce invalid code and change code meaning. 警告: 名前空間を変更すると無効なコードが生成され、コードの意味が変更される可能性があります。 diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf index 8c45e7c45a6cb7dd6d0a76f8f622e5b581f698cf..f47cdfc69e511a5ad0d04cbcc3e8aea299934341 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf @@ -527,6 +527,11 @@ Use simple 'using' statement + + Value: + Value: + + Warning: Changing namespace may produce invalid code and change code meaning. 경고: 네임스페이스를 변경하면 잘못된 코드가 발생하고 코드 의미가 변경될 수 있습니다. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf index a11759fe04ca4a5e1a454a9496ca7a7fba44b0aa..c4657e51305e5a7351dc60020a6396e6d165918c 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf @@ -527,6 +527,11 @@ Use simple 'using' statement + + Value: + Value: + + Warning: Changing namespace may produce invalid code and change code meaning. Ostrzeżenie: Zmiana przestrzeni nazw może skutkować nieprawidłowym kodem i zmianą jego znaczenia. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf index d71cd7aa16ff83befdd261e017ff82c201f7bf1a..de5191d1881210810008d9b9e89dad9fdde93208 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf @@ -527,6 +527,11 @@ Use simple 'using' statement + + Value: + Value: + + Warning: Changing namespace may produce invalid code and change code meaning. Aviso: a alteração do namespace pode produzir código inválido e mudar o significado do código. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf index 04b0ab70c7e2b1d86321445d3a441b4ef9f78f7a..bfad3bd3c056de3c446e9a107767a18b7bb822d4 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf @@ -527,6 +527,11 @@ Use simple 'using' statement + + Value: + Value: + + Warning: Changing namespace may produce invalid code and change code meaning. Предупреждение: изменение пространства имен может привести к появлению недопустимого кода и к изменению значения кода. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf index 48af50c5a7c6d254ab0a3e495241651bf82539ea..2038967a56b03b0f30028b9f8980038a0c706fdf 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf @@ -527,6 +527,11 @@ Use simple 'using' statement + + Value: + Value: + + Warning: Changing namespace may produce invalid code and change code meaning. Uyarı: Ad alanının değiştirilmesi geçersiz kod oluşturabilir ve kodun anlamını değiştirebilir. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf index 934a8784bd9cfe59105e13be1cbf7d2a64d66da2..6197f15dd94de2c185783634623f36def6892910 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf @@ -527,6 +527,11 @@ Use simple 'using' statement + + Value: + Value: + + Warning: Changing namespace may produce invalid code and change code meaning. 警告: 更改命名空间可能会产生无效的代码并更改代码的含义。 diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf index 3f930bfb91bb1d82ead9b3e594a3f3943615575c..c86299f056cf652c3f231da2d6ab9f5af379c1d6 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf @@ -527,6 +527,11 @@ Use simple 'using' statement + + Value: + Value: + + Warning: Changing namespace may produce invalid code and change code meaning. 警告: 變更命名空間可能會產生無效的程式碼及變更程式碼意義。 diff --git a/src/Workspaces/Core/Portable/Shared/Utilities/DocumentationComment.cs b/src/Workspaces/Core/Portable/Shared/Utilities/DocumentationComment.cs index 57361a668ff8107fcef196b94f455826871094fc..af197282a2bef4dfcfdcebc80c4df3c081c4143a 100644 --- a/src/Workspaces/Core/Portable/Shared/Utilities/DocumentationComment.cs +++ b/src/Workspaces/Core/Portable/Shared/Utilities/DocumentationComment.cs @@ -39,6 +39,11 @@ internal sealed class DocumentationComment /// public string ReturnsText { get; private set; } + /// + /// The text in the <value> tag. Null if no tag existed. + /// + public string ValueText { get; private set; } + /// /// The text in the <remarks> tag. Null if no tag existed. /// @@ -182,6 +187,10 @@ private void ParseCallback(XmlReader reader) { _comment.ReturnsText = TrimEachLine(reader.ReadInnerXml()); } + else if (XmlNames.ElementEquals(localName, XmlNames.ValueElementName) && _comment.ValueText == null) + { + _comment.ValueText = TrimEachLine(reader.ReadInnerXml()); + } else if (XmlNames.ElementEquals(localName, XmlNames.RemarksElementName) && _comment.RemarksText == null) { _comment.RemarksText = TrimEachLine(reader.ReadInnerXml()); diff --git a/src/Workspaces/CoreTest/UtilityTest/DocumentationCommentTests.cs b/src/Workspaces/CoreTest/UtilityTest/DocumentationCommentTests.cs index cbf0c9e92f5bc12e4ab35253bb411ec6f2f5a7c4..f35c84fb8e3d12cc0292dd2a13b11a1389731ee6 100644 --- a/src/Workspaces/CoreTest/UtilityTest/DocumentationCommentTests.cs +++ b/src/Workspaces/CoreTest/UtilityTest/DocumentationCommentTests.cs @@ -16,6 +16,7 @@ public void ParseEmptyXmlFragment() Assert.Equal(null, document.ExampleText); Assert.Equal(null, document.ReturnsText); + Assert.Equal(null, document.ValueText); Assert.Equal(null, document.SummaryText); } @@ -25,6 +26,7 @@ public void ParseFullTag() var comment = DocumentationComment.FromXmlFragment( @"Hello, world! 42. + 43. goo.Bar(); A goo. A type. @@ -33,6 +35,7 @@ public void ParseFullTag() Assert.Equal("Hello, world!", comment.SummaryText); Assert.Equal("42.", comment.ReturnsText); + Assert.Equal("43.", comment.ValueText); Assert.Equal("goo.Bar();", comment.ExampleText); Assert.Equal("goo", comment.ParameterNames[0]); Assert.Equal("A goo.", comment.GetParameterText("goo")); @@ -246,6 +249,7 @@ World . string fullXml = $@"{multiLineText} {multiLineText} + {multiLineText} {multiLineText} {multiLineText} {multiLineText} @@ -263,6 +267,7 @@ World . Assert.Equal(expected, comment.SummaryText); Assert.Equal(expected, comment.ReturnsText); + Assert.Equal(expected, comment.ValueText); Assert.Equal(expected, comment.ExampleText); Assert.Equal(expected, comment.GetParameterText("goo")); Assert.Equal(expected, comment.GetTypeParameterText("T"));