public Response altaPromociones(Root json, Token token) { var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json"); var configuration = builder.Build(); postCardAssignCatalog postCardAssign; Response responseContent; postCardAssign = new postCardAssignCatalog(); string AltaPromociones = string.Empty; AltaPromociones = configuration["AltaPromociones"]; try { var jsonString = JsonConvert.SerializeObject(json); var data = new StringContent(jsonString, Encoding.UTF8, "application/json"); responseContent = SyncHelper.RunSync <Response>(() => postCardAssign.postCardAssingCatalogAsync(data, AltaPromociones, token)); return(responseContent); } catch (Exception ex) { throw ex; } }
internal static void FindReferrers(this SemanticContext context, ISymbol symbol, Predicate <ISymbol> definitionFilter = null, Predicate <SyntaxNode> nodeFilter = null) { var referrers = SyncHelper.RunSync(() => symbol.FindReferrersAsync(context.Document.Project, definitionFilter, nodeFilter)); if (referrers == null) { return; } var m = new SymbolMenu(context, SymbolListType.SymbolReferrers); m.Title.SetGlyph(ThemeHelper.GetImage(symbol.GetImageId())) .Append(symbol.ToDisplayString(CodeAnalysisHelper.MemberNameFormat), true) .Append(R.T_Referrers); var containerType = symbol.ContainingType; foreach (var(referrer, occurance) in referrers) { var s = referrer; var i = m.Menu.Add(s, false); i.Location = occurance.FirstOrDefault().Item2.Location; foreach (var item in occurance) { i.Usage |= item.Item1; } if (s.ContainingType != containerType) { i.Hint = (s.ContainingType ?? s).ToDisplayString(CodeAnalysisHelper.MemberNameFormat); } } m.Menu.ExtIconProvider = ExtIconProvider.Default.GetExtIconsWithUsage; m.Show(); }
public Token obtenerToken() { string UserName = string.Empty; string Password = string.Empty; string Scope = string.Empty; string Authorization = string.Empty; string Grant_Type = string.Empty; string TokenPromociones = string.Empty; getToken token; Token responseToken; Credenciales credencial; var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json"); var configuration = builder.Build(); try { UserName = configuration["username"]; Password = configuration["password"]; Scope = configuration["scope"]; Authorization = configuration["authorization"]; Grant_Type = configuration["grant_type"]; TokenPromociones = configuration["TokenPromociones"]; credencial = new Credenciales(); credencial.scope = Scope; credencial.username = UserName; credencial.grant_type = Grant_Type; credencial.password = Password; credencial.authorization = Authorization; credencial.uriToken = TokenPromociones; responseToken = new Token(); token = new getToken(); responseToken = SyncHelper.RunSync <Token>(() => token.getTokenAsync(credencial)); return(responseToken); } catch (Exception ex) { throw ex; } }
public IEnumerable <ITagSpan <IClassificationTag> > GetTags(NormalizedSnapshotSpanCollection spans) { ITextSnapshot snapshot = null; Workspace workspace = null; SemanticModel semanticModel = null; foreach (var span in spans) { if (snapshot != span.Snapshot) { snapshot = span.Snapshot; if (workspace == null) { workspace = snapshot.TextBuffer.GetWorkspace(); } if (workspace == null) { yield break; } if (semanticModel == null) { semanticModel = SyncHelper.RunSync(() => workspace.GetDocument(span).GetSemanticModelAsync()); } } var textSpan = new TextSpan(span.Start.Position, span.Length); var unitCompilation = semanticModel.SyntaxTree.GetCompilationUnitRoot(); var classifiedSpans = Classifier.GetClassifiedSpans(semanticModel, textSpan, workspace); var lastTriviaSpan = default(TextSpan); SyntaxNode node; var r = GetAttributeNotationSpan(snapshot, textSpan, unitCompilation); if (r != null) { yield return(r); } foreach (var item in classifiedSpans) { var ct = item.ClassificationType; switch (ct) { case "keyword": case Constants.CodeKeywordControl: { node = unitCompilation.FindNode(item.TextSpan, true, true); if (node is MemberDeclarationSyntax || node is AccessorDeclarationSyntax) { switch (unitCompilation.FindToken(item.TextSpan.Start).Kind()) { case SyntaxKind.SealedKeyword: case SyntaxKind.OverrideKeyword: case SyntaxKind.AbstractKeyword: case SyntaxKind.VirtualKeyword: case SyntaxKind.ProtectedKeyword: case SyntaxKind.NewKeyword: yield return(CreateClassificationSpan(snapshot, item.TextSpan, _Classifications.AbstractionKeyword)); continue; case SyntaxKind.ThisKeyword: yield return(CreateClassificationSpan(snapshot, item.TextSpan, _Classifications.Declaration)); continue; case SyntaxKind.UnsafeKeyword: case SyntaxKind.FixedKeyword: yield return(CreateClassificationSpan(snapshot, item.TextSpan, _Classifications.ResourceKeyword)); continue; case SyntaxKind.ExplicitKeyword: case SyntaxKind.ImplicitKeyword: yield return(CreateClassificationSpan(snapshot, item.TextSpan, _GeneralClassifications.TypeCastKeyword)); yield return(CreateClassificationSpan(snapshot, ((ConversionOperatorDeclarationSyntax)node).Type.Span, _Classifications.NestedDeclaration)); continue; case SyntaxKind.ReadOnlyKeyword: yield return(CreateClassificationSpan(snapshot, item.TextSpan, _GeneralClassifications.TypeCastKeyword)); continue; } continue; } switch (node.Kind()) { case SyntaxKind.BreakStatement: if (node.Parent is SwitchSectionSyntax) { continue; } goto case SyntaxKind.ReturnStatement; // highlights: return, yield return, yield break, throw and continue case SyntaxKind.ReturnKeyword: case SyntaxKind.GotoCaseStatement: case SyntaxKind.GotoDefaultStatement: case SyntaxKind.GotoStatement: case SyntaxKind.ContinueStatement: case SyntaxKind.ReturnStatement: case SyntaxKind.YieldReturnStatement: case SyntaxKind.YieldBreakStatement: case SyntaxKind.ThrowStatement: case SyntaxKind.ThrowExpression: yield return(CreateClassificationSpan(snapshot, item.TextSpan, _GeneralClassifications.ControlFlowKeyword)); continue; case SyntaxKind.IfStatement: case SyntaxKind.ElseClause: case SyntaxKind.SwitchStatement: case SyntaxKind.CaseSwitchLabel: case SyntaxKind.DefaultSwitchLabel: case (SyntaxKind)9025: // switch expression case SyntaxKind.CasePatternSwitchLabel: case SyntaxKind.WhenClause: yield return(CreateClassificationSpan(snapshot, item.TextSpan, _GeneralClassifications.BranchingKeyword)); continue; case SyntaxKind.ForStatement: case SyntaxKind.ForEachStatement: case SyntaxKind.ForEachVariableStatement: case SyntaxKind.WhileStatement: case SyntaxKind.DoStatement: case SyntaxKind.SelectClause: case SyntaxKind.FromClause: yield return(CreateClassificationSpan(snapshot, item.TextSpan, _GeneralClassifications.LoopKeyword)); continue; case SyntaxKind.UsingStatement: case SyntaxKind.FixedStatement: case SyntaxKind.LockStatement: case SyntaxKind.UnsafeStatement: case SyntaxKind.TryStatement: case SyntaxKind.CatchClause: case SyntaxKind.CatchFilterClause: case SyntaxKind.FinallyClause: case SyntaxKind.StackAllocArrayCreationExpression: case (SyntaxKind)9053: // implicit stackalloc yield return(CreateClassificationSpan(snapshot, item.TextSpan, _Classifications.ResourceKeyword)); continue; case SyntaxKind.LocalDeclarationStatement: if (unitCompilation.FindToken(item.TextSpan.Start, true).Kind() == SyntaxKind.UsingKeyword) { goto case SyntaxKind.UsingStatement; } continue; case SyntaxKind.IsExpression: case SyntaxKind.IsPatternExpression: case SyntaxKind.AsExpression: case SyntaxKind.RefExpression: case SyntaxKind.RefType: case SyntaxKind.CheckedExpression: case SyntaxKind.CheckedStatement: case SyntaxKind.UncheckedExpression: case SyntaxKind.UncheckedStatement: yield return(CreateClassificationSpan(snapshot, item.TextSpan, _GeneralClassifications.TypeCastKeyword)); break; case SyntaxKind.Argument: case SyntaxKind.Parameter: case SyntaxKind.CrefParameter: switch (unitCompilation.FindToken(item.TextSpan.Start, true).Kind()) { case SyntaxKind.InKeyword: case SyntaxKind.OutKeyword: case SyntaxKind.RefKeyword: yield return(CreateClassificationSpan(snapshot, item.TextSpan, _GeneralClassifications.TypeCastKeyword)); continue; } break; case SyntaxKind.IdentifierName: if (node.Parent.IsKind(SyntaxKind.TypeConstraint) && item.TextSpan.Length == 9 && node.ToString() == "unmanaged") { goto case SyntaxKind.UnsafeStatement; } break; } continue; } case "operator": case Constants.CodeOverloadedOperator: { node = unitCompilation.FindNode(item.TextSpan); if (node.RawKind == (int)SyntaxKind.DestructorDeclaration) { yield return(CreateClassificationSpan(snapshot, item.TextSpan, _Classifications.Declaration)); yield return(CreateClassificationSpan(snapshot, item.TextSpan, _Classifications.ResourceKeyword)); continue; } var opMethod = semanticModel.GetSymbol(node.IsKind(SyntaxKind.Argument) ? ((ArgumentSyntax)node).Expression : node) as IMethodSymbol; if (opMethod?.MethodKind == MethodKind.UserDefinedOperator) { if (node.RawKind == (int)SyntaxKind.OperatorDeclaration) { yield return(CreateClassificationSpan(snapshot, item.TextSpan, _Classifications.Declaration)); } yield return(CreateClassificationSpan(snapshot, item.TextSpan, _Classifications.OverrideMember)); } continue; } case Constants.CodePunctuation: if (item.TextSpan.Length == 1) { var p = ClassifyPunctuation(item.TextSpan, snapshot, semanticModel, unitCompilation); if (p != null) { yield return(p); } } continue; default: if (ct == Constants.XmlDocDelimiter) { if (lastTriviaSpan.Contains(item.TextSpan)) { continue; } var trivia = unitCompilation.FindTrivia(item.TextSpan.Start); switch (trivia.Kind()) { case SyntaxKind.SingleLineDocumentationCommentTrivia: case SyntaxKind.MultiLineDocumentationCommentTrivia: case SyntaxKind.DocumentationCommentExteriorTrivia: lastTriviaSpan = trivia.FullSpan; yield return(CreateClassificationSpan(snapshot, lastTriviaSpan, _Classifications.XmlDoc)); continue; } } else if (ct == Constants.CodeIdentifier //|| ct == Constants.CodeStaticSymbol || ct.EndsWith("name", StringComparison.Ordinal)) { var itemSpan = item.TextSpan; node = unitCompilation.FindNode(itemSpan, true); foreach (var type in GetClassificationType(node, semanticModel)) { yield return(CreateClassificationSpan(snapshot, itemSpan, type)); } } break; } } } }
void AddContextualCommands(CancellationToken cancellationToken) { // anti-pattern for a small margin of performance bool isDesignMode = CodistPackage.DebuggerStatus == DebuggerStatus.Design; var isReadOnly = _Context.View.IsCaretInReadOnlyRegion(); var node = _Context.NodeIncludeTrivia; if (isDesignMode && isReadOnly == false && (node is XmlTextSyntax)) { AddXmlDocCommands(); return; } var trivia = _Context.GetNodeTrivia(); var nodeKind = node.Kind(); if (trivia.RawKind == 0) { var token = _Context.Token; if (token.Span.Contains(View.Selection, true) && token.Kind() == SyntaxKind.IdentifierToken) { if (nodeKind.IsDeclaration() || node is TypeSyntax || node is ParameterSyntax || nodeKind == SyntaxKind.VariableDeclarator || nodeKind == SyntaxKind.ForEachStatement || nodeKind == SyntaxKind.SingleVariableDesignation) { // selection is within a symbol _Symbol = SyncHelper.RunSync(() => _Context.GetSymbolAsync(cancellationToken)); if (_Symbol != null) { AddSymbolCommands(isReadOnly, node); } } else if (nodeKind == SyntaxKind.TypeParameter) { _Symbol = SyncHelper.RunSync(() => _Context.GetSymbolAsync(cancellationToken)); if (_Symbol != null && isReadOnly == false) { AddRenameCommand(node); } } } else if (token.RawKind >= (int)SyntaxKind.NumericLiteralToken && token.RawKind <= (int)SyntaxKind.StringLiteralToken) { AddEditorCommand(MyToolBar, IconIds.FindReference, "Edit.FindAllReferences", R.CMD_FindAllReferences); } else if (nodeKind.IsRegionalDirective()) { AddDirectiveCommands(); } if (isReadOnly == false) { if (token.IsKind(SyntaxKind.TrueKeyword) || token.IsKind(SyntaxKind.FalseKeyword)) { AddCommand(MyToolBar, IconIds.ToggleValue, R.CMD_ToggleValue, ctx => Replace(ctx, v => v == "true" ? "false" : "true", true)); } else if (token.IsKind(SyntaxKind.ExplicitKeyword) || token.IsKind(SyntaxKind.ImplicitKeyword)) { AddCommand(MyToolBar, IconIds.ToggleValue, R.CMD_ToggleOperator, ctx => Replace(ctx, v => v == "implicit" ? "explicit" : "implicit", true)); } if (nodeKind == SyntaxKind.VariableDeclarator) { if (node?.Parent?.Parent is MemberDeclarationSyntax) { AddCommand(MyToolBar, IconIds.AddXmlDoc, R.CMD_InsertComment, ctx => { TextEditorHelper.ExecuteEditorCommand("Edit.InsertComment"); ctx.View.Selection.Clear(); }); } } else if (nodeKind.IsDeclaration()) { if (node is TypeDeclarationSyntax || node is MemberDeclarationSyntax || node is ParameterListSyntax) { AddCommand(MyToolBar, IconIds.AddXmlDoc, R.CMD_InsertComment, ctx => { TextEditorHelper.ExecuteEditorCommand("Edit.InsertComment"); ctx.View.Selection.Clear(); }); } } else if (IsInvertableOperation(nodeKind)) { AddCommand(MyToolBar, IconIds.InvertOperator, R.CMD_InvertOperator, InvertOperator); } else if (isDesignMode && nodeKind != SyntaxKind.TypeParameter) { AddEditorCommand(MyToolBar, IconIds.ExtractMethod, "Refactor.ExtractMethod", R.CMD_ExtractMethod); } } } if (CodistPackage.DebuggerStatus != DebuggerStatus.Running && isReadOnly == false) { AddCommentCommands(); } if (isDesignMode == false) { AddCommands(MyToolBar, IconIds.ToggleBreakpoint, R.CMD_Debugger, ctx => TextEditorHelper.ExecuteEditorCommand("Debug.ToggleBreakpoint"), ctx => DebugCommands); } //AddCommands(MyToolBar, KnownImageIds.SelectFrame, "Expand selection...\nRight click: Duplicate...\nCtrl click item: Copy\nShift click item: Exclude whitespaces and comments", null, GetExpandSelectionCommands); }
public IList <ClassificationSpan> GetClassificationSpans(SnapshotSpan span) { if (Config.Instance.SpecialHighlightOptions.MatchFlags(SpecialHighlightOptions.SearchResult) == false) { goto NOT_FOUND; } var t = span.GetText(); // note: match pattern: [SPACE][SPACE]file name([NUMBER]):[CONTENT]\r\n var c1 = t.IndexOf(':'); // colon after drive letter if (--c1 < 0 || t[c1] < 'A' || t[c1] > 'Z' || (c1 > 0 && IsWhitespaceOnly(t, 0, c1) == false)) { goto NOT_FOUND; } var c2 = t.IndexOf(':', c1 + 2); // colon after file name and line number if (--c2 <= 0 || t[c2] != ')') { goto NOT_FOUND; } var b1 = t.LastIndexOf('(', c2 - 1, c2 - c1); if (b1 < 0) { goto NOT_FOUND; } var snapshot = span.Snapshot; var r = new List <ClassificationSpan> { new ClassificationSpan(new SnapshotSpan(snapshot, span.Start + c1, b1 - c1), __Url), new ClassificationSpan(new SnapshotSpan(snapshot, span.Start + b1 + 1, c2 - b1 - 1), __Number) }; var filePath = t.Substring(c1, b1 - c1); if (filePath.EndsWith(".cs", StringComparison.OrdinalIgnoreCase)) { int lineNumber; if (Int32.TryParse(t.Substring(b1 + 1, c2 - b1 - 1), out lineNumber)) { var docId = __Workspace.CurrentSolution.GetDocumentIdsWithFilePath(filePath).FirstOrDefault(); if (docId != null) { var semanticModel = SyncHelper.RunSync(() => __Workspace.CurrentSolution.GetDocument(docId).GetSemanticModelAsync()); var sourceText = semanticModel.SyntaxTree.GetText(); var lines = sourceText.Lines; if (lineNumber < lines.Count) { var sourceSpan = lines[lineNumber - 1].Span; var offset = (int)span.Start + c2 + 2 - sourceSpan.Start; // verify that the source text is the same as the find result if (t.Length >= c2 + 2 + sourceSpan.Length && t.IndexOf(sourceText.GetSubText(sourceSpan).ToString(), c2 + 2, sourceSpan.Length) >= 0) { var cs = Classifier.GetClassifiedSpans(semanticModel, sourceSpan, __Workspace); foreach (var item in cs) { r.Add(new ClassificationSpan(new SnapshotSpan(snapshot, offset + item.TextSpan.Start, item.TextSpan.Length), __ClassificationTypes.GetClassificationType(item.ClassificationType))); } } } } } } return(r); NOT_FOUND: return(Array.Empty <ClassificationSpan>()); bool IsWhitespaceOnly(string text, int start, int end) { for (int i = start; i < end; i++) { if (text[i] != ' ') { return(false); } } return(true); } }
void FindInProject(string text) { SyncHelper.RunSync(() => FindDeclarationsAsync(text, _Bar._cancellationSource.GetToken())); }
public IActionResult EjecutarAltaPendientes() { List <Pendientes> listPendientes = new List <Pendientes>(); ejecutarAltasPendientes pendientes = new ejecutarAltasPendientes(); var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json"); var configuration = builder.Build(); string AltaPromociones = string.Empty; postCardAssignCatalog postCardAssign; Response responseContent; Token responseToken; int pendientesEjecutadas = 0; try { AltaPromociones = configuration["AltaPromociones"]; postCardAssign = new postCardAssignCatalog(); gestionarToken token = new gestionarToken(); listPendientes = pendientes.ObtenerAltasPendientes(); responseToken = token.obtenerToken(); if (responseToken.AccessToken != null) { foreach (Pendientes pend in listPendientes) { var data = new StringContent(pend.json, Encoding.UTF8, "application/json"); Logger.LoggerMessage("Promociones API (pendientes): " + pend.json); responseContent = SyncHelper.RunSync <Response>(() => postCardAssign.postCardAssingCatalogAsync(data, AltaPromociones, responseToken)); if (responseContent != null && responseContent.StatusCode == 200) { pendientes.ActualizarEjecucionPendiente(pend); pendientesEjecutadas += 1; } } if (listPendientes.Count == 0) { Logger.LoggerMessage("Promociones API (pendientes): 200 - No se encontraron altas pendientes de ejecutar"); return(StatusCode(200, "No se encontraron altas pendientes de ejecutar")); } else if (pendientesEjecutadas == listPendientes.Count) { Logger.LoggerMessage("Promociones API (pendientes): 200 - Se ejecutaron " + pendientesEjecutadas + " altas pendientes de un total de " + listPendientes.Count); return(StatusCode(200, "200 - Se ejecutaron " + pendientesEjecutadas + " altas pendientes de un total de " + listPendientes.Count)); } else { Logger.LoggerMessage("Promociones API (pendientes): 202 - Se ejecutaron " + pendientesEjecutadas + " altas pendientes de un total de " + listPendientes.Count); return(StatusCode(202, "202 - Se ejecutaron " + pendientesEjecutadas + " altas pendientes de un total de " + listPendientes.Count)); } } else { Logger.LoggerMessage("Promociones API (pendientes): 401 - Error al obtener Token."); return(StatusCode(401, "Error al obtener Token.")); } } catch (Exception ex) { Logger.LoggerMessage("Promociones API (pendientes): 480 - Excepcion no controlada: " + ex.Message.ToString() + " - " + ex.InnerException.ToString()); return(StatusCode(480, "Excepcion no controlada: " + ex.Message.ToString() + " - " + ex.InnerException.ToString())); } }
public IList <ClassificationSpan> GetClassificationSpans(SnapshotSpan span) { var snapshot = span.Snapshot; var workspace = snapshot.TextBuffer.GetWorkspace(); if (workspace == null) { return(Array.Empty <ClassificationSpan>()); } var result = new List <ClassificationSpan>(16); var semanticModel = SyncHelper.RunSync(() => workspace.GetDocument(span).GetSemanticModelAsync()); var textSpan = new TextSpan(span.Start.Position, span.Length); var unitCompilation = semanticModel.SyntaxTree.GetCompilationUnitRoot(); var classifiedSpans = Classifier.GetClassifiedSpans(semanticModel, textSpan, workspace); var lastTriviaSpan = default(TextSpan); SyntaxNode node; GetAttributeNotationSpan(snapshot, result, textSpan, unitCompilation); foreach (var item in classifiedSpans) { var ct = item.ClassificationType; switch (ct) { case "keyword": case Constants.CodeKeywordControl: { node = unitCompilation.FindNode(item.TextSpan, true, true); if (node is MemberDeclarationSyntax) { switch (unitCompilation.FindToken(item.TextSpan.Start).Kind()) { case SyntaxKind.SealedKeyword: case SyntaxKind.OverrideKeyword: case SyntaxKind.AbstractKeyword: case SyntaxKind.VirtualKeyword: case SyntaxKind.NewKeyword: result.Add(CreateClassificationSpan(snapshot, item.TextSpan, _Classifications.AbstractionKeyword)); continue; } continue; } switch (node.Kind()) { case SyntaxKind.BreakStatement: if (node.Parent is SwitchSectionSyntax) { continue; } goto case SyntaxKind.ReturnStatement; // highlights: return, yield return, yield break, throw and continue case SyntaxKind.ReturnKeyword: case SyntaxKind.GotoCaseStatement: case SyntaxKind.GotoDefaultStatement: case SyntaxKind.GotoStatement: case SyntaxKind.ContinueStatement: case SyntaxKind.ReturnStatement: case SyntaxKind.YieldReturnStatement: case SyntaxKind.YieldBreakStatement: case SyntaxKind.ThrowStatement: case SyntaxKind.ThrowExpression: result.Add(CreateClassificationSpan(snapshot, item.TextSpan, _GeneralClassifications.ControlFlowKeyword)); continue; case SyntaxKind.IfStatement: case SyntaxKind.ElseClause: case SyntaxKind.SwitchStatement: case SyntaxKind.CaseSwitchLabel: case SyntaxKind.DefaultSwitchLabel: result.Add(CreateClassificationSpan(snapshot, item.TextSpan, _GeneralClassifications.BranchingKeyword)); continue; case SyntaxKind.ForStatement: case SyntaxKind.ForEachStatement: case SyntaxKind.ForEachVariableStatement: case SyntaxKind.WhileStatement: case SyntaxKind.DoStatement: case SyntaxKind.SelectClause: result.Add(CreateClassificationSpan(snapshot, item.TextSpan, _GeneralClassifications.LoopKeyword)); continue; case SyntaxKind.UsingStatement: case SyntaxKind.FixedStatement: case SyntaxKind.LockStatement: case SyntaxKind.UnsafeStatement: case SyntaxKind.TryStatement: case SyntaxKind.CatchClause: case SyntaxKind.CatchFilterClause: case SyntaxKind.FinallyClause: result.Add(CreateClassificationSpan(snapshot, item.TextSpan, _Classifications.ResourceKeyword)); continue; case SyntaxKind.IsExpression: case SyntaxKind.IsPatternExpression: case SyntaxKind.AsExpression: case SyntaxKind.RefExpression: case SyntaxKind.RefType: result.Add(CreateClassificationSpan(snapshot, item.TextSpan, _GeneralClassifications.TypeCastKeyword)); break; case SyntaxKind.Argument: case SyntaxKind.Parameter: case SyntaxKind.CrefParameter: switch (unitCompilation.FindToken(item.TextSpan.Start, true).Kind()) { case SyntaxKind.InKeyword: case SyntaxKind.OutKeyword: case SyntaxKind.RefKeyword: result.Add(CreateClassificationSpan(snapshot, item.TextSpan, _GeneralClassifications.TypeCastKeyword)); continue; } break; } continue; } case "operator": case Constants.CodeOverloadedOperator: { node = unitCompilation.FindNode(item.TextSpan); if (node.RawKind == (int)SyntaxKind.DestructorDeclaration) { result.Add(CreateClassificationSpan(snapshot, item.TextSpan, _Classifications.Declaration)); result.Add(CreateClassificationSpan(snapshot, item.TextSpan, _Classifications.ResourceKeyword)); continue; } var opMethod = semanticModel.GetSymbol(node.IsKind(SyntaxKind.Argument) ? ((ArgumentSyntax)node).Expression : node) as IMethodSymbol; if (opMethod?.MethodKind == MethodKind.UserDefinedOperator) { result.Add(CreateClassificationSpan(snapshot, item.TextSpan, _Classifications.OverrideMember)); } continue; } case Constants.CodePunctuation: if (item.TextSpan.Length == 1) { ClassifyPunctuation(item.TextSpan, snapshot, result, semanticModel, unitCompilation); } continue; default: if (ct == Constants.XmlDocDelimiter) { if (lastTriviaSpan.Contains(item.TextSpan)) { continue; } var trivia = unitCompilation.FindTrivia(item.TextSpan.Start); switch (trivia.Kind()) { case SyntaxKind.SingleLineDocumentationCommentTrivia: case SyntaxKind.MultiLineDocumentationCommentTrivia: case SyntaxKind.DocumentationCommentExteriorTrivia: lastTriviaSpan = trivia.FullSpan; result.Add(CreateClassificationSpan(snapshot, lastTriviaSpan, _Classifications.XmlDoc)); continue; } } else if (ct == Constants.CodeIdentifier || ct == Constants.CodeStaticSymbol || ct.EndsWith("name", StringComparison.Ordinal)) { var itemSpan = item.TextSpan; node = unitCompilation.FindNode(itemSpan, true); foreach (var type in GetClassificationType(node, semanticModel)) { result.Add(CreateClassificationSpan(snapshot, itemSpan, type)); } } break; } } return(result); }