/// Constructs an element at the specified offset. /// May return null if no element should be constructed. public override VisualLineElement ConstructElement(int offset) { var m = FindMatch(offset); // check whether there's a match exactly at offset if (!m.Success || m.Index != 0) { return(null); } if (!File.Exists(ClickHelper.Find(m.Groups[1].Value))) { return(null); } var line = new CustomLinkVisualLineText( new [] { m.Groups[1].Value, m.Groups[2].Value }, CurrentContext.VisualLine, m.Groups[0].Length, ToBrush(EnvironmentColors.ControlLinkTextColorKey), ClickHelper.HandleFileLinkClicked, false, CurrentContext.Document, _textEditor ); if (EnvDteHelper.ViewModel.IsClickedLine(line)) { line.ForegroundBrush = ToBrush(EnvironmentColors.StatusBarNoSolutionColorKey); } return(line); }
protected override VisualLineText CreateInstance(int length) { var a = new CustomLinkVisualLineText(Link, ParentVisualLine, length) { RequireControlModifierForClick = RequireControlModifierForClick }; a.CustomLinkClicked += link => ApplicationViewModel.Instance.ActiveCodeViewDocument.HandleLinkClicked(Link); return(a); }
/// Constructs an element at the specified offset. /// May return null if no element should be constructed. public override VisualLineElement ConstructElement(int offset) { var match = FindMatch(offset); // check whether there's a match exactly at offset if (!match.Success || match.Index != 0) { return(null); } // The first match returns the full method definition if (string.IsNullOrEmpty(_fullMatchText)) { _fullMatchText = match.Value; } var captures = match.Groups[1].Captures.Cast <Capture>().Select(c => c.Value).ToList(); captures.Add(match.Groups[2].Value); var lineElement = new CustomLinkVisualLineText( new [] { _fullMatchText, captures.First() }, CurrentContext.VisualLine, captures.First().TrimEnd('.').Length, ToBrush(EnvironmentColors.StartPageTextControlLinkSelectedColorKey), ClickHelper.HandleMemberLinkClicked, false, CurrentContext.Document, _textEditor ); // If we have created elements for the entire definition, reset. // So we can create elements for more definitions if (_fullMatchText.Split('.').Last().Equals(captures.First())) { _fullMatchText = null; } if (EnvDteHelper.ViewModel.IsClickedLine(lineElement)) { lineElement.ForegroundBrush = ToBrush(EnvironmentColors.StatusBarNoSolutionColorKey); } return(lineElement); }
public bool IsClickedLine(CustomLinkVisualLineText line) => ClickedLines.Any(l => l.Link.SequenceEqual(line.Link));
public void AddClickedLine(CustomLinkVisualLineText line) => ClickedLines.Add(line);
public bool IsClickedLine(CustomLinkVisualLineText line) => _stackTraces[_selectedStackTraceIndex].IsClickedLine(line);
public void AddClickedLine(CustomLinkVisualLineText line) => _stackTraces[_selectedStackTraceIndex].AddClickedLine(line);