private void AddWhitespaceWarning(HighlightedWarning highlightedWarning, ITreeNode[] nodes) { var node = nodes.FirstOrDefault(n => n.IsWhitespaceToken()); if (node != null) AddHighlighting(highlightedWarning, node); }
private void TryAddWarningOnEvidence(HighlightedWarning highlightedWarning, ITreeNode[] nodes) { for (var i = 0; i < nodes.Length; i++) { var node = nodes[i]; ITreeNode parent = null; var evidence = highlightedWarning.Warning.Evidence; var nodeText = node.GetText(); var noMatch = nodeText != evidence; if (noMatch && evidence.StartsWith(nodeText)) parent = node.GetContainingNode<ITreeNode>(n => n.GetText() == evidence); if (parent != null) { node = parent; nodeText = node.GetText(); } else continue; AddHighlighting(highlightedWarning, node); break; } }
private void AddNonWhitespaceWarning(HighlightedWarning highlightedWarning, ITreeNode[] nodes) { var node = nodes.FirstOrDefault(n => !n.IsWhitespaceToken()); AddHighlighting(highlightedWarning, node); }
private void AddHighlighting(HighlightedWarning warning, ITreeNode node) { var sameHighlight = highlightings.SingleOrDefault(SameNode(node)); if (sameHighlight != null) { ((LintHighlightingBase)sameHighlight.Highlighting).AddWarning(warning.Warning); } else { var highlightingInfo = new HighlightingInfo(node.GetDocumentRange(), CreateHighlighting(warning, node)); highlightings.Add(highlightingInfo); } warning.Highlighted = true; }
private static bool IsWhitespaceWarning(HighlightedWarning highlightedWarning) { return highlightedWarning.Warning.Message.ToLower().Contains("space"); }
private static bool IsNotHightlighted(HighlightedWarning highlightedWarning, ITreeNode[] nodes) { return !highlightedWarning.Highlighted && nodes.Any(); }
private static LintHighlightingBase CreateHighlighting(HighlightedWarning warning, ITreeNode node) { if (Settings.Get<bool?>("R#_priority") == true) return new PrioritizedLintHighlighting(node, warning.Warning); return new LintHighlighting(node, warning.Warning); }