Exemple #1
0
        /// <inheritdoc/>
        public override void Invoke(IEditor editor, ModuleDrawerEventArgs e)
        {
            if (editor == null || e == null)
            {
                return;
            }

            var script      = editor.FileName;
            var breakpoints = A.Psf.Breakpoints.Where(x => script.Equals(x.Script, StringComparison.OrdinalIgnoreCase));

            foreach (var line in e.Lines)
            {
                foreach (var bp in breakpoints)
                {
                    if (bp.Line != line.Index + 1)
                    {
                        continue;
                    }

                    e.Colors.Add(new EditorColor(
                                     line.Index,
                                     0,
                                     e.EndChar,
                                     ConsoleColor.White,
                                     ConsoleColor.DarkRed));

                    break;
                }
            }
        }
Exemple #2
0
        public override void Invoke(IEditor editor, ModuleDrawerEventArgs e)
        {
            // get current word
            var match = editor.Line.MatchCaret(_regex);

            if (match == null)
            {
                return;
            }

            var word = match.Value;

            // color occurrences
            foreach (var line in e.Lines)
            {
                var text = line.Text;
                if (text.Length == 0 || text.IndexOf(word, StringComparison.OrdinalIgnoreCase) < 0)
                {
                    continue;
                }

                for (match = _regex.Match(text); match.Success; match = match.NextMatch())
                {
                    if (match.Value.Equals(word, StringComparison.OrdinalIgnoreCase))
                    {
                        e.Colors.Add(new EditorColor(line.Index, match.Index, match.Index + match.Length, _foreground, _background));
                    }
                }
            }
        }
Exemple #3
0
        public override void Invoke(IEditor editor, ModuleDrawerEventArgs e)
        {
            foreach (var line in e.Lines)
            {
                var text = line.Text;
                if (text.Length == 0)
                {
                    continue;
                }

                if (MaximumLineLength > 0 && text.Length > MaximumLineLength)
                {
                    e.Colors.Add(new EditorColor(
                                     line.Index,
                                     0,
                                     text.Length,
                                     HighlightingForegroundColor,
                                     HighlightingBackgroundColor));
                    continue;
                }

                MatchCollection skip = null;
                for (var match = RegexWord.Match(text); match.Success; match = match.NextMatch())
                {
                    // the target word
                    var word = Actor.MatchToWord(match);

                    // check cheap skip lists
                    if (CommonWords.Contains(word) || Actor.IgnoreWords.Contains(word))
                    {
                        continue;
                    }

                    // check spelling, expensive but better before the skip pattern
                    if (Spell.Spell(word))
                    {
                        continue;
                    }

                    // expensive skip pattern
                    if (Actor.HasMatch(skip ?? (skip = Actor.GetMatches(RegexSkip, text)), match))
                    {
                        continue;
                    }

                    // add color
                    e.Colors.Add(new EditorColor(
                                     line.Index,
                                     match.Index,
                                     match.Index + match.Length,
                                     HighlightingForegroundColor,
                                     HighlightingBackgroundColor));
                }
            }
        }
Exemple #4
0
 public override void Invoke(IEditor editor, ModuleDrawerEventArgs e)
 {
     foreach (var line in e.Lines)
     {
         e.Colors.Add(new EditorColor(
                          line.Index,
                          editor.ConvertColumnScreenToEditor(line.Index, _columnNumber - 1),
                          editor.ConvertColumnScreenToEditor(line.Index, _columnNumber),
                          _foreground, _background));
     }
 }
Exemple #5
0
        public override void Invoke(object sender, ModuleDrawerEventArgs e)
        {
            var editor = (IEditor)sender;

            foreach (var line in e.Lines)
            {

                e.Colors.Add(new EditorColor(
                    line.Index,
                    editor.ConvertColumnScreenToEditor(line.Index, _columnNumber - 1),
                    editor.ConvertColumnScreenToEditor(line.Index, _columnNumber),
                    _foreground, _background));
            }
        }
Exemple #6
0
        public override void Invoke(object sender, ModuleDrawerEventArgs e)
        {
            var editor = (IEditor)sender;

            // get current word
            var match = editor.Line.MatchCaret(_regex);
            if (match == null)
                return;

            var word = match.Value;

            // color occurrences
            foreach (var line in e.Lines)
            {
                var text = line.Text;
                if (text.Length == 0 || text.IndexOf(word, StringComparison.OrdinalIgnoreCase) < 0)
                    continue;

                for (match = _regex.Match(text); match.Success; match = match.NextMatch())
                    if (match.Value.Equals(word, StringComparison.OrdinalIgnoreCase))
                        e.Colors.Add(new EditorColor(line.Index, match.Index, match.Index + match.Length, _foreground, _background));
            }
        }
Exemple #7
0
        public override void Invoke(object sender, ModuleDrawerEventArgs e)
        {
            foreach (var line in e.Lines)
            {
                var text = line.Text;
                if (text.Length == 0)
                    continue;

                MatchCollection skip = null;
                for (var match = RegexWord.Match(text); match.Success; match = match.NextMatch())
                {
                    // the target word
                    var word = Actor.MatchToWord(match);

                    // check cheap skip lists
                    if (CommonWords.Contains(word) || Actor.IgnoreWords.Contains(word))
                        continue;

                    // check spelling, expensive but better before the skip pattern
                    if (Spell.Spell(word))
                        continue;

                    // expensive skip pattern
                    if (Actor.HasMatch(skip ?? (skip = Actor.GetMatches(RegexSkip, text)), match))
                        continue;

                    // add color
                    e.Colors.Add(new EditorColor(
                        line.Index,
                        match.Index,
                        match.Index + match.Length,
                        HighlightingForegroundColor,
                        HighlightingBackgroundColor));
                }
            }
        }