public static string GetInsertionText(ISymbol symbol, SyntaxContext context) { if (CommonCompletionUtilities.TryRemoveAttributeSuffix(symbol, context, out var name)) { // Cannot escape Attribute name with the suffix removed. Only use the name with // the suffix removed if it does not need to be escaped. if (name.Equals(name.EscapeIdentifier())) { return(name); } } return(symbol.Name.EscapeIdentifier(isQueryContext: context.IsInQuery)); }
public static string GetInsertionText(ISymbol symbol, AbstractSyntaxContext context) { string name; if (CommonCompletionUtilities.TryRemoveAttributeSuffix(symbol, context.IsAttributeNameContext, context.GetLanguageService <ISyntaxFactsService>(), out name)) { // Cannot escape Attribute name with the suffix removed. Only use the name with // the suffix removed if it does not need to be escaped. if (name.Equals(name.EscapeIdentifier())) { return(name); } } return(symbol.Name.EscapeIdentifier(isQueryContext: context.IsInQuery)); }
public static string GetInsertionText(ISymbol symbol, SyntaxContext context) { if (CommonCompletionUtilities.TryRemoveAttributeSuffix(symbol, context, out var name)) { // Cannot escape Attribute name with the suffix removed. Only use the name with // the suffix removed if it does not need to be escaped. if (name.Equals(name.EscapeIdentifier())) { return(name); } } if (symbol.Kind == SymbolKind.Label && symbol.DeclaringSyntaxReferences[0].GetSyntax().Kind() == SyntaxKind.DefaultSwitchLabel) { return(symbol.Name); } return(symbol.Name.EscapeIdentifier(isQueryContext: context.IsInQuery)); }