diff --git a/.gitattributes b/.gitattributes
index 1ff0c423042b46cb1d617b81efb715defbe8054d..af4907a751a33b31b538eb6fe58fd122e0963833 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,7 +1,7 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
-* text=auto
+* text=auto encoding=UTF-8
###############################################################################
# Set default behavior for command prompt diff.
diff --git a/src/Compilers/Core/Portable/DiagnosticAnalyzer/SymbolDeclaredCompilationEvent.cs b/src/Compilers/Core/Portable/DiagnosticAnalyzer/SymbolDeclaredCompilationEvent.cs
index f5fde150871373bbe99b1fea5310dac9bd7988e9..01db3bd58f62ee8afd3922cf0807d298cacfaa44 100644
--- a/src/Compilers/Core/Portable/DiagnosticAnalyzer/SymbolDeclaredCompilationEvent.cs
+++ b/src/Compilers/Core/Portable/DiagnosticAnalyzer/SymbolDeclaredCompilationEvent.cs
@@ -28,7 +28,7 @@ public SymbolDeclaredCompilationEvent(Compilation compilation, ISymbol symbol, L
///
/// Lockable object only instance is knowledgeable about.
- ///
+ ///
private readonly object _gate = new object();
public SemanticModel SemanticModel(SyntaxReference reference)
diff --git a/src/Diagnostics/FxCop/System.Runtime.Analyzers/VisualBasic/BasicSystemRuntimeAnalyzers.vbproj b/src/Diagnostics/FxCop/System.Runtime.Analyzers/VisualBasic/BasicSystemRuntimeAnalyzers.vbproj
index ede2e04d6cee0c963884fbab0acd933ddc0dc3d4..2f96d92cb436dd64bcc9a56866ce68b7f0e50853 100644
--- a/src/Diagnostics/FxCop/System.Runtime.Analyzers/VisualBasic/BasicSystemRuntimeAnalyzers.vbproj
+++ b/src/Diagnostics/FxCop/System.Runtime.Analyzers/VisualBasic/BasicSystemRuntimeAnalyzers.vbproj
@@ -12,7 +12,7 @@
{D835C05E-9D83-40B2-9D25-19EB652F10D7}
Library
true
- Microsoft.CodeAnalysis.VisualBasic.Analyzers
+ System.Runtime.VisualBasic.Analyzers
{14182A97-F7F0-4C62-8B27-98AA8AE2109A};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}
Profile7
.NETPortable
diff --git a/src/EditorFeatures/CSharp/SignatureHelp/AbstractCSharpSignatureHelpProvider.cs b/src/EditorFeatures/CSharp/SignatureHelp/AbstractCSharpSignatureHelpProvider.cs
index e27c9658742c9704ebb0498396f72a10ca02c178..1fbf06fe7d0b61b41c05cff56e1ff1b0c7c4e442 100644
--- a/src/EditorFeatures/CSharp/SignatureHelp/AbstractCSharpSignatureHelpProvider.cs
+++ b/src/EditorFeatures/CSharp/SignatureHelp/AbstractCSharpSignatureHelpProvider.cs
@@ -61,7 +61,7 @@ protected static IEnumerable GetSeparatorParts()
return new SignatureHelpParameter(
parameter.Name,
parameter.IsOptional,
- parameter.GetDocumentationParts(semanticModel, position, formatter, cancellationToken),
+ parameter.GetDocumentationPartsFactory(semanticModel, position, formatter),
parameter.ToMinimalDisplayParts(semanticModel, position));
}
diff --git a/src/EditorFeatures/CSharp/SignatureHelp/AttributeSignatureHelpProvider.cs b/src/EditorFeatures/CSharp/SignatureHelp/AttributeSignatureHelpProvider.cs
index 5a4d8e0412ec002e0e4bf9bd70d1ef3db91a38ee..ce9a16e68c51325436259512d9254d278ce87178 100644
--- a/src/EditorFeatures/CSharp/SignatureHelp/AttributeSignatureHelpProvider.cs
+++ b/src/EditorFeatures/CSharp/SignatureHelp/AttributeSignatureHelpProvider.cs
@@ -135,7 +135,7 @@ public override SignatureHelpState GetCurrentArgumentState(SyntaxNode root, int
constructor, semanticModel, position,
symbolDisplayService, anonymousTypeDisplayService,
isVariadic,
- constructor.GetDocumentationParts(semanticModel, position, documentationCommentFormatter, cancellationToken),
+ constructor.GetDocumentationPartsFactory(semanticModel, position, documentationCommentFormatter),
GetPreambleParts(constructor, semanticModel, position),
GetSeparatorParts(),
GetPostambleParts(constructor),
@@ -158,6 +158,8 @@ public override SignatureHelpState GetCurrentArgumentState(SyntaxNode root, int
for (int i = 0; i < namedParameters.Count; i++)
{
+ cancellationToken.ThrowIfCancellationRequested();
+
var namedParameter = namedParameters[i];
var type = namedParameter is IFieldSymbol ? ((IFieldSymbol)namedParameter).Type : ((IPropertySymbol)namedParameter).Type;
@@ -175,7 +177,7 @@ public override SignatureHelpState GetCurrentArgumentState(SyntaxNode root, int
yield return new SignatureHelpParameter(
namedParameter.Name,
isOptional: true,
- documentation: namedParameter.GetDocumentationParts(semanticModel, position, documentationCommentFormatter, cancellationToken),
+ documentationFactory: namedParameter.GetDocumentationPartsFactory(semanticModel, position, documentationCommentFormatter),
displayParts: displayParts,
prefixDisplayParts: GetParameterPrefixDisplayParts(i));
}
diff --git a/src/EditorFeatures/CSharp/SignatureHelp/ConstructorInitializerSignatureHelpProvider.cs b/src/EditorFeatures/CSharp/SignatureHelp/ConstructorInitializerSignatureHelpProvider.cs
index 8f3990bf56cb8366b5dda49248f3c9e0ced58063..5ae886cee5e8d7bcc155da6cf0c23f281eb063c2 100644
--- a/src/EditorFeatures/CSharp/SignatureHelp/ConstructorInitializerSignatureHelpProvider.cs
+++ b/src/EditorFeatures/CSharp/SignatureHelp/ConstructorInitializerSignatureHelpProvider.cs
@@ -135,7 +135,7 @@ public override SignatureHelpState GetCurrentArgumentState(SyntaxNode root, int
constructor, semanticModel, position,
symbolDisplayService, anonymousTypeDisplayService,
constructor.IsParams(),
- constructor.GetDocumentationParts(semanticModel, position, documentationCommentFormattingService, cancellationToken),
+ constructor.GetDocumentationPartsFactory(semanticModel, position, documentationCommentFormattingService),
GetPreambleParts(constructor, semanticModel, position),
GetSeparatorParts(),
GetPostambleParts(constructor),
diff --git a/src/EditorFeatures/CSharp/SignatureHelp/ElementAccessExpressionSignatureHelpProvider.cs b/src/EditorFeatures/CSharp/SignatureHelp/ElementAccessExpressionSignatureHelpProvider.cs
index a9f21faee110a303d3863e9a5c4db8f31310329a..13051f4d885c7641de14a2d0d8ca9d2c0d740a68 100644
--- a/src/EditorFeatures/CSharp/SignatureHelp/ElementAccessExpressionSignatureHelpProvider.cs
+++ b/src/EditorFeatures/CSharp/SignatureHelp/ElementAccessExpressionSignatureHelpProvider.cs
@@ -200,7 +200,7 @@ private bool TryGetIndexers(int position, SemanticModel semanticModel, Expressio
var item = CreateItem(indexer, semanticModel, position,
symbolDisplayService, anonymousTypeDisplayService,
indexer.IsParams(),
- indexer.GetDocumentationParts(semanticModel, position, documentationCommentFormattingService, cancellationToken),
+ indexer.GetDocumentationPartsFactory(semanticModel, position, documentationCommentFormattingService),
GetPreambleParts(indexer, position, semanticModel),
GetSeparatorParts(),
GetPostambleParts(indexer),
diff --git a/src/EditorFeatures/CSharp/SignatureHelp/GenericNameSignatureHelpProvider.cs b/src/EditorFeatures/CSharp/SignatureHelp/GenericNameSignatureHelpProvider.cs
index 73601f6177f7e49a6c1d9d271e62055f0e110238..0bd3b17dc28773cf6591eeed91364e83cd5798b8 100644
--- a/src/EditorFeatures/CSharp/SignatureHelp/GenericNameSignatureHelpProvider.cs
+++ b/src/EditorFeatures/CSharp/SignatureHelp/GenericNameSignatureHelpProvider.cs
@@ -183,7 +183,7 @@ protected virtual TextSpan GetTextSpan(SyntaxToken genericIdentifier, SyntaxToke
symbol, semanticModel, position,
symbolDisplayService, anonymousTypeDisplayService,
false,
- symbol.GetDocumentationParts(semanticModel, position, documentationCommentFormattingService, cancellationToken),
+ symbol.GetDocumentationPartsFactory(semanticModel, position, documentationCommentFormattingService),
GetPreambleParts(namedType, semanticModel, position),
GetSeparatorParts(),
GetPostambleParts(namedType),
@@ -196,7 +196,7 @@ protected virtual TextSpan GetTextSpan(SyntaxToken genericIdentifier, SyntaxToke
symbol, semanticModel, position,
symbolDisplayService, anonymousTypeDisplayService,
false,
- symbol.GetDocumentationParts(semanticModel, position, documentationCommentFormattingService, cancellationToken).Concat(GetAwaitableUsage(method, semanticModel, position)),
+ c => symbol.GetDocumentationParts(semanticModel, position, documentationCommentFormattingService, c).Concat(GetAwaitableUsage(method, semanticModel, position)),
GetPreambleParts(method, semanticModel, position),
GetSeparatorParts(),
GetPostambleParts(method, semanticModel, position),
@@ -220,7 +220,7 @@ protected virtual TextSpan GetTextSpan(SyntaxToken genericIdentifier, SyntaxToke
return new SignatureHelpParameter(
parameter.Name,
isOptional: false,
- documentation: parameter.GetDocumentationParts(semanticModel, position, formatter, cancellationToken),
+ documentationFactory: parameter.GetDocumentationPartsFactory(semanticModel, position, formatter),
displayParts: parameter.ToMinimalDisplayParts(semanticModel, position, s_minimallyQualifiedFormat),
selectedDisplayParts: GetSelectedDisplayParts(parameter, semanticModel, position, cancellationToken));
}
diff --git a/src/EditorFeatures/CSharp/SignatureHelp/InvocationExpressionSignatureHelpProvider_DelegateInvoke.cs b/src/EditorFeatures/CSharp/SignatureHelp/InvocationExpressionSignatureHelpProvider_DelegateInvoke.cs
index d27292b911040fa3cdd7c2cb4c0ea40ae7b19951..055c6526b08fa75546e757f5e7a71378c1a67cf9 100644
--- a/src/EditorFeatures/CSharp/SignatureHelp/InvocationExpressionSignatureHelpProvider_DelegateInvoke.cs
+++ b/src/EditorFeatures/CSharp/SignatureHelp/InvocationExpressionSignatureHelpProvider_DelegateInvoke.cs
@@ -37,7 +37,7 @@ internal partial class InvocationExpressionSignatureHelpProvider
invokeMethod, semanticModel, position,
symbolDisplayService, anonymousTypeDisplayService,
isVariadic: invokeMethod.IsParams(),
- documentation: SpecializedCollections.EmptyEnumerable(),
+ documentationFactory: null,
prefixParts: GetDelegateInvokePreambleParts(invokeMethod, semanticModel, position),
separatorParts: GetSeparatorParts(),
suffixParts: GetDelegateInvokePostambleParts(),
@@ -62,10 +62,11 @@ private IEnumerable GetDelegateInvokePreambleParts(IMethodSym
{
foreach (var parameter in invokeMethod.Parameters)
{
+ cancellationToken.ThrowIfCancellationRequested();
yield return new SignatureHelpParameter(
parameter.Name,
parameter.IsOptional,
- parameter.GetDocumentationParts(semanticModel, position, formattingService, cancellationToken),
+ parameter.GetDocumentationPartsFactory(semanticModel, position, formattingService),
parameter.ToMinimalDisplayParts(semanticModel, position));
}
}
diff --git a/src/EditorFeatures/CSharp/SignatureHelp/InvocationExpressionSignatureHelpProvider_MethodGroup.cs b/src/EditorFeatures/CSharp/SignatureHelp/InvocationExpressionSignatureHelpProvider_MethodGroup.cs
index e279e20ee871d168a46b55f19ff3eb90139aebbf..ace33c3afa21e8b0b9e838da7b8956880260466b 100644
--- a/src/EditorFeatures/CSharp/SignatureHelp/InvocationExpressionSignatureHelpProvider_MethodGroup.cs
+++ b/src/EditorFeatures/CSharp/SignatureHelp/InvocationExpressionSignatureHelpProvider_MethodGroup.cs
@@ -108,7 +108,7 @@ private bool IsHiddenBy(IMethodSymbol method1, IMethodSymbol method2)
method, semanticModel, position,
symbolDisplayService, anonymousTypeDisplayService,
method.IsParams(),
- method.OriginalDefinition.GetDocumentationParts(semanticModel, position, documentationCommentFormattingService, cancellationToken).Concat(GetAwaitableUsage(method, semanticModel, position)),
+ c => method.OriginalDefinition.GetDocumentationParts(semanticModel, position, documentationCommentFormattingService, c).Concat(GetAwaitableUsage(method, semanticModel, position)),
GetMethodGroupPreambleParts(method, semanticModel, position),
GetSeparatorParts(),
GetMethodGroupPostambleParts(method),
diff --git a/src/EditorFeatures/CSharp/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider_DelegateType.cs b/src/EditorFeatures/CSharp/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider_DelegateType.cs
index 86d624cba9c7783cc58dfa9253cab4b82dcf637d..acbb99aade86d3cd37605a0570289e381a8af5ef 100644
--- a/src/EditorFeatures/CSharp/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider_DelegateType.cs
+++ b/src/EditorFeatures/CSharp/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider_DelegateType.cs
@@ -32,7 +32,7 @@ internal partial class ObjectCreationExpressionSignatureHelpProvider
invokeMethod, semanticModel, position,
symbolDisplayService, anonymousTypeDispalyService,
isVariadic: false,
- documentation: SpecializedCollections.EmptyEnumerable(),
+ documentationFactory: null,
prefixParts: GetDelegateTypePreambleParts(invokeMethod, semanticModel, position),
separatorParts: GetSeparatorParts(),
suffixParts: GetDelegateTypePostambleParts(invokeMethod),
@@ -80,7 +80,7 @@ private IEnumerable GetDelegateTypeParameters(IMethodSym
yield return new SignatureHelpParameter(
TargetName,
isOptional: false,
- documentation: SpecializedCollections.EmptyEnumerable(),
+ documentationFactory: null,
displayParts: parts);
}
diff --git a/src/EditorFeatures/CSharp/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider_NormalType.cs b/src/EditorFeatures/CSharp/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider_NormalType.cs
index c473c82cb2ae16c5a9d76a045d3f43c0aa783e3a..69d50ed346472c606d043062a215940d52833082 100644
--- a/src/EditorFeatures/CSharp/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider_NormalType.cs
+++ b/src/EditorFeatures/CSharp/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider_NormalType.cs
@@ -56,7 +56,7 @@ internal partial class ObjectCreationExpressionSignatureHelpProvider
constructor, semanticModel, position,
symbolDisplayService, anonymousTypeDisplayService,
constructor.IsParams(),
- constructor.GetDocumentationParts(semanticModel, position, documentationCommentFormattingService, cancellationToken),
+ constructor.GetDocumentationPartsFactory(semanticModel, position, documentationCommentFormattingService),
GetNormalTypePreambleParts(constructor, semanticModel, position),
GetSeparatorParts(),
GetNormalTypePostambleParts(constructor),
diff --git a/src/EditorFeatures/Core/Extensibility/SignatureHelp/SignatureHelpItem.cs b/src/EditorFeatures/Core/Extensibility/SignatureHelp/SignatureHelpItem.cs
index 1f2119ef19b7e6532787757cea6ae846ac397407..965c8a5af5cba7fcc87a5f73d95bee9b909c77c9 100644
--- a/src/EditorFeatures/Core/Extensibility/SignatureHelp/SignatureHelpItem.cs
+++ b/src/EditorFeatures/Core/Extensibility/SignatureHelp/SignatureHelpItem.cs
@@ -2,7 +2,9 @@
using System;
using System.Collections.Generic;
+using System.Collections.Immutable;
using System.Linq;
+using System.Threading;
using Microsoft.CodeAnalysis;
using Roslyn.Utilities;
@@ -16,25 +18,26 @@ internal class SignatureHelpItem
/// selected parameter index strictly goes past the number of defined parameters for this
/// item.
///
- public bool IsVariadic { get; private set; }
+ public bool IsVariadic { get; }
- public IList PrefixDisplayParts { get; private set; }
- public IList SuffixDisplayParts { get; private set; }
+ public ImmutableArray PrefixDisplayParts { get; }
+ public ImmutableArray SuffixDisplayParts { get; }
- // TODO(cyrusn): This probably won't be sufficient for VB query signature help. It has
+ // TODO: This probably won't be sufficient for VB query signature help. It has
// arbitrary separators between parameters.
- public IList SeparatorDisplayParts { get; private set; }
+ public ImmutableArray SeparatorDisplayParts { get; }
- public IList Parameters { get; private set; }
+ public ImmutableArray Parameters { get; }
- public IList DescriptionParts { get; internal set; }
+ public ImmutableArray DescriptionParts { get; internal set; }
- // TODO(cyrusn): This may be unnecessary. How would a user ever see this.
- public IList Documentation { get; set; }
+ public Func> DocumenationFactory { get; }
+
+ private static readonly Func> s_emptyDocumentationFactory = _ => SpecializedCollections.EmptyEnumerable();
public SignatureHelpItem(
bool isVariadic,
- IEnumerable documentation,
+ Func> documentationFactory,
IEnumerable prefixParts,
IEnumerable separatorParts,
IEnumerable suffixParts,
@@ -47,7 +50,7 @@ internal class SignatureHelpItem
}
this.IsVariadic = isVariadic;
- this.Documentation = documentation.ToImmutableArrayOrEmpty();
+ this.DocumenationFactory = documentationFactory ?? s_emptyDocumentationFactory;
this.PrefixDisplayParts = prefixParts.ToImmutableArrayOrEmpty();
this.SeparatorDisplayParts = separatorParts.ToImmutableArrayOrEmpty();
this.SuffixDisplayParts = suffixParts.ToImmutableArrayOrEmpty();
diff --git a/src/EditorFeatures/Core/Extensibility/SignatureHelp/SignatureHelpParameter.cs b/src/EditorFeatures/Core/Extensibility/SignatureHelp/SignatureHelpParameter.cs
index 97f779f4f79eaa29134dd5b62c64e4607d67ac88..8777dbfc0e4abe13c527ebe516aadf6d13f10246 100644
--- a/src/EditorFeatures/Core/Extensibility/SignatureHelp/SignatureHelpParameter.cs
+++ b/src/EditorFeatures/Core/Extensibility/SignatureHelp/SignatureHelpParameter.cs
@@ -1,9 +1,10 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+using System;
using System.Collections.Generic;
using System.Linq;
+using System.Threading;
using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.Shared.Extensions;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Editor
@@ -13,46 +14,48 @@ internal class SignatureHelpParameter
///
/// The name of this parameter.
///
- public string Name { get; private set; }
+ public string Name { get; }
///
/// Documentation for this parameter. This should normally be presented to the user when
/// this parameter is selected.
///
- public IList Documentation { get; private set; }
+ public Func> DocumentationFactory { get; }
///
/// Display parts to show before the normal display parts for the parameter.
///
- public IList PrefixDisplayParts { get; private set; }
+ public IList PrefixDisplayParts { get; }
///
/// Display parts to show after the normal display parts for the parameter.
///
- public IList SuffixDisplayParts { get; private set; }
+ public IList SuffixDisplayParts { get; }
///
/// Display parts for this parameter. This should normally be presented to the user as part
/// of the entire signature display.
///
- public IList DisplayParts { get; private set; }
+ public IList DisplayParts { get; }
///
/// True if this parameter is optional or not. Optional parameters may be presented in a
/// different manner to users.
///
- public bool IsOptional { get; private set; }
+ public bool IsOptional { get; }
///
/// Display parts for this parameter that should be presented to the user when this
/// parameter is selected.
///
- public IList SelectedDisplayParts { get; private set; }
+ public IList SelectedDisplayParts { get; }
+
+ private static readonly Func> s_emptyDocumentationFactory = _ => SpecializedCollections.EmptyEnumerable();
public SignatureHelpParameter(
string name,
bool isOptional,
- IEnumerable documentation,
+ Func> documentationFactory,
IEnumerable displayParts,
IEnumerable prefixDisplayParts = null,
IEnumerable suffixDisplayParts = null,
@@ -60,7 +63,7 @@ internal class SignatureHelpParameter
{
this.Name = name ?? string.Empty;
this.IsOptional = isOptional;
- this.Documentation = documentation.ToImmutableArrayOrEmpty();
+ this.DocumentationFactory = documentationFactory ?? s_emptyDocumentationFactory;
this.DisplayParts = displayParts.ToImmutableArrayOrEmpty();
this.PrefixDisplayParts = prefixDisplayParts.ToImmutableArrayOrEmpty();
this.SuffixDisplayParts = suffixDisplayParts.ToImmutableArrayOrEmpty();
diff --git a/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/AbstractSignatureHelpProvider.SymbolKeySignatureHelpItem.cs b/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/AbstractSignatureHelpProvider.SymbolKeySignatureHelpItem.cs
index 886a9360bd546b96665b10d86c9ccc1f83264612..db90b3cfe31df488ea4eac00967f1c274c3396d6 100644
--- a/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/AbstractSignatureHelpProvider.SymbolKeySignatureHelpItem.cs
+++ b/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/AbstractSignatureHelpProvider.SymbolKeySignatureHelpItem.cs
@@ -2,9 +2,7 @@
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using System.Threading;
namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp
{
@@ -12,17 +10,17 @@ internal abstract partial class AbstractSignatureHelpProvider
{
internal class SymbolKeySignatureHelpItem : SignatureHelpItem, IEquatable
{
- public SymbolKey SymbolKey { get; private set; }
+ public SymbolKey SymbolKey { get; }
public SymbolKeySignatureHelpItem(
ISymbol symbol,
bool isVariadic,
- IEnumerable documentation,
+ Func> documentationFactory,
IEnumerable prefixParts,
IEnumerable separatorParts,
IEnumerable suffixParts,
IEnumerable parameters,
- IEnumerable descriptionParts) : base(isVariadic, documentation, prefixParts, separatorParts, suffixParts, parameters, descriptionParts)
+ IEnumerable descriptionParts) : base(isVariadic, documentationFactory, prefixParts, separatorParts, suffixParts, parameters, descriptionParts)
{
this.SymbolKey = symbol == null ? null : symbol.GetSymbolKey();
}
diff --git a/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/AbstractSignatureHelpProvider.cs b/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/AbstractSignatureHelpProvider.cs
index 0c933caea15bd4e8787af68da85d1da60dfdea54..835eac1ba0655ababfa65fbac18f963fe0276329 100644
--- a/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/AbstractSignatureHelpProvider.cs
+++ b/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/AbstractSignatureHelpProvider.cs
@@ -75,7 +75,7 @@ public async Task GetCurrentArgumentStateAsync(Document docu
ISymbolDisplayService symbolDisplayService,
IAnonymousTypeDisplayService anonymousTypeDisplayService,
bool isVariadic,
- IEnumerable documentation,
+ Func> documentationFactory,
IEnumerable prefixParts,
IEnumerable separatorParts,
IEnumerable suffixParts,
@@ -83,7 +83,7 @@ public async Task GetCurrentArgumentStateAsync(Document docu
IEnumerable descriptionParts = null)
{
var item = new SymbolKeySignatureHelpItem(
- orderSymbol, isVariadic, documentation, prefixParts, separatorParts,
+ orderSymbol, isVariadic, documentationFactory, prefixParts, separatorParts,
suffixParts, parameters, descriptionParts);
return FixAnonymousTypeParts(orderSymbol, item, semanticModel, position, symbolDisplayService, anonymousTypeDisplayService);
@@ -93,7 +93,7 @@ public async Task GetCurrentArgumentStateAsync(Document docu
ISymbol orderSymbol, SignatureHelpItem item, SemanticModel semanticModel, int position, ISymbolDisplayService symbolDisplayService, IAnonymousTypeDisplayService anonymousTypeDisplayService)
{
var currentItem = new SymbolKeySignatureHelpItem(
- orderSymbol, item.IsVariadic, item.Documentation,
+ orderSymbol, item.IsVariadic, item.DocumenationFactory,
anonymousTypeDisplayService.InlineDelegateAnonymousTypes(item.PrefixDisplayParts, semanticModel, position, symbolDisplayService),
anonymousTypeDisplayService.InlineDelegateAnonymousTypes(item.SeparatorDisplayParts, semanticModel, position, symbolDisplayService),
anonymousTypeDisplayService.InlineDelegateAnonymousTypes(item.SuffixDisplayParts, semanticModel, position, symbolDisplayService),
@@ -120,7 +120,7 @@ where part.Symbol.IsNormalAnonymousType()
currentItem = new SymbolKeySignatureHelpItem(
orderSymbol,
currentItem.IsVariadic,
- currentItem.Documentation,
+ currentItem.DocumenationFactory,
info.ReplaceAnonymousTypes(currentItem.PrefixDisplayParts),
info.ReplaceAnonymousTypes(currentItem.SeparatorDisplayParts),
info.ReplaceAnonymousTypes(currentItem.SuffixDisplayParts),
@@ -138,7 +138,7 @@ where part.Symbol.IsNormalAnonymousType()
return new SignatureHelpParameter(
parameter.Name,
parameter.IsOptional,
- parameter.Documentation,
+ parameter.DocumentationFactory,
info.ReplaceAnonymousTypes(parameter.DisplayParts),
info.ReplaceAnonymousTypes(parameter.SelectedDisplayParts));
}
@@ -153,7 +153,7 @@ where part.Symbol.IsNormalAnonymousType()
return new SignatureHelpParameter(
parameter.Name,
parameter.IsOptional,
- parameter.Documentation,
+ parameter.DocumentationFactory,
anonymousTypeDisplayService.InlineDelegateAnonymousTypes(parameter.DisplayParts, semanticModel, position, symbolDisplayService),
anonymousTypeDisplayService.InlineDelegateAnonymousTypes(parameter.PrefixDisplayParts, semanticModel, position, symbolDisplayService),
anonymousTypeDisplayService.InlineDelegateAnonymousTypes(parameter.SuffixDisplayParts, semanticModel, position, symbolDisplayService),
@@ -256,7 +256,7 @@ private SignatureHelpItem UpdateItem(SignatureHelpItem item, SupportedPlatformDa
? item.DescriptionParts.Concat(startingNewLine.Concat(platformParts))
: startingNewLine.Concat(platformParts);
- item.DescriptionParts = updatedDescription.ToList();
+ item.DescriptionParts = updatedDescription.ToImmutableArrayOrEmpty();
return item;
}
diff --git a/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/Controller.Session_UpdateModel.cs b/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/Controller.Session_UpdateModel.cs
index 094b7adc7b39d12e96059ac8fcefacd40051e485..796549ea67f82b97882e9d6508fe28265ddea87e 100644
--- a/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/Controller.Session_UpdateModel.cs
+++ b/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/Controller.Session_UpdateModel.cs
@@ -95,7 +95,7 @@ private static int GetSelectedParameter(SignatureHelpItem bestItem, int paramete
// If we don't have an item that can take that number of parameters, then just pick
// the last item. Or stick with the current item if the last item isn't any better.
var lastItem = filteredItems.Last();
- if (currentItem.IsVariadic || currentItem.Parameters.Count == lastItem.Parameters.Count)
+ if (currentItem.IsVariadic || currentItem.Parameters.Length == lastItem.Parameters.Length)
{
return currentItem;
}
@@ -117,7 +117,7 @@ private static bool IsApplicable(SignatureHelpItem item, int argumentCount, stri
// parameter index. i.e. if it has 2 parameters and we're at index 0 or 1 then it's
// applicable. However, if it has 2 parameters and we're at index 2, then it's not
// applicable.
- if (item.Parameters.Count >= argumentCount)
+ if (item.Parameters.Length >= argumentCount)
{
return true;
}
diff --git a/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/Presentation/Parameter.cs b/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/Presentation/Parameter.cs
index 9eff8b3c08a0f4ced2ea5a1d95b368c504cbee8a..cfea61d1168766d77f465ae78c6011bfe89f3511 100644
--- a/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/Presentation/Parameter.cs
+++ b/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/Presentation/Parameter.cs
@@ -1,5 +1,6 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+using System.Threading;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Text;
@@ -8,11 +9,17 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHel
{
internal class Parameter : IParameter
{
- public string Documentation { get; internal set; }
- public string Name { get; internal set; }
- public Span Locus { get; internal set; }
- public Span PrettyPrintedLocus { get; internal set; }
- public ISignature Signature { get; internal set; }
+ private readonly SignatureHelpParameter _parameter;
+ private string _documentation;
+ private readonly int _contentLength;
+ private readonly int _index;
+ private readonly int _prettyPrintedIndex;
+
+ public string Documentation => _documentation ?? (_documentation = _parameter.DocumentationFactory(CancellationToken.None).GetFullText());
+ public string Name => _parameter.Name;
+ public Span Locus => new Span(_index, _contentLength);
+ public Span PrettyPrintedLocus => new Span(_prettyPrintedIndex, _contentLength);
+ public ISignature Signature { get; }
public Parameter(
Signature signature,
@@ -21,12 +28,11 @@ internal class Parameter : IParameter
int index,
int prettyPrintedIndex)
{
+ _parameter = parameter;
this.Signature = signature;
- this.Name = parameter.Name;
- this.Documentation = parameter.Documentation.GetFullText();
-
- this.Locus = new Span(index, content.Length);
- this.PrettyPrintedLocus = new Span(prettyPrintedIndex, content.Length);
+ _contentLength = content.Length;
+ _index = index;
+ _prettyPrintedIndex = prettyPrintedIndex;
}
}
}
diff --git a/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/Presentation/Signature.cs b/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/Presentation/Signature.cs
index 1b972480d6891d284b70d46d426e79b29eac1085..cf9449dbd44ecb815dc05e71b9ae0a1dfce64052 100644
--- a/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/Presentation/Signature.cs
+++ b/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/Presentation/Signature.cs
@@ -1,6 +1,7 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
+using System.Linq;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
@@ -8,6 +9,7 @@
using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Text;
using Roslyn.Utilities;
+using System.Threading;
namespace Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.SignatureHelp.Presentation
{
@@ -16,26 +18,91 @@ internal class Signature : ISignature
private const int MaxParamColumnCount = 100;
private readonly SignatureHelpItem _signatureHelpItem;
- private IParameter _currentParameter;
- internal IList DisplayParts { get; private set; }
- private IList _prettyPrintedDisplayParts;
-
- public ITrackingSpan ApplicableToSpan { get; internal set; }
- public string Content { get; private set; }
- public string PrettyPrintedContent { get; private set; }
- public ReadOnlyCollection Parameters { get; private set; }
- public string Documentation { get; private set; }
-
- public event EventHandler CurrentParameterChanged;
- public Signature(ITrackingSpan applicableToSpan, SignatureHelpItem signatureHelpItem)
+ public Signature(ITrackingSpan applicableToSpan, SignatureHelpItem signatureHelpItem, int selectedParameterIndex)
{
+ if (selectedParameterIndex < -1 || selectedParameterIndex >= signatureHelpItem.Parameters.Length)
+ {
+ throw new ArgumentOutOfRangeException(nameof(selectedParameterIndex));
+ }
+
this.ApplicableToSpan = applicableToSpan;
_signatureHelpItem = signatureHelpItem;
- this.Initialize(setParameters: true);
+ _parameterIndex = selectedParameterIndex;
+ }
+
+ private bool _isInitialized;
+ private void EnsureInitialized()
+ {
+ if (!_isInitialized)
+ {
+ _isInitialized = true;
+ Initialize();
+ }
+ }
+
+ private Signature InitializedThis
+ {
+ get
+ {
+ EnsureInitialized();
+ return this;
+ }
+ }
+
+ private IList _displayParts;
+ internal IList DisplayParts => InitializedThis._displayParts;
+
+ public ITrackingSpan ApplicableToSpan { get; }
+
+ private string _content;
+ public string Content => InitializedThis._content;
+
+ private int _parameterIndex = -1;
+ public IParameter CurrentParameter
+ {
+ get
+ {
+ EnsureInitialized();
+ return _parameterIndex >= 0 && _parameters != null ? _parameters[_parameterIndex] : null;
+ }
}
- private void Initialize(bool setParameters)
+ public string Documentation => null;
+
+ private ReadOnlyCollection _parameters;
+ public ReadOnlyCollection Parameters => InitializedThis._parameters;
+
+ private string _prettyPrintedContent;
+ public string PrettyPrintedContent => InitializedThis._prettyPrintedContent;
+
+ // This event is required by the ISignature interface but it's not actually used
+ // (once created the CurrentParameter property cannot change)
+ public event EventHandler CurrentParameterChanged
+ {
+ add
+ {
+ }
+ remove
+ {
+ }
+ }
+
+ private IList _prettyPrintedDisplayParts;
+ internal IList PrettyPrintedDisplayParts
+ {
+ get
+ {
+ return InitializedThis._prettyPrintedDisplayParts;
+ }
+
+ set
+ {
+ _prettyPrintedDisplayParts = value;
+ }
+ }
+
+ private void Initialize()
{
var content = new StringBuilder();
var prettyPrintedContent = new StringBuilder();
@@ -61,7 +128,7 @@ private void Initialize(bool setParameters)
var paramColumnCount = 0;
- for (int i = 0; i < _signatureHelpItem.Parameters.Count; i++)
+ for (int i = 0; i < _signatureHelpItem.Parameters.Length; i++)
{
var sigHelpParameter = _signatureHelpItem.Parameters[i];
@@ -107,9 +174,9 @@ private void Initialize(bool setParameters)
AddRange(_signatureHelpItem.SuffixDisplayParts, parts, prettyPrintedParts);
Append(_signatureHelpItem.SuffixDisplayParts.GetFullText(), content, prettyPrintedContent);
- if (_currentParameter != null)
+ if (_parameterIndex >= 0)
{
- var sigHelpParameter = _signatureHelpItem.Parameters[this.Parameters.IndexOf(_currentParameter)];
+ var sigHelpParameter = _signatureHelpItem.Parameters[_parameterIndex];
AddRange(sigHelpParameter.SelectedDisplayParts, parts, prettyPrintedParts);
Append(sigHelpParameter.SelectedDisplayParts.GetFullText(), content, prettyPrintedContent);
@@ -118,24 +185,21 @@ private void Initialize(bool setParameters)
AddRange(_signatureHelpItem.DescriptionParts, parts, prettyPrintedParts);
Append(_signatureHelpItem.DescriptionParts.GetFullText(), content, prettyPrintedContent);
- if (_signatureHelpItem.Documentation.Count > 0)
+ var documentation = _signatureHelpItem.DocumenationFactory(CancellationToken.None).ToList();
+ if (documentation.Count > 0)
{
AddRange(new[] { newLinePart }, parts, prettyPrintedParts);
Append(newLineContent, content, prettyPrintedContent);
- AddRange(_signatureHelpItem.Documentation, parts, prettyPrintedParts);
- Append(_signatureHelpItem.Documentation.GetFullText(), content, prettyPrintedContent);
+ AddRange(documentation, parts, prettyPrintedParts);
+ Append(documentation.GetFullText(), content, prettyPrintedContent);
}
- this.Content = content.ToString();
- this.PrettyPrintedContent = prettyPrintedContent.ToString();
- this.DisplayParts = parts.ToImmutableArrayOrEmpty();
- this.PrettyPrintedDisplayParts = prettyPrintedParts.ToImmutableArrayOrEmpty();
-
- if (setParameters)
- {
- this.Parameters = parameters.ToReadOnlyCollection();
- }
+ _content = content.ToString();
+ _prettyPrintedContent = prettyPrintedContent.ToString();
+ _displayParts = parts.ToImmutableArrayOrEmpty();
+ _prettyPrintedDisplayParts = prettyPrintedParts.ToImmutableArrayOrEmpty();
+ _parameters = parameters.ToReadOnlyCollection();
}
private void AddRange(IList values, List parts, List prettyPrintedParts)
@@ -163,45 +227,5 @@ private IList AddOptionalBrackets(bool isOptional, IList PrettyPrintedDisplayParts
- {
- get
- {
- return _prettyPrintedDisplayParts;
- }
-
- set
- {
- _prettyPrintedDisplayParts = value;
- }
- }
}
}
diff --git a/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/Presentation/SignatureHelpPresenter.SignatureHelpPresenterSession.cs b/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/Presentation/SignatureHelpPresenter.SignatureHelpPresenterSession.cs
index 61ae79f84b042333e3bc2e97f2d5360d9fb141b3..9075ebf25ad1f2709504a39c1181c5d2b3cf5fe3 100644
--- a/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/Presentation/SignatureHelpPresenter.SignatureHelpPresenterSession.cs
+++ b/src/EditorFeatures/Core/Implementation/IntelliSense/SignatureHelp/Presentation/SignatureHelpPresenter.SignatureHelpPresenterSession.cs
@@ -116,45 +116,30 @@ private class SignatureHelpPresenterSession : ForegroundThreadAffinitizedObject,
foreach (var item in _signatureHelpItems)
{
- _signatureMap = _signatureMap.Add(item, new Signature(triggerSpan, item));
- }
-
- this.SetCurrentParameterForAllItems(selectedParameter);
- }
-
- private void SetCurrentParameterForAllItems(int? selectedParameter)
- {
- foreach (var item in _signatureHelpItems)
- {
- this.SetCurrentParameter(item, selectedParameter);
+ _signatureMap = _signatureMap.Add(item, new Signature(triggerSpan, item, GetParameterIndexForItem(item, selectedParameter)));
}
}
- private void SetCurrentParameter(SignatureHelpItem item, int? selectedParameter)
+ private static int GetParameterIndexForItem(SignatureHelpItem item, int? selectedParameter)
{
- Contract.ThrowIfFalse(_signatureMap.ContainsKey(item));
- var signature = _signatureMap.GetValueOrDefault(item);
-
if (selectedParameter.HasValue)
{
- if (selectedParameter.Value < item.Parameters.Count)
+ if (selectedParameter.Value < item.Parameters.Length)
{
// If the selected parameter is within the range of parameters of this item then set
// that as the current parameter.
- signature.CurrentParameter = signature.Parameters[selectedParameter.Value];
- return;
+ return selectedParameter.Value;
}
else if (item.IsVariadic)
{
- // It wasn't in range, but the item takes an unlmiited number of parameters. So
+ // It wasn't in range, but the item takes an unlimited number of parameters. So
// just set current parameter to the last parameter (the variadic one).
- signature.CurrentParameter = signature.Parameters.Last();
- return;
+ return item.Parameters.Length - 1;
}
}
// It was out of bounds, there is no current parameter now.
- signature.CurrentParameter = null;
+ return -1;
}
private void OnEditorSessionDismissed()
diff --git a/src/EditorFeatures/Test/SignatureHelp/AbstractSignatureHelpProviderTests.cs b/src/EditorFeatures/Test/SignatureHelp/AbstractSignatureHelpProviderTests.cs
index d9d45a4bbbaac6f03de6f530d8182abfcc371786..3a12a1e16edbdff669f7278e0257edd364f553bd 100644
--- a/src/EditorFeatures/Test/SignatureHelp/AbstractSignatureHelpProviderTests.cs
+++ b/src/EditorFeatures/Test/SignatureHelp/AbstractSignatureHelpProviderTests.cs
@@ -200,15 +200,17 @@ private void VerifyCurrentParameterNameWorker(string markup, string expectedPara
int cursorPosition,
TextSpan applicableSpan)
{
- var signature = new Signature(applicableToSpan: null, signatureHelpItem: actualSignatureHelpItem);
+ int currentParameterIndex = -1;
if (expectedTestItem.CurrentParameterIndex != null)
{
- if (expectedTestItem.CurrentParameterIndex.Value >= 0 && expectedTestItem.CurrentParameterIndex.Value < signature.Parameters.Count)
+ if (expectedTestItem.CurrentParameterIndex.Value >= 0 && expectedTestItem.CurrentParameterIndex.Value < actualSignatureHelpItem.Parameters.Length)
{
- signature.CurrentParameter = signature.Parameters[expectedTestItem.CurrentParameterIndex.Value];
+ currentParameterIndex = expectedTestItem.CurrentParameterIndex.Value;
}
}
+ var signature = new Signature(applicableToSpan: null, signatureHelpItem: actualSignatureHelpItem, selectedParameterIndex: currentParameterIndex);
+
// We're a match if the signature matches...
// We're now combining the signature and documentation to make classification work.
if (!string.IsNullOrEmpty(expectedTestItem.MethodDocumentation))
@@ -227,7 +229,7 @@ private void VerifyCurrentParameterNameWorker(string markup, string expectedPara
if (expectedTestItem.MethodDocumentation != null)
{
- Assert.Equal(expectedTestItem.MethodDocumentation, actualSignatureHelpItem.Documentation.GetFullText());
+ Assert.Equal(expectedTestItem.MethodDocumentation, actualSignatureHelpItem.DocumenationFactory(CancellationToken.None).GetFullText());
}
if (expectedTestItem.ParameterDocumentation != null)
diff --git a/src/EditorFeatures/Test2/IntelliSense/SignatureHelpControllerTests.vb b/src/EditorFeatures/Test2/IntelliSense/SignatureHelpControllerTests.vb
index 280092bea9d0f25736e82a0a2384cc2d478d9610..ce11b378670626156eab38bb2115c0de959a3863 100644
--- a/src/EditorFeatures/Test2/IntelliSense/SignatureHelpControllerTests.vb
+++ b/src/EditorFeatures/Test2/IntelliSense/SignatureHelpControllerTests.vb
@@ -205,7 +205,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense
End Function
Private Shared Function CreateItems(count As Integer) As IList(Of SignatureHelpItem)
- Return Enumerable.Range(0, count).Select(Function(i) New SignatureHelpItem(isVariadic:=False, documentation:={}, prefixParts:={}, separatorParts:={}, suffixParts:={}, parameters:={}, descriptionParts:={})).ToList()
+ Return Enumerable.Range(0, count).Select(Function(i) New SignatureHelpItem(isVariadic:=False, documentationFactory:=Nothing, prefixParts:={}, separatorParts:={}, suffixParts:={}, parameters:={}, descriptionParts:={})).ToList()
End Function
Friend Class MockSignatureHelpProvider
diff --git a/src/EditorFeatures/Test2/IntelliSense/TestState.vb b/src/EditorFeatures/Test2/IntelliSense/TestState.vb
index ae8e432aed388884e4943831d68606134518033c..d01e740ad65e28c4ac046c88d53b42d7fe908ff0 100644
--- a/src/EditorFeatures/Test2/IntelliSense/TestState.vb
+++ b/src/EditorFeatures/Test2/IntelliSense/TestState.vb
@@ -2,6 +2,7 @@
Imports System.ComponentModel.Composition.Hosting
Imports System.ComponentModel.Composition.Primitives
+Imports System.Threading
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Completion
Imports Microsoft.CodeAnalysis.Completion.Providers
@@ -388,7 +389,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense
End If
If documentation IsNot Nothing Then
- Assert.Equal(documentation, Me.CurrentSignatureHelpPresenterSession.SelectedItem.Documentation.GetFullText())
+ Assert.Equal(documentation, Me.CurrentSignatureHelpPresenterSession.SelectedItem.DocumenationFactory(CancellationToken.None).GetFullText())
End If
If selectedParameter IsNot Nothing Then
diff --git a/src/EditorFeatures/VisualBasic/SignatureHelp/AbstractIntrinsicOperatorSignatureHelpProvider.vb b/src/EditorFeatures/VisualBasic/SignatureHelp/AbstractIntrinsicOperatorSignatureHelpProvider.vb
index ebdb39e8bbebfe41b8e3e419b4af06a58a3af644..2bdb51c2400aa1d2608100cf270a241a35d91db3 100644
--- a/src/EditorFeatures/VisualBasic/SignatureHelp/AbstractIntrinsicOperatorSignatureHelpProvider.vb
+++ b/src/EditorFeatures/VisualBasic/SignatureHelp/AbstractIntrinsicOperatorSignatureHelpProvider.vb
@@ -55,11 +55,12 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.SignatureHelp
Dim parameters As New List(Of SignatureHelpParameter)
For i = 0 To documentation.ParameterCount - 1
+ Dim capturedIndex = i
parameters.Add(
New SignatureHelpParameter(
name:=documentation.GetParameterName(i),
isOptional:=False,
- documentation:=documentation.GetParameterDocumentation(i).ToSymbolDisplayParts(),
+ documentationFactory:=Function(c As CancellationToken) documentation.GetParameterDocumentation(capturedIndex).ToSymbolDisplayParts(),
displayParts:=documentation.GetParameterDisplayParts(i)))
Next
@@ -72,7 +73,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.SignatureHelp
Nothing, semanticModel, position,
symbolDisplayService, anonymousTypeDisplayService,
isVariadic:=False,
- documentation:=SpecializedCollections.SingletonEnumerable(New SymbolDisplayPart(SymbolDisplayPartKind.Text, Nothing, documentation.DocumentationText)),
+ documentationFactory:=Function(c As CancellationToken) SpecializedCollections.SingletonEnumerable(New SymbolDisplayPart(SymbolDisplayPartKind.Text, Nothing, documentation.DocumentationText)),
prefixParts:=documentation.PrefixParts,
separatorParts:=GetSeparatorParts(),
suffixParts:=suffixParts,
diff --git a/src/EditorFeatures/VisualBasic/SignatureHelp/AbstractSignatureHelpProvider.vb b/src/EditorFeatures/VisualBasic/SignatureHelp/AbstractSignatureHelpProvider.vb
index 77f827b568c05065c4aa2b599cae581f5db47de2..716f295389282f45a86237dcfe52e16d597d91f6 100644
--- a/src/EditorFeatures/VisualBasic/SignatureHelp/AbstractSignatureHelpProvider.vb
+++ b/src/EditorFeatures/VisualBasic/SignatureHelp/AbstractSignatureHelpProvider.vb
@@ -44,7 +44,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.SignatureHelp
Return New SignatureHelpParameter(
parameter.Name,
parameter.IsOptional,
- parameter.GetDocumentationParts(semanticModel, position, documentationCommentFormattingService, cancellationToken),
+ parameter.GetDocumentationPartsFactory(semanticModel, position, documentationCommentFormattingService),
parameter.ToMinimalDisplayParts(semanticModel, position))
End Function
diff --git a/src/EditorFeatures/VisualBasic/SignatureHelp/AttributeSignatureHelpProvider.vb b/src/EditorFeatures/VisualBasic/SignatureHelp/AttributeSignatureHelpProvider.vb
index 5507b8e536da6534d746a9be7ba8a692ae7e2414..3527d1df27835ea2a3e6c6c286c6d4b0ffcde0d9 100644
--- a/src/EditorFeatures/VisualBasic/SignatureHelp/AttributeSignatureHelpProvider.vb
+++ b/src/EditorFeatures/VisualBasic/SignatureHelp/AttributeSignatureHelpProvider.vb
@@ -113,7 +113,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.SignatureHelp
constructor, semanticModel, position,
symbolDisplayService, anonymousTypeDisplayService,
isVariadic,
- constructor.GetDocumentationParts(semanticModel, position, documentationCommentFormattingService, cancellationToken),
+ constructor.GetDocumentationPartsFactory(semanticModel, position, documentationCommentFormattingService),
GetPreambleParts(constructor, semanticModel, position),
GetSeparatorParts(),
GetPostambleParts(constructor),
@@ -151,7 +151,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.SignatureHelp
result.Add(New SignatureHelpParameter(
namedParameter.Name,
isOptional:=True,
- documentation:=namedParameter.GetDocumentationParts(semanticModel, position, documentationCommentFormattingService, cancellationToken),
+ documentationFactory:=namedParameter.GetDocumentationPartsFactory(semanticModel, position, documentationCommentFormattingService),
displayParts:=displayParts,
prefixDisplayParts:=GetParameterPrefixDisplayParts(i)))
Next
diff --git a/src/EditorFeatures/VisualBasic/SignatureHelp/FunctionAggregationSignatureHelpProvider.vb b/src/EditorFeatures/VisualBasic/SignatureHelp/FunctionAggregationSignatureHelpProvider.vb
index 88b0bf548d5659867a0f8804c7e529dd8eb8245a..4c49db67d08c099e543cbe5bfa5f45415f185852 100644
--- a/src/EditorFeatures/VisualBasic/SignatureHelp/FunctionAggregationSignatureHelpProvider.vb
+++ b/src/EditorFeatures/VisualBasic/SignatureHelp/FunctionAggregationSignatureHelpProvider.vb
@@ -96,7 +96,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.SignatureHelp
method, semanticModel, position,
symbolDisplayService, anonymousTypeDisplayService,
False,
- method.GetDocumentationParts(semanticModel, position, documentationCommentFormattingService, cancellationToken),
+ method.GetDocumentationPartsFactory(semanticModel, position, documentationCommentFormattingService),
GetPreambleParts(method, semanticModel, position),
GetSeparatorParts(),
GetPostambleParts(method, semanticModel, position),
@@ -154,7 +154,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.SignatureHelp
Dim sigHelpParameter = New SignatureHelpParameter(
"",
parameter.IsOptional,
- parameter.GetDocumentationParts(semanticModel, position, documentationCommentFormattingService, cancellationToken),
+ parameter.GetDocumentationPartsFactory(semanticModel, position, documentationCommentFormattingService),
parts)
Return SpecializedCollections.SingletonEnumerable(sigHelpParameter)
diff --git a/src/EditorFeatures/VisualBasic/SignatureHelp/GenericNameSignatureHelpProvider.vb b/src/EditorFeatures/VisualBasic/SignatureHelp/GenericNameSignatureHelpProvider.vb
index 226d5bb7c990089333a1ae3b820ac3bc96b61f9c..3559e72ca345fd7c50c8bdc7570b18bdc3b12c9a 100644
--- a/src/EditorFeatures/VisualBasic/SignatureHelp/GenericNameSignatureHelpProvider.vb
+++ b/src/EditorFeatures/VisualBasic/SignatureHelp/GenericNameSignatureHelpProvider.vb
@@ -117,7 +117,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.SignatureHelp
symbol, semanticModel, position,
symbolDisplayService, anonymousTypeDisplayService,
False,
- symbol.GetDocumentationParts(semanticModel, position, documentationCommentFormattingService, cancellationToken),
+ symbol.GetDocumentationPartsFactory(semanticModel, position, documentationCommentFormattingService),
GetPreambleParts(namedType, semanticModel, position), GetSeparatorParts(), GetPostambleParts(namedType), namedType.TypeParameters.[Select](Function(p) Convert(p, semanticModel, position, documentationCommentFormattingService, cancellationToken)))
Else
Dim method = DirectCast(symbol, IMethodSymbol)
@@ -125,7 +125,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.SignatureHelp
symbol, semanticModel, position,
symbolDisplayService, anonymousTypeDisplayService,
False,
- symbol.GetDocumentationParts(semanticModel, position, documentationCommentFormattingService, cancellationToken),
+ symbol.GetDocumentationPartsFactory(semanticModel, position, documentationCommentFormattingService),
GetPreambleParts(method, semanticModel, position), GetSeparatorParts(), GetPostambleParts(method, semanticModel, position), method.TypeParameters.[Select](Function(p) Convert(p, semanticModel, position, documentationCommentFormattingService, cancellationToken)))
End If
@@ -142,7 +142,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.SignatureHelp
Return New SignatureHelpParameter(
parameter.Name,
isOptional:=False,
- documentation:=parameter.GetDocumentationParts(semanticModel, position, documentationCommentFormattingService, cancellationToken),
+ documentationFactory:=parameter.GetDocumentationPartsFactory(semanticModel, position, documentationCommentFormattingService),
displayParts:=parts)
End Function
diff --git a/src/EditorFeatures/VisualBasic/SignatureHelp/InvocationExpressionSignatureHelpProvider.DelegateInvoke.vb b/src/EditorFeatures/VisualBasic/SignatureHelp/InvocationExpressionSignatureHelpProvider.DelegateInvoke.vb
index 3ec7e17b0b4f24c62fc523066e7b8b48be16135d..1ee1b1c20891ec1e5b4cbac060cb50a5d8c8d644 100644
--- a/src/EditorFeatures/VisualBasic/SignatureHelp/InvocationExpressionSignatureHelpProvider.DelegateInvoke.vb
+++ b/src/EditorFeatures/VisualBasic/SignatureHelp/InvocationExpressionSignatureHelpProvider.DelegateInvoke.vb
@@ -28,7 +28,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.SignatureHelp
invokeMethod, semanticModel, position,
symbolDisplayService, anonymousTypeDisplayService,
isVariadic:=invokeMethod.IsParams(),
- documentation:=SpecializedCollections.EmptyEnumerable(Of SymbolDisplayPart)(),
+ documentationFactory:=Nothing,
prefixParts:=GetDelegateInvokePreambleParts(invokeMethod, semanticModel, position),
separatorParts:=GetSeparatorParts(),
suffixParts:=GetDelegateInvokePostambleParts(invokeMethod, semanticModel, position),
@@ -52,10 +52,11 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.SignatureHelp
Private Function GetDelegateInvokeParameters(invokeMethod As IMethodSymbol, semanticModel As SemanticModel, position As Integer, documentationCommentoFormattingService As IDocumentationCommentFormattingService, cancellationToken As CancellationToken) As IEnumerable(Of SignatureHelpParameter)
Dim parameters = New List(Of SignatureHelpParameter)
For Each parameter In invokeMethod.Parameters
+ cancellationToken.ThrowIfCancellationRequested()
parameters.Add(New SignatureHelpParameter(
parameter.Name,
isOptional:=False,
- documentation:=parameter.GetDocumentationParts(semanticModel, position, documentationCommentoFormattingService, cancellationToken),
+ documentationFactory:=parameter.GetDocumentationPartsFactory(semanticModel, position, documentationCommentoFormattingService),
displayParts:=parameter.ToMinimalDisplayParts(semanticModel, position)))
Next
diff --git a/src/EditorFeatures/VisualBasic/SignatureHelp/InvocationExpressionSignatureHelpProvider.ElementAccess.vb b/src/EditorFeatures/VisualBasic/SignatureHelp/InvocationExpressionSignatureHelpProvider.ElementAccess.vb
index 27e7c09ed1c0d0ef73e85d2b9f80bacaa021c37a..f2faa828aab82265ff7376b7b53599411e7876ed 100644
--- a/src/EditorFeatures/VisualBasic/SignatureHelp/InvocationExpressionSignatureHelpProvider.ElementAccess.vb
+++ b/src/EditorFeatures/VisualBasic/SignatureHelp/InvocationExpressionSignatureHelpProvider.ElementAccess.vb
@@ -44,7 +44,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.SignatureHelp
indexer, semanticModel, position,
symbolDisplayService, anonymousTypeDisplayService,
indexer.IsParams(),
- indexer.GetDocumentationParts(semanticModel, position, documentationCommentFormattingService, cancellationToken),
+ indexer.GetDocumentationPartsFactory(semanticModel, position, documentationCommentFormattingService),
GetIndexerPreambleParts(indexer, semanticModel, position),
GetSeparatorParts(),
GetIndexerPostambleParts(indexer, semanticModel, position),
diff --git a/src/EditorFeatures/VisualBasic/SignatureHelp/InvocationExpressionSignatureHelpProvider.MemberGroup.vb b/src/EditorFeatures/VisualBasic/SignatureHelp/InvocationExpressionSignatureHelpProvider.MemberGroup.vb
index e060f045e599ff8e708558536efaab543a3010d0..c944a98d8fd81a059aa09121f4c0736a5646d897 100644
--- a/src/EditorFeatures/VisualBasic/SignatureHelp/InvocationExpressionSignatureHelpProvider.MemberGroup.vb
+++ b/src/EditorFeatures/VisualBasic/SignatureHelp/InvocationExpressionSignatureHelpProvider.MemberGroup.vb
@@ -55,7 +55,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.SignatureHelp
member, semanticModel, position,
symbolDisplayService, anonymousTypeDisplayService,
member.IsParams(),
- member.GetDocumentationParts(semanticModel, position, documentationCommentFormattingService, cancellationToken).Concat(GetAwaitableDescription(member, semanticModel, position)),
+ Function(c) member.GetDocumentationParts(semanticModel, position, documentationCommentFormattingService, c).Concat(GetAwaitableDescription(member, semanticModel, position)),
GetMemberGroupPreambleParts(member, semanticModel, position),
GetSeparatorParts(),
GetMemberGroupPostambleParts(member, semanticModel, position),
diff --git a/src/EditorFeatures/VisualBasic/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.DelegateType.vb b/src/EditorFeatures/VisualBasic/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.DelegateType.vb
index 062fc1a5e16056d050b6f5c70ce3f1a038de92a9..795cc9fe6f2273779c9ad372d97406694da500bc 100644
--- a/src/EditorFeatures/VisualBasic/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.DelegateType.vb
+++ b/src/EditorFeatures/VisualBasic/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.DelegateType.vb
@@ -28,7 +28,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.SignatureHelp
invokeMethod, semanticModel, position,
symbolDisplayService, anonymousTypeDisplayService,
isVariadic:=False,
- documentation:=invokeMethod.GetDocumentationParts(semanticModel, position, documentationCommentFormattingService, cancellationToken),
+ documentationFactory:=invokeMethod.GetDocumentationPartsFactory(semanticModel, position, documentationCommentFormattingService),
prefixParts:=GetDelegateTypePreambleParts(invokeMethod, semanticModel, position), separatorParts:=GetSeparatorParts(), suffixParts:=GetDelegateTypePostambleParts(invokeMethod), parameters:=GetDelegateTypeParameters(invokeMethod, semanticModel, position, cancellationToken))
Return SpecializedCollections.SingletonEnumerable(item)
End Function
@@ -77,7 +77,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.SignatureHelp
Return {New SignatureHelpParameter(
TargetName,
isOptional:=False,
- documentation:=String.Empty.ToSymbolDisplayParts(),
+ documentationFactory:=Nothing,
displayParts:=parts)}
End Function
diff --git a/src/EditorFeatures/VisualBasic/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.NormalType.vb b/src/EditorFeatures/VisualBasic/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.NormalType.vb
index 9888ac3950a63a9a23d5b7cc24db3f602ec41131..181d5714fb061103617990bfc13478b7d70de86d 100644
--- a/src/EditorFeatures/VisualBasic/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.NormalType.vb
+++ b/src/EditorFeatures/VisualBasic/SignatureHelp/ObjectCreationExpressionSignatureHelpProvider.NormalType.vb
@@ -40,7 +40,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.SignatureHelp
constructor, semanticModel, position,
symbolDisplayService, anonymousTypeDisplayService,
constructor.IsParams(),
- constructor.GetDocumentationParts(semanticModel, position, documentationCommentFormattingService, cancellationToken),
+ constructor.GetDocumentationPartsFactory(semanticModel, position, documentationCommentFormattingService),
GetNormalTypePreambleParts(constructor, semanticModel, position), GetSeparatorParts(), GetNormalTypePostambleParts(constructor), constructor.Parameters.[Select](Function(p) Convert(p, semanticModel, position, documentationCommentFormattingService, cancellationToken)))
Return item
End Function
diff --git a/src/EditorFeatures/VisualBasic/SignatureHelp/RaiseEventStatementSignatureHelpProvider.vb b/src/EditorFeatures/VisualBasic/SignatureHelp/RaiseEventStatementSignatureHelpProvider.vb
index 9b570a6cc52ee7c6907fab8d53df99166e2ced08..6b388c61ed86cc3898f003e3b80fbfb4b3fbaf2a 100644
--- a/src/EditorFeatures/VisualBasic/SignatureHelp/RaiseEventStatementSignatureHelpProvider.vb
+++ b/src/EditorFeatures/VisualBasic/SignatureHelp/RaiseEventStatementSignatureHelpProvider.vb
@@ -109,7 +109,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.SignatureHelp
eventSymbol, semanticModel, position,
symbolDisplayService, anonymousTypeDisplayService,
False,
- eventSymbol.GetDocumentationParts(semanticModel, position, documentationCommentFormattingService, cancellationToken),
+ eventSymbol.GetDocumentationPartsFactory(semanticModel, position, documentationCommentFormattingService),
GetPreambleParts(eventSymbol, semanticModel, position),
GetSeparatorParts(),
GetPostambleParts(eventSymbol, semanticModel, position),
diff --git a/src/ExpressionEvaluator/Core/Source/Concord/Microsoft.VisualStudio.Debugger.Engine.il b/src/ExpressionEvaluator/Core/Source/Concord/Microsoft.VisualStudio.Debugger.Engine.il
index 8df535f4ff8d5b3e1ac94114c2983f5e09966ec4..e689bbab78e3be7e1920bbcc940c7a4c2bfba50c 100644
--- a/src/ExpressionEvaluator/Core/Source/Concord/Microsoft.VisualStudio.Debugger.Engine.il
+++ b/src/ExpressionEvaluator/Core/Source/Concord/Microsoft.VisualStudio.Debugger.Engine.il
@@ -45,7 +45,7 @@
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
-// Image base: 0x02730000
+// Image base: 0x04D70000
// =============== CLASS MEMBERS DECLARATION ===================
diff --git a/src/ExpressionEvaluator/Core/Source/Concord/Microsoft.VisualStudio.Debugger.Metadata.il b/src/ExpressionEvaluator/Core/Source/Concord/Microsoft.VisualStudio.Debugger.Metadata.il
index fdf46c47859a9d7fa6e7bf5660d678925d66417c..e6bcf4c1171b0ffa522bed4cc8615b24fc38ee78 100644
--- a/src/ExpressionEvaluator/Core/Source/Concord/Microsoft.VisualStudio.Debugger.Metadata.il
+++ b/src/ExpressionEvaluator/Core/Source/Concord/Microsoft.VisualStudio.Debugger.Metadata.il
@@ -44,7 +44,7 @@
.stackreserve 0x00100000
.subsystem 0x0003 // WINDOWS_CUI
.corflags 0x00000001 // ILONLY
-// Image base: 0x01330000
+// Image base: 0x008F0000
// =============== CLASS MEMBERS DECLARATION ===================
diff --git a/src/ExpressionEvaluator/Package/ExpressionEvaluatorPackage.csproj b/src/ExpressionEvaluator/Package/ExpressionEvaluatorPackage.csproj
index dac8d8d844e7b7399cd5bbe16d6a39e4f34b72f4..cad8c7ae3cdfebe861e146436e1b5787d445db35 100644
--- a/src/ExpressionEvaluator/Package/ExpressionEvaluatorPackage.csproj
+++ b/src/ExpressionEvaluator/Package/ExpressionEvaluatorPackage.csproj
@@ -27,14 +27,14 @@
$(VisualStudioVersion)
ExpressionEvaluatorPackage.vsix
..\..\..\
+
True
true
-
-
+
{201EC5B7-F91E-45E5-B9F2-67A266CCE6FC}
- VisualStudioComponents
+ VisualStudioSetup
false
False
diff --git a/src/ExpressionEvaluator/Package/source.extension.vsixmanifest b/src/ExpressionEvaluator/Package/source.extension.vsixmanifest
index 7d7229362236ce07dc122bb55fea0fc27a36fe4d..36134e51dc7c0233e0ae9376ec1929e7c5536c74 100644
--- a/src/ExpressionEvaluator/Package/source.extension.vsixmanifest
+++ b/src/ExpressionEvaluator/Package/source.extension.vsixmanifest
@@ -12,7 +12,7 @@
-
+
@@ -20,4 +20,4 @@
-
\ No newline at end of file
+
diff --git a/src/Features/CSharp/Completion/CompletionProviders/EnumAndCompletionListTagCompletionProvider.cs b/src/Features/CSharp/Completion/CompletionProviders/EnumAndCompletionListTagCompletionProvider.cs
index 8dcef4a52702f2033a10cbd8f092ed1180deddb3..e1789137462687064596139350dc9533904b59c2 100644
--- a/src/Features/CSharp/Completion/CompletionProviders/EnumAndCompletionListTagCompletionProvider.cs
+++ b/src/Features/CSharp/Completion/CompletionProviders/EnumAndCompletionListTagCompletionProvider.cs
@@ -121,7 +121,14 @@ public override bool IsTriggerCharacter(SourceText text, int characterPosition,
private INamedTypeSymbol GetCompletionListType(ITypeSymbol type, INamedTypeSymbol within, Compilation compilation)
{
- var documentation = type.GetDocumentationComment();
+ // PERF: Avoid parsing XML unless the text contains the word "completionlist".
+ string xmlText = type.GetDocumentationCommentXml();
+ if (xmlText == null || !xmlText.Contains(DocumentationCommentXmlNames.CompletionListElementName))
+ {
+ return null;
+ }
+
+ var documentation = Shared.Utilities.DocumentationComment.FromXmlFragment(xmlText);
var completionListType = documentation.CompletionListCref != null
? DocumentationCommentId.GetSymbolsForDeclarationId(documentation.CompletionListCref, compilation).OfType().FirstOrDefault()
diff --git a/src/Features/Core/Features.csproj b/src/Features/Core/Features.csproj
index f2949bee05b9b4a1d2c8b66fb3356d910187abbe..5583e0b17b26ce2d65e05a62c791e6c2854e30b2 100644
--- a/src/Features/Core/Features.csproj
+++ b/src/Features/Core/Features.csproj
@@ -78,6 +78,7 @@
+
@@ -545,4 +546,4 @@
-
\ No newline at end of file
+
diff --git a/src/Features/Core/Shared/Extensions/ISymbolExtensions_2.cs b/src/Features/Core/Shared/Extensions/ISymbolExtensions_2.cs
index d2cc1580d77147f0bee5a20c897c20f2b926f1ce..678148acfdfc8e8e8260263f9386bd52143dcd6e 100644
--- a/src/Features/Core/Shared/Extensions/ISymbolExtensions_2.cs
+++ b/src/Features/Core/Shared/Extensions/ISymbolExtensions_2.cs
@@ -4,7 +4,6 @@
using System.Collections.Generic;
using System.Threading;
using Microsoft.CodeAnalysis.DocumentationCommentFormatting;
-using Microsoft.CodeAnalysis.Shared.Utilities;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Shared.Extensions
@@ -170,8 +169,6 @@ public static Glyph GetGlyph(this ISymbol symbol)
public static IEnumerable GetDocumentationParts(this ISymbol symbol, SemanticModel semanticModel, int position, IDocumentationCommentFormattingService formatter, CancellationToken cancellationToken)
{
- var globalNamespace = semanticModel.Compilation.GlobalNamespace;
-
var documentation = symbol.TypeSwitch(
(IParameterSymbol parameter) => parameter.ContainingSymbol.OriginalDefinition.GetDocumentationComment(cancellationToken: cancellationToken).GetParameterText(symbol.Name),
(ITypeParameterSymbol typeParam) => typeParam.ContainingSymbol.GetDocumentationComment(cancellationToken: cancellationToken).GetTypeParameterText(symbol.Name),
@@ -179,12 +176,14 @@ public static IEnumerable GetDocumentationParts(this ISymbol
(IAliasSymbol alias) => alias.Target.GetDocumentationComment(cancellationToken: cancellationToken).SummaryText,
_ => symbol.GetDocumentationComment(cancellationToken: cancellationToken).SummaryText);
- if (documentation != null)
- {
- return formatter.Format(documentation, semanticModel, position, CrefFormat);
- }
+ return documentation != null
+ ? formatter.Format(documentation, semanticModel, position, CrefFormat)
+ : SpecializedCollections.EmptyEnumerable();
+ }
- return SpecializedCollections.EmptyList();
+ public static Func> GetDocumentationPartsFactory(this ISymbol symbol, SemanticModel semanticModel, int position, IDocumentationCommentFormattingService formatter)
+ {
+ return c => symbol.GetDocumentationParts(semanticModel, position, formatter, cancellationToken: c);
}
public static readonly SymbolDisplayFormat CrefFormat =
diff --git a/src/Roslyn.sln b/src/Roslyn.sln
index 6bcbe931fb92943529f4e24860c500acd431b426..958a489d0d1e51dcc8ffe28e87849542fca7a95d 100644
--- a/src/Roslyn.sln
+++ b/src/Roslyn.sln
@@ -229,7 +229,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpVisualStudioTest", "V
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ServicesVisualStudioTest", "VisualStudio\Core\Test\ServicesVisualStudioTest.vbproj", "{A1455D30-55FC-45EF-8759-3AEBDB13D940}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisualStudioComponents", "VisualStudio\Components\VisualStudioComponents.csproj", "{201EC5B7-F91E-45E5-B9F2-67A266CCE6FC}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisualStudioSetup", "VisualStudio\Setup\VisualStudioSetup.csproj", "{201EC5B7-F91E-45E5-B9F2-67A266CCE6FC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisualStudioInteractiveComponents", "VisualStudio\VisualStudioInteractiveComponents\VisualStudioInteractiveComponents.csproj", "{2169F526-8A88-435D-8732-486ACA095A6A}"
EndProject
diff --git a/src/Scripting/Core/ScriptBuilder.cs b/src/Scripting/Core/ScriptBuilder.cs
index 5d7e3cdb3a593684f090e081c0135dd812e3fd13..68c462a1d2144ceffcdf8d74de57b4f4c4414958 100644
--- a/src/Scripting/Core/ScriptBuilder.cs
+++ b/src/Scripting/Core/ScriptBuilder.cs
@@ -51,7 +51,7 @@ internal class ScriptBuilder
///
/// Lockable object only instance is knowledgeable about.
- ///
+ ///
private readonly object _gate = new object();
#region Testing and Debugging
@@ -250,12 +250,12 @@ private sealed class CollectibleCodeManager : AssemblyLoader
///
/// lock(_gate) on access.
- ///
+ ///
private readonly object _gate = new object();
///
- // lock(_gate) on access.
- ///
+ /// lock(_gate) on access.
+ ///
internal ModuleBuilder dynamicModule;
public CollectibleCodeManager(AssemblyLoader assemblyLoader, string assemblyNamePrefix)
@@ -335,7 +335,7 @@ private sealed class UncollectibleCodeManager : AssemblyLoader
///
/// Lockable object only instance is knowledgeable about.
- ///
+ ///
private readonly object _gate = new object();
internal UncollectibleCodeManager(AssemblyLoader assemblyLoader, string assemblyNamePrefix)
diff --git a/src/VisualStudio/Components/BindingPath.pkgdef b/src/VisualStudio/Components/BindingPath.pkgdef
deleted file mode 100644
index 7e1c00a0b41c9bed1dc53e54240b168f66d4fbf9..0000000000000000000000000000000000000000
--- a/src/VisualStudio/Components/BindingPath.pkgdef
+++ /dev/null
@@ -1,2 +0,0 @@
-[$RootKey$\BindingPaths\{5EABCC64-FDFC-478D-9123-DAE27341DE85}]
-"$PackageFolder$"=""
diff --git a/src/VisualStudio/Core/Def/ServicesVisualStudio.csproj b/src/VisualStudio/Core/Def/ServicesVisualStudio.csproj
index 142396ffed1f8ba5935f2ae6dde93f329905111f..b4c58a539041642094e3a38dea45283682278ed1 100644
--- a/src/VisualStudio/Core/Def/ServicesVisualStudio.csproj
+++ b/src/VisualStudio/Core/Def/ServicesVisualStudio.csproj
@@ -211,6 +211,7 @@
+
@@ -710,7 +711,6 @@
Designer
-
diff --git a/src/VisualStudio/Core/Test/DebuggerIntelliSense/TestState.vb b/src/VisualStudio/Core/Test/DebuggerIntelliSense/TestState.vb
index 68fb4fe68dbecc9156ff4691c4549f983db4e205..fe48db7183b508916723a6d10f7a98db928ea5aa 100644
--- a/src/VisualStudio/Core/Test/DebuggerIntelliSense/TestState.vb
+++ b/src/VisualStudio/Core/Test/DebuggerIntelliSense/TestState.vb
@@ -1,6 +1,7 @@
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.ComponentModel.Composition.Hosting
+Imports System.Threading
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Completion
Imports Microsoft.CodeAnalysis.Completion.Providers
@@ -8,7 +9,7 @@ Imports Microsoft.CodeAnalysis.Completion.Rules
Imports Microsoft.CodeAnalysis.Editor
Imports Microsoft.CodeAnalysis.Editor.CommandHandlers
Imports Microsoft.CodeAnalysis.Editor.Commands
-Imports Microsoft.CodeAnalysis.Editor.Implementation.Intellisense.Completion
+Imports Microsoft.CodeAnalysis.Editor.Implementation.IntelliSense.Completion
Imports Microsoft.CodeAnalysis.Editor.UnitTests
Imports Microsoft.CodeAnalysis.Editor.UnitTests.IntelliSense
Imports Microsoft.CodeAnalysis.Host.Mef
@@ -365,7 +366,7 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.DebuggerIntelliSense
End If
If documentation IsNot Nothing Then
- Assert.Equal(documentation, Me.CurrentSignatureHelpPresenterSession.SelectedItem.Documentation.GetFullText())
+ Assert.Equal(documentation, Me.CurrentSignatureHelpPresenterSession.SelectedItem.DocumenationFactory(CancellationToken.None).GetFullText())
End If
If selectedParameter IsNot Nothing Then
diff --git a/src/VisualStudio/Components/AssemblyRedirects.cs b/src/VisualStudio/Setup/AssemblyRedirects.cs
similarity index 84%
rename from src/VisualStudio/Components/AssemblyRedirects.cs
rename to src/VisualStudio/Setup/AssemblyRedirects.cs
index 236ba0be381b26097824736c3c8efdc979fc8a0e..779899fbd5431b6232f3678ea33cc731552b5ca7 100644
--- a/src/VisualStudio/Components/AssemblyRedirects.cs
+++ b/src/VisualStudio/Setup/AssemblyRedirects.cs
@@ -162,6 +162,38 @@
PublicKeyToken = Constants.PublicKeyToken,
GenerateCodeBase = false)]
+[assembly: ProvideBindingRedirection(
+ AssemblyName = "Microsoft.VisualStudio.LanguageServices.Implementation",
+ OldVersionLowerBound = Constants.OldVersionLowerBound,
+ OldVersionUpperBound = Constants.OldVersionUpperBound,
+ NewVersion = Constants.NewVersion,
+ PublicKeyToken = Constants.PublicKeyToken,
+ GenerateCodeBase = false)]
+
+[assembly: ProvideBindingRedirection(
+ AssemblyName = "Microsoft.VisualStudio.LanguageServices.VisualBasic",
+ OldVersionLowerBound = Constants.OldVersionLowerBound,
+ OldVersionUpperBound = Constants.OldVersionUpperBound,
+ NewVersion = Constants.NewVersion,
+ PublicKeyToken = Constants.PublicKeyToken,
+ GenerateCodeBase = false)]
+
+[assembly: ProvideBindingRedirection(
+ AssemblyName = "Microsoft.VisualStudio.LanguageServices.CSharp",
+ OldVersionLowerBound = Constants.OldVersionLowerBound,
+ OldVersionUpperBound = Constants.OldVersionUpperBound,
+ NewVersion = Constants.NewVersion,
+ PublicKeyToken = Constants.PublicKeyToken,
+ GenerateCodeBase = false)]
+
+[assembly: ProvideBindingRedirection(
+ AssemblyName = "Microsoft.VisualStudio.LanguageServices.SolutionExplorer",
+ OldVersionLowerBound = Constants.OldVersionLowerBound,
+ OldVersionUpperBound = Constants.OldVersionUpperBound,
+ NewVersion = Constants.NewVersion,
+ PublicKeyToken = Constants.PublicKeyToken,
+ GenerateCodeBase = false)]
+
internal class Constants
{
#if OFFICIAL_BUILD
diff --git a/src/VisualStudio/Setup/CSharpPackageRegistration.pkgdef b/src/VisualStudio/Setup/CSharpPackageRegistration.pkgdef
new file mode 100644
index 0000000000000000000000000000000000000000..c3f77e2289c3ad8a4a976a93a8aab67d100cfc1b
--- /dev/null
+++ b/src/VisualStudio/Setup/CSharpPackageRegistration.pkgdef
@@ -0,0 +1,54 @@
+[$RootKey$\Editors]
+
+[$RootKey$\Editors\{08467b34-b90f-4d91-bdca-eb8c8cf3033a}]
+"CommonPhysicalViewAttributes"=dword:00000003
+"DisplayName"="#2359"
+"EditorTrustLevel"=dword:00000002
+"ExcludeDefTextEditor"=dword:00000001
+"LinkedEditorGuid"="{A6C744A8-0E4A-4FC6-886A-064283054674}"
+"Package"="{13C3BBB4-F18F-4111-9F54-A0FB010D9194}"
+@="Microsoft CSharp Editor Factory with Encoding"
+
+[$RootKey$\Editors\{08467b34-b90f-4d91-bdca-eb8c8cf3033a}\Extensions]
+"cs"=dword:00000027
+
+[$RootKey$\Editors\{08467b34-b90f-4d91-bdca-eb8c8cf3033a}\LogicalViews]
+"{7651a700-06e5-11d1-8ebd-00a0c90f26ea}"=""
+"{7651a701-06e5-11d1-8ebd-00a0c90f26ea}"=""
+"{7651a702-06e5-11d1-8ebd-00a0c90f26ea}"="Form"
+"{7651a703-06e5-11d1-8ebd-00a0c90f26ea}"=""
+
+[$RootKey$\Editors\{08467b34-b90f-4d91-bdca-eb8c8cf3033a}\UntrustedLogicalViews]
+"{7651a702-06e5-11d1-8ebd-00a0c90f26ea}"="Form"
+
+[$RootKey$\Editors\{A6C744A8-0E4A-4FC6-886A-064283054674}]
+"CommonPhysicalViewAttributes"=dword:00000002
+"DisplayName"="#2358"
+"EditorTrustLevel"=dword:00000002
+"ExcludeDefTextEditor"=dword:00000001
+"Package"="{13C3BBB4-F18F-4111-9F54-A0FB010D9194}"
+@="Microsoft CSharp Editor Factory"
+
+[$RootKey$\Editors\{A6C744A8-0E4A-4FC6-886A-064283054674}\Extensions]
+"cs"=dword:00000028
+
+[$RootKey$\Editors\{A6C744A8-0E4A-4FC6-886A-064283054674}\LogicalViews]
+"{7651a700-06e5-11d1-8ebd-00a0c90f26ea}"=""
+"{7651a701-06e5-11d1-8ebd-00a0c90f26ea}"=""
+"{7651a702-06e5-11d1-8ebd-00a0c90f26ea}"="Form"
+"{7651a703-06e5-11d1-8ebd-00a0c90f26ea}"=""
+
+[$RootKey$\Editors\{A6C744A8-0E4A-4FC6-886A-064283054674}\PhysicalViewAttributes]
+"Form"=dword:00000003
+
+[$RootKey$\Editors\{A6C744A8-0E4A-4FC6-886A-064283054674}\UntrustedLogicalViews]
+"{7651a702-06e5-11d1-8ebd-00a0c90f26ea}"="Form"
+
+[$RootKey$\FileExtensionMapping\{201669EE-A2F4-4B72-82C6-028810C22A40}]
+"DisplayName"="#113"
+"EditorGUID"="{A6C744A8-0E4A-4FC6-886A-064283054674}"
+"LogViewID"="{694DD9B6-B865-4C5B-AD85-86356E9C88DC}"
+"Package"="{13C3BBB4-F18F-4111-9F54-A0FB010D9194}"
+"SortPriority"=dword:00000064
+@="Microsoft Visual C#"
+
diff --git a/src/VisualStudio/Setup/Commands.vsct b/src/VisualStudio/Setup/Commands.vsct
new file mode 100644
index 0000000000000000000000000000000000000000..02cddb7c431e227709e8daa866f65164860bc85d
--- /dev/null
+++ b/src/VisualStudio/Setup/Commands.vsct
@@ -0,0 +1,377 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/VisualStudio/Setup/IRoslynTelemetrySetup.cs b/src/VisualStudio/Setup/IRoslynTelemetrySetup.cs
new file mode 100644
index 0000000000000000000000000000000000000000..6343e82911e4f0b854dfd89301b611aebadf8188
--- /dev/null
+++ b/src/VisualStudio/Setup/IRoslynTelemetrySetup.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.VisualStudio.ComponentModelHost;
+
+namespace Microsoft.VisualStudio.LanguageServices.Setup
+{
+ internal interface IRoslynTelemetrySetup
+ {
+ void Initialize(IServiceProvider componentModel);
+ }
+}
diff --git a/src/VisualStudio/Setup/RoslynPackage.cs b/src/VisualStudio/Setup/RoslynPackage.cs
new file mode 100644
index 0000000000000000000000000000000000000000..f132c189fb01c3320e6333483e749c91a87c1d94
--- /dev/null
+++ b/src/VisualStudio/Setup/RoslynPackage.cs
@@ -0,0 +1,245 @@
+// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+using System.ComponentModel.Design;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.Editor;
+using Microsoft.CodeAnalysis.Editor.Host;
+using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
+using Microsoft.CodeAnalysis.ErrorReporting;
+using Microsoft.CodeAnalysis.Versions;
+using Microsoft.VisualStudio.ComponentModelHost;
+using Microsoft.VisualStudio.LanguageServices.Implementation;
+using Microsoft.VisualStudio.LanguageServices.Implementation.Library.FindResults;
+using Microsoft.VisualStudio.LanguageServices.Implementation.SolutionExplorer;
+using Microsoft.VisualStudio.LanguageServices.Implementation.TableDataSource;
+using Microsoft.VisualStudio.LanguageServices.Implementation.TaskList;
+using Microsoft.VisualStudio.LanguageServices.Utilities;
+using Microsoft.VisualStudio.PlatformUI;
+using Microsoft.VisualStudio.Shell;
+using Microsoft.VisualStudio.Shell.Interop;
+using Task = System.Threading.Tasks.Task;
+
+namespace Microsoft.VisualStudio.LanguageServices.Setup
+{
+ [Guid(Guids.RoslynPackageIdString)]
+ [PackageRegistration(UseManagedResourcesOnly = true)]
+ [ProvideMenuResource("Menus.ctmenu", version: 10)]
+ public class RoslynPackage : Package
+ {
+ private LibraryManager _libraryManager;
+ private uint _libraryManagerCookie;
+ private VisualStudioWorkspace _workspace;
+ private WorkspaceFailureOutputPane _outputPane;
+ private IComponentModel _componentModel;
+ private AnalyzerItemsTracker _analyzerTracker;
+ private IDisposable _solutionBuildMonitor;
+
+ protected override void Initialize()
+ {
+ base.Initialize();
+
+ ForegroundThreadAffinitizedObject.Initialize();
+
+ FatalError.Handler = FailFast.OnFatalException;
+ FatalError.NonFatalHandler = WatsonReporter.Report;
+
+ // We also must set the FailFast handler for the compiler layer as well
+ var compilerAssembly = typeof(Compilation).Assembly;
+ var compilerFatalError = compilerAssembly.GetType("Microsoft.CodeAnalysis.FatalError", throwOnError: true);
+ var property = compilerFatalError.GetProperty(nameof(FatalError.Handler), BindingFlags.Static | BindingFlags.Public);
+ var compilerFailFast = compilerAssembly.GetType(typeof(FailFast).FullName, throwOnError: true);
+ var method = compilerFailFast.GetMethod(nameof(FailFast.OnFatalException), BindingFlags.Static | BindingFlags.NonPublic);
+ property.SetValue(null, Delegate.CreateDelegate(property.PropertyType, method));
+
+ RegisterFindResultsLibraryManager();
+
+ var componentModel = (IComponentModel)this.GetService(typeof(SComponentModel));
+ _workspace = componentModel.GetService();
+
+ var telemetrySetup = componentModel.GetService();
+ telemetrySetup?.Initialize(this);
+
+ // set workspace output pane
+ _outputPane = new WorkspaceFailureOutputPane(this, _workspace);
+
+ InitializeColors();
+
+ // load some services that have to be loaded in UI thread
+ LoadComponentsInUIContext();
+
+ _solutionBuildMonitor = new SolutionBuildMonitor(_workspace);
+ }
+
+ private void InitializeColors()
+ {
+ // Use VS color keys in order to support theming.
+ CodeAnalysisColors.SystemCaptionTextColorKey = EnvironmentColors.SystemWindowTextColorKey;
+ CodeAnalysisColors.SystemCaptionTextBrushKey = EnvironmentColors.SystemWindowTextBrushKey;
+ CodeAnalysisColors.CheckBoxTextBrushKey = EnvironmentColors.SystemWindowTextBrushKey;
+ CodeAnalysisColors.RenameErrorTextBrushKey = VSCodeAnalysisColors.RenameErrorTextBrushKey;
+ CodeAnalysisColors.RenameResolvableConflictTextBrushKey = VSCodeAnalysisColors.RenameResolvableConflictTextBrushKey;
+ CodeAnalysisColors.BackgroundBrushKey = VsBrushes.CommandBarGradientBeginKey;
+ CodeAnalysisColors.ButtonStyleKey = VsResourceKeys.ButtonStyleKey;
+ CodeAnalysisColors.AccentBarColorKey = EnvironmentColors.FileTabInactiveDocumentBorderEdgeBrushKey;
+ }
+
+ private void LoadComponentsInUIContext()
+ {
+ if (KnownUIContexts.SolutionExistsAndFullyLoadedContext.IsActive)
+ {
+ // if we are already in the right UI context, load it right away
+ LoadComponents();
+ }
+ else
+ {
+ // load them when it is a right context.
+ KnownUIContexts.SolutionExistsAndFullyLoadedContext.UIContextChanged += OnSolutionExistsAndFullyLoadedContext;
+ }
+ }
+
+ private void OnSolutionExistsAndFullyLoadedContext(object sender, UIContextChangedEventArgs e)
+ {
+ if (e.Activated)
+ {
+ // unsubscribe from it
+ KnownUIContexts.SolutionExistsAndFullyLoadedContext.UIContextChanged -= OnSolutionExistsAndFullyLoadedContext;
+
+ // load components
+ LoadComponents();
+ }
+ }
+
+ private void LoadComponents()
+ {
+ this.ComponentModel.GetService();
+ this.ComponentModel.GetService();
+ this.ComponentModel.GetService();
+ this.ComponentModel.GetExtensions();
+ this.ComponentModel.GetExtensions();
+ this.ComponentModel.GetService();
+ this.ComponentModel.GetService();
+
+ LoadAnalyzerNodeComponents();
+
+ Task.Run(() => LoadComponentsBackground());
+ }
+
+ private void LoadComponentsBackground()
+ {
+ // Perf: Initialize the command handlers.
+ var commandHandlerServiceFactory = this.ComponentModel.GetService();
+ commandHandlerServiceFactory.Initialize(ContentTypeNames.RoslynContentType);
+
+ this.ComponentModel.GetService();
+ this.ComponentModel.GetService();
+
+ this.ComponentModel.GetService();
+ this.ComponentModel.GetService();
+ }
+
+ internal IComponentModel ComponentModel
+ {
+ get
+ {
+ if (_componentModel == null)
+ {
+ _componentModel = (IComponentModel)GetService(typeof(SComponentModel));
+ }
+
+ return _componentModel;
+ }
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ UnregisterFindResultsLibraryManager();
+
+ DisposeVisualStudioDocumentTrackingService();
+
+ UnregisterAnalyzerTracker();
+
+ ReportSessionWideTelemetry();
+
+ if (_solutionBuildMonitor != null)
+ {
+ _solutionBuildMonitor.Dispose();
+ _solutionBuildMonitor = null;
+ }
+
+ base.Dispose(disposing);
+ }
+
+ private void ReportSessionWideTelemetry()
+ {
+ PersistedVersionStampLogger.LogSummary();
+ }
+
+ private void RegisterFindResultsLibraryManager()
+ {
+ var objectManager = this.GetService(typeof(SVsObjectManager)) as IVsObjectManager2;
+ if (objectManager != null)
+ {
+ _libraryManager = new LibraryManager(this);
+
+ if (ErrorHandler.Failed(objectManager.RegisterSimpleLibrary(_libraryManager, out _libraryManagerCookie)))
+ {
+ _libraryManagerCookie = 0;
+ }
+
+ ((IServiceContainer)this).AddService(typeof(LibraryManager), _libraryManager, promote: true);
+ }
+ }
+
+ private void UnregisterFindResultsLibraryManager()
+ {
+ if (_libraryManagerCookie != 0)
+ {
+ var objectManager = this.GetService(typeof(SVsObjectManager)) as IVsObjectManager2;
+ if (objectManager != null)
+ {
+ objectManager.UnregisterLibrary(_libraryManagerCookie);
+ _libraryManagerCookie = 0;
+ }
+
+ ((IServiceContainer)this).RemoveService(typeof(LibraryManager), promote: true);
+ _libraryManager = null;
+ }
+ }
+
+ private void DisposeVisualStudioDocumentTrackingService()
+ {
+ if (_workspace != null)
+ {
+ var documentTrackingService = _workspace.Services.GetService() as VisualStudioDocumentTrackingService;
+ documentTrackingService.Dispose();
+ }
+ }
+
+ private void LoadAnalyzerNodeComponents()
+ {
+ _analyzerTracker = this.ComponentModel.GetService();
+ if (_analyzerTracker != null)
+ {
+ _analyzerTracker.Register();
+ }
+
+ var analyzerCommandHandler = this.ComponentModel.GetService();
+ if (analyzerCommandHandler != null)
+ {
+ analyzerCommandHandler.Initialize((IMenuCommandService)this.GetService(typeof(IMenuCommandService)));
+ }
+ }
+
+ private void UnregisterAnalyzerTracker()
+ {
+ if (_analyzerTracker != null)
+ {
+ _analyzerTracker.Unregister();
+ _analyzerTracker = null;
+ }
+ }
+ }
+}
diff --git a/src/VisualStudio/Setup/VSPackage.Designer.cs b/src/VisualStudio/Setup/VSPackage.Designer.cs
new file mode 100644
index 0000000000000000000000000000000000000000..35bd1b730584acbe0783b678972e1a505496953e
--- /dev/null
+++ b/src/VisualStudio/Setup/VSPackage.Designer.cs
@@ -0,0 +1,72 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.0
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace Roslyn.VisualStudio.Setup {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class VSPackage {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal VSPackage() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Roslyn.VisualStudio.Setup.VSPackage", typeof(VSPackage).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Workspace.
+ ///
+ internal static string WorkspaceOutputPaneTitle {
+ get {
+ return ResourceManager.GetString("WorkspaceOutputPaneTitle", resourceCulture);
+ }
+ }
+ }
+}
diff --git a/src/VisualStudio/Setup/VSPackage.resx b/src/VisualStudio/Setup/VSPackage.resx
new file mode 100644
index 0000000000000000000000000000000000000000..685d4b8aea9f0eb92d0cfbf191c1b9b6f696d315
--- /dev/null
+++ b/src/VisualStudio/Setup/VSPackage.resx
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ Workspace
+
+
\ No newline at end of file
diff --git a/src/VisualStudio/Setup/VisualBasicPackageRegistration.pkgdef b/src/VisualStudio/Setup/VisualBasicPackageRegistration.pkgdef
new file mode 100644
index 0000000000000000000000000000000000000000..0978adc0d045417f185724b05167df4e7b20da8c
--- /dev/null
+++ b/src/VisualStudio/Setup/VisualBasicPackageRegistration.pkgdef
@@ -0,0 +1,90 @@
+[$RootKey$\Editors]
+
+[$RootKey$\Editors\{6C33E1AA-1401-4536-AB67-0E21E6E569DA}]
+"Package"="{574FC912-F74F-4B4E-92C3-F695C208A2BB}"
+"DisplayName"="#1012"
+"CommonPhysicalViewAttributes"=dword:00000003
+"ExcludeDefTextEditor"=dword:00000001
+"EditorTrustLevel"=dword:00000002
+"LinkedEditorGuid"="{2C015C70-C72C-11D0-88C3-00A0C9110049}"
+@="Microsoft Visual Basic Editor with Encoding"
+
+[$RootKey$\Editors\{6C33E1AA-1401-4536-AB67-0E21E6E569DA}\LogicalViews]
+"{7651a700-06e5-11d1-8ebd-00a0c90f26ea}"=""
+"{7651a701-06e5-11d1-8ebd-00a0c90f26ea}"=""
+"{7651a703-06e5-11d1-8ebd-00a0c90f26ea}"=""
+"{7651a702-06e5-11d1-8ebd-00a0c90f26ea}"="Form"
+
+[$RootKey$\Editors\{6C33E1AA-1401-4536-AB67-0E21E6E569DA}\UntrustedLogicalViews]
+"{7651a702-06e5-11d1-8ebd-00a0c90f26ea}"="Form"
+
+[$RootKey$\Editors\{6C33E1AA-1401-4536-AB67-0E21E6E569DA}\Extensions]
+"bas"=dword:00000027
+"cls"=dword:00000027
+"frm"=dword:00000027
+"dob"=dword:00000027
+"dsr"=dword:00000027
+"pag"=dword:00000027
+"ctl"=dword:00000027
+"vb"=dword:00000027
+
+[$RootKey$\Editors\{2C015C70-C72C-11D0-88C3-00A0C9110049}]
+"Package"="{574FC912-F74F-4B4E-92C3-F695C208A2BB}"
+"DisplayName"="#1013"
+"CommonPhysicalViewAttributes"=dword:00000002
+"ExcludeDefTextEditor"=dword:00000001
+"EditorTrustLevel"=dword:00000002
+@="Microsoft Visual Basic Editor"
+
+[$RootKey$\Editors\{2C015C70-C72C-11D0-88C3-00A0C9110049}\LogicalViews]
+"{7651a700-06e5-11d1-8ebd-00a0c90f26ea}"=""
+"{7651a701-06e5-11d1-8ebd-00a0c90f26ea}"=""
+"{7651a703-06e5-11d1-8ebd-00a0c90f26ea}"=""
+"{7651a702-06e5-11d1-8ebd-00a0c90f26ea}"="Form"
+
+[$RootKey$\Editors\{2C015C70-C72C-11D0-88C3-00A0C9110049}\PhysicalViewAttributes]
+"Form"=dword:00000003
+
+[$RootKey$\Editors\{2C015C70-C72C-11D0-88C3-00A0C9110049}\UntrustedLogicalViews]
+"{7651a702-06e5-11d1-8ebd-00a0c90f26ea}"="Form"
+
+[$RootKey$\Editors\{2C015C70-C72C-11D0-88C3-00A0C9110049}\Extensions]
+"bas"=dword:00000028
+"cls"=dword:00000028
+"frm"=dword:00000028
+"dob"=dword:00000028
+"dsr"=dword:00000028
+"pag"=dword:00000028
+"ctl"=dword:00000028
+"vb"=dword:00000028
+
+[$RootKey$\FileExtensionMapping\{4EFF8F38-5CAD-44D4-BA53-E9F0FC152D1F}]
+"DisplayName"="#108"
+"EditorGUID"="{2C015C70-C72C-11D0-88C3-00A0C9110049}"
+"LogViewID"="{E34ACDC0-BAAE-11D0-88BF-00A0C9110049}"
+"Package"="{574FC912-F74F-4B4E-92C3-F695C208A2BB}"
+"SortPriority"=dword:00000064
+@="Microsoft Visual Basic"
+
+[$RootKey$\Languages\Language Services\Basic]
+@="{e34acdc0-baae-11d0-88bf-00a0c9110049}"
+"Package"="{574fc912-f74f-4b4e-92c3-f695c208a2bb}"
+"LangResID"=dword:00000000
+
+"DefaultToInsertSpaces"=dword:00000001
+"HideAdvancedMembersByDefault"=dword:00000001
+"RequestStockColors"=dword:00000001
+"ShowBraceCompletion"=dword:00000001
+"ShowCompletion"=dword:00000001
+"ShowDropdownBarOption"=dword:00000001
+"ShowSmartIndent"=dword:00000001
+"SupportsImageCaching"=dword:00000001
+"Single Code Window Only"=dword:00000000
+// DesignerLoader is still set in VBLanguageService.pkgdef in the main product setup authoring since that needs to differ between Dev12 and Dev14.
+
+[$RootKey$\Text Editor\Basic]
+"Insert Tabs"=dword:00000000
+"Indent Style"=dword:00000002
+
+[$RootKey$\VB Editor\Roslyn]
+"DisplayLineSeparators"=dword:00000001
\ No newline at end of file
diff --git a/src/VisualStudio/Components/VisualStudioComponents.csproj b/src/VisualStudio/Setup/VisualStudioSetup.csproj
similarity index 64%
rename from src/VisualStudio/Components/VisualStudioComponents.csproj
rename to src/VisualStudio/Setup/VisualStudioSetup.csproj
index 59a3d3cbbadd7d92df554e18999446ebdd536350..097ce288ad2136448d8463fe4759a8e7fe38e510 100644
--- a/src/VisualStudio/Components/VisualStudioComponents.csproj
+++ b/src/VisualStudio/Setup/VisualStudioSetup.csproj
@@ -10,140 +10,122 @@
{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
{201EC5B7-F91E-45E5-B9F2-67A266CCE6FC}
Library
- Roslyn.VisualStudio.Components
- Roslyn.VisualStudio.Components
+ Roslyn.VisualStudio.Setup
+ Roslyn.VisualStudio.Setup
true
+ true
RoslynDev
- false
+ true
false
false
- true
$(VisualStudioVersion)
true
..\..\..\
true
+
+ OFFICIAL_BUILD
+
{1EE8CAD3-55F9-4D91-96B2-084641DA9A6C}
CodeAnalysis
- BuiltProjectOutputGroup
- DebugSymbolsProjectOutputGroup
{DFA21CA1-7F96-47EE-940C-069858E81727}
CodeAnalysis.Desktop
- BuiltProjectOutputGroup
- DebugSymbolsProjectOutputGroup
{B501A547-C911-4A05-AC6E-274A50DFF30E}
CSharpCodeAnalysis
- BuiltProjectOutputGroup
- DebugSymbolsProjectOutputGroup
{079AF8EF-1058-48B6-943F-AB02D39E0641}
CSharpCodeAnalysis.Desktop
- BuiltProjectOutputGroup
- DebugSymbolsProjectOutputGroup
{2523D0E6-DF32-4A3E-8AE0-A19BFFAE2EF6}
BasicCodeAnalysis
- BuiltProjectOutputGroup
- DebugSymbolsProjectOutputGroup
{73F3E2C5-D742-452E-B9E1-20732DDBC75D}
BasicCodeAnalysis.Desktop
- BuiltProjectOutputGroup
- DebugSymbolsProjectOutputGroup
{2e87fa96-50bb-4607-8676-46521599f998}
Workspaces.Desktop
- BuiltProjectOutputGroup
- DebugSymbolsProjectOutputGroup
{687daffd-9bd9-4331-96b7-483b941edeaa}
CSharpWorkspace.Desktop
- BuiltProjectOutputGroup
- DebugSymbolsProjectOutputGroup
{e637ad92-8397-4337-a9cd-9f2570078e59}
BasicWorkspace.Desktop
- BuiltProjectOutputGroup
- DebugSymbolsProjectOutputGroup
{A1BCD0CE-6C2F-4F8C-9A48-D9D93928E26D}
BasicFeatures
- BuiltProjectOutputGroup
- DebugSymbolsProjectOutputGroup
{3973B09A-4FBF-44A5-8359-3D22CEB71F71}
CSharpFeatures
- BuiltProjectOutputGroup
- DebugSymbolsProjectOutputGroup
{B0CE9307-FFDB-4838-A5EC-CE1F7CDC4AC2}
CSharpEditorFeatures
- BuiltProjectOutputGroup
- DebugSymbolsProjectOutputGroup
{3CDEEAB7-2256-418A-BEB2-620B5CB16302}
EditorFeatures
- BuiltProjectOutputGroup
- DebugSymbolsProjectOutputGroup
{EDC68A0E-C68D-4A74-91B7-BF38EC909888}
Features
- BuiltProjectOutputGroup
- DebugSymbolsProjectOutputGroup
{18F5FBB8-7570-4412-8CC7-0A86FF13B7BA}
TextEditorFeatures
- BuiltProjectOutputGroup
- DebugSymbolsProjectOutputGroup
{49BFAE50-1BCE-48AE-BC89-78B7D90A3ECD}
BasicEditorFeatures
- BuiltProjectOutputGroup
- DebugSymbolsProjectOutputGroup
{5F8D2414-064A-4B3A-9B42-8E2A04246BE5}
Workspaces
- BuiltProjectOutputGroup
- DebugSymbolsProjectOutputGroup
{21B239D0-D144-430F-A394-C066D58EE267}
CSharpWorkspace
- BuiltProjectOutputGroup
- DebugSymbolsProjectOutputGroup
{57CA988D-F010-4BF2-9A2E-07D6DCD2FF2C}
BasicWorkspace
- BuiltProjectOutputGroup
- DebugSymbolsProjectOutputGroup
-
+
{86FD5B9A-4FA0-4B10-B59F-CFAF077A859C}
ServicesVisualStudio
- BuiltProjectOutputGroup
- DebugSymbolsProjectOutputGroup
+
+ {c0e80510-4fbe-4b0c-af2c-4f473787722c}
+ ServicesVisualStudioImpl
+
+
+ {7BE3DEEB-87F8-4E15-9C21-4F94B0B1C2D6}
+ SolutionExplorerShim
+
+
+ {5defadbd-44eb-47a2-a53e-f1282cc9e4e9}
+ CSharpVisualStudio
+
+
+ {d49439d7-56d2-450f-a4f0-74cb95d620e6}
+ BasicVisualStudio
+
+
+
+
@@ -160,19 +142,20 @@
Designer
-
-
- true
- $(PkgdefVSIXSubPath)
-
-
False
..\..\..\packages\ManagedEsent.1.9.2.0\lib\net40\Esent.Interop.dll
+
+
+
+
+
+
+
False
@@ -184,15 +167,41 @@
..\..\References\MetadataReader\System.Reflection.Metadata.dll
-
- OFFICIAL_BUILD
-
+
+
+ true
+ VSPackage
+ ResXFileCodeGenerator
+ VSPackage.Designer.cs
+
+
+
+
+ Menus.ctmenu
+ Designer
+
+
+
+
+
+
+ True
+ True
+ VSPackage.resx
+
+
+ true
+
+
+ true
+
+
-
+
\ No newline at end of file
diff --git a/src/VisualStudio/Setup/WorkspaceFailureOutputPane.cs b/src/VisualStudio/Setup/WorkspaceFailureOutputPane.cs
new file mode 100644
index 0000000000000000000000000000000000000000..e37ee4a3a93071152774cfc9e77a4ad84052545f
--- /dev/null
+++ b/src/VisualStudio/Setup/WorkspaceFailureOutputPane.cs
@@ -0,0 +1,73 @@
+// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
+using Microsoft.VisualStudio.Shell.Interop;
+using Roslyn.VisualStudio.Setup;
+
+namespace Microsoft.VisualStudio.LanguageServices.Setup
+{
+ internal class WorkspaceFailureOutputPane : ForegroundThreadAffinitizedObject
+ {
+ private static readonly Guid s_workspacePaneGuid = new Guid("53D7CABD-085E-46AF-ACCA-EF5A640641CA");
+
+ private readonly IServiceProvider _serviceProvider;
+ private readonly Workspace _workspace;
+
+ public WorkspaceFailureOutputPane(IServiceProvider serviceProvider, Workspace workspace)
+ {
+ _serviceProvider = serviceProvider;
+ _workspace = workspace;
+ _workspace.WorkspaceFailed += OnWorkspaceFailed;
+ }
+
+ private void OnWorkspaceFailed(object sender, WorkspaceDiagnosticEventArgs e)
+ {
+ InvokeBelowInputPriority(() =>
+ {
+ var outputPane = this.OutputPane;
+ if (outputPane == null)
+ {
+ return;
+ }
+
+ outputPane.OutputString(e.Diagnostic.ToString() + Environment.NewLine);
+ });
+ }
+
+ private IVsOutputWindowPane _doNotAccessDirectlyOutputPane;
+
+ private IVsOutputWindowPane OutputPane
+ {
+ get
+ {
+ AssertIsForeground();
+
+ if (_doNotAccessDirectlyOutputPane == null)
+ {
+ var outputWindow = (IVsOutputWindow)_serviceProvider.GetService(typeof(SVsOutputWindow));
+
+ // Try to get the workspace pane if it has already been registered
+ var workspacePaneGuid = s_workspacePaneGuid;
+ var hr = outputWindow.GetPane(ref workspacePaneGuid, out _doNotAccessDirectlyOutputPane);
+
+ // If the workspace pane has not been registered before, create it
+ if (_doNotAccessDirectlyOutputPane == null || hr != VSConstants.S_OK)
+ {
+ if (ErrorHandler.Failed(outputWindow.CreatePane(ref workspacePaneGuid, VSPackage.WorkspaceOutputPaneTitle, fInitVisible: 1, fClearWithSolution: 1)) ||
+ ErrorHandler.Failed(outputWindow.GetPane(ref workspacePaneGuid, out _doNotAccessDirectlyOutputPane)))
+ {
+ return null;
+ }
+
+ // Must activate the workspace pane for it to show up in the output window
+ _doNotAccessDirectlyOutputPane.Activate();
+ }
+ }
+
+ return _doNotAccessDirectlyOutputPane;
+ }
+ }
+ }
+}
diff --git a/src/VisualStudio/Components/packages.config b/src/VisualStudio/Setup/packages.config
similarity index 100%
rename from src/VisualStudio/Components/packages.config
rename to src/VisualStudio/Setup/packages.config
diff --git a/src/VisualStudio/Components/source.extension.vsixmanifest b/src/VisualStudio/Setup/source.extension.vsixmanifest
similarity index 69%
rename from src/VisualStudio/Components/source.extension.vsixmanifest
rename to src/VisualStudio/Setup/source.extension.vsixmanifest
index 71bd81c529355c30969bb92261b71b6f2ea2629e..455b70ee7f43efd7c87ec3b8671ee738a0c373ab 100644
--- a/src/VisualStudio/Components/source.extension.vsixmanifest
+++ b/src/VisualStudio/Setup/source.extension.vsixmanifest
@@ -2,8 +2,8 @@
- Roslyn Components
- Core Roslyn components for Visual Studio.
+ Roslyn Language Services
+ C# and VB.NET language services for Visual Studio.
@@ -15,7 +15,7 @@
-
+
@@ -30,6 +30,14 @@
+
+
+
+
+
+
+
+
@@ -39,4 +47,4 @@
-
\ No newline at end of file
+
diff --git a/src/VisualStudio/SetupInteractive/VisualStudioSetupInteractive.csproj b/src/VisualStudio/SetupInteractive/VisualStudioSetupInteractive.csproj
index b172c6bdfb0bdfbca6d2884c22aa4257b3aa1a09..df34afdbef8ea04422aa1e9090df09824fc4a5a9 100644
--- a/src/VisualStudio/SetupInteractive/VisualStudioSetupInteractive.csproj
+++ b/src/VisualStudio/SetupInteractive/VisualStudioSetupInteractive.csproj
@@ -62,7 +62,7 @@
BuiltProjectOutputGroup%3bPkgDefProjectOutputGroup
DebugSymbolsProjectOutputGroup
-
+
{201ec5b7-f91e-45e5-b9f2-67a266cce6fc}
VisualStudioComponents
false
@@ -142,4 +142,4 @@
-
+
\ No newline at end of file
diff --git a/src/VisualStudio/VisualStudioInteractiveComponents/VisualStudioInteractiveComponents.csproj b/src/VisualStudio/VisualStudioInteractiveComponents/VisualStudioInteractiveComponents.csproj
index 18410d8e3682bcc7607004e690cd846b7fd1befe..3f0f88acd0a4c701f600a90d3c94805f7b6c749b 100644
--- a/src/VisualStudio/VisualStudioInteractiveComponents/VisualStudioInteractiveComponents.csproj
+++ b/src/VisualStudio/VisualStudioInteractiveComponents/VisualStudioInteractiveComponents.csproj
@@ -115,9 +115,9 @@
BuiltProjectOutputGroup
DebugSymbolsProjectOutputGroup
-
+
{201EC5B7-F91E-45E5-B9F2-67A266CCE6FC}
- VisualStudioComponents
+ VisualStudioSetup
false
diff --git a/src/VisualStudio/VisualStudioInteractiveComponents/source.extension.vsixmanifest b/src/VisualStudio/VisualStudioInteractiveComponents/source.extension.vsixmanifest
index 6206e9f7b17eaf1670d13d5888ab521a6dfc2190..9c564bc3bf8e21a414dd97067dd41a94e7a1f024 100644
--- a/src/VisualStudio/VisualStudioInteractiveComponents/source.extension.vsixmanifest
+++ b/src/VisualStudio/VisualStudioInteractiveComponents/source.extension.vsixmanifest
@@ -13,7 +13,7 @@
-
+
@@ -22,4 +22,4 @@
-
\ No newline at end of file
+
diff --git a/src/Workspaces/CSharpTest/Formatting/FormattingTests.cs b/src/Workspaces/CSharpTest/Formatting/FormattingTests.cs
index 504e6ef37ed70e1c62e40465fc07e61ce4e25933..b54c19ab969020a5f25aa4de5df976062754cd83 100644
--- a/src/Workspaces/CSharpTest/Formatting/FormattingTests.cs
+++ b/src/Workspaces/CSharpTest/Formatting/FormattingTests.cs
@@ -5872,5 +5872,46 @@ static string F(int a, int b, int c)
}
}");
}
+
+ [WorkItem(62)]
+ [Fact, Trait(Traits.Feature, Traits.Features.Formatting)]
+ public void SpaceAfterWhenInExceptionFilter()
+ {
+ const string expected = @"class C
+{
+ void M()
+ {
+ try
+ {
+ if (x)
+ {
+ G();
+ }
+ }
+ catch (Exception e) when (H(e))
+ {
+
+ }
+ }
+}";
+
+ const string code = @"class C
+{
+ void M()
+ {
+ try
+ {
+ if(x){
+ G();
+ }
+ }
+ catch(Exception e) when (H(e))
+ {
+
+ }
+ }
+}";
+ AssertFormat(expected, code);
+ }
}
}
diff --git a/src/Workspaces/Core/Desktop/Workspaces.Desktop.csproj b/src/Workspaces/Core/Desktop/Workspaces.Desktop.csproj
index f1130ae2dc69a43e1b3024c0a570470fbfaa88f3..c15f1a2361ab77b18babefebd681abbfe9a69cb6 100644
--- a/src/Workspaces/Core/Desktop/Workspaces.Desktop.csproj
+++ b/src/Workspaces/Core/Desktop/Workspaces.Desktop.csproj
@@ -138,6 +138,7 @@
+
diff --git a/src/Workspaces/Core/Portable/Shared/Utilities/DocumentationComment.cs b/src/Workspaces/Core/Portable/Shared/Utilities/DocumentationComment.cs
index 1258a506c43706798c667668acf92148132eb0bf..1c33bf3eb3c607a65fd9ee2ff7f3c8632f296a0d 100644
--- a/src/Workspaces/Core/Portable/Shared/Utilities/DocumentationComment.cs
+++ b/src/Workspaces/Core/Portable/Shared/Utilities/DocumentationComment.cs
@@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
+using System.Threading;
using System.Xml;
using XmlNames = Roslyn.Utilities.DocumentationCommentXmlNames;
@@ -71,6 +72,11 @@ private DocumentationComment()
ExceptionTypes = ImmutableArray.Empty;
}
+ ///
+ /// Cache of the most recently parsed fragment and the resulting DocumentationComment
+ ///
+ private static volatile DocumentationComment s_cacheLastXmlFragmentParse;
+
///
/// Parses and constructs a from the given fragment of XML.
///
@@ -78,7 +84,15 @@ private DocumentationComment()
/// A DocumentationComment instance.
public static DocumentationComment FromXmlFragment(string xml)
{
- return CommentBuilder.Parse(xml);
+ var result = s_cacheLastXmlFragmentParse;
+ if (result == null || result.FullXmlFragment != xml)
+ {
+ // Cache miss
+ result = CommentBuilder.Parse(xml);
+ s_cacheLastXmlFragmentParse = result;
+ }
+
+ return result;
}
///
diff --git a/src/Workspaces/Core/Portable/Workspaces.csproj b/src/Workspaces/Core/Portable/Workspaces.csproj
index 7c013062a3cd975efbbe88a4c667be81817bbd99..97e7ded69006e130fda7e3c5c2f2345d7d10742f 100644
--- a/src/Workspaces/Core/Portable/Workspaces.csproj
+++ b/src/Workspaces/Core/Portable/Workspaces.csproj
@@ -249,6 +249,7 @@
+
@@ -928,4 +929,4 @@
-
\ No newline at end of file
+