예제 #1
0
        private DaxLineState ParseLine()
        {
            //Log.Debug("{class} {method} {message}", "DaxIntellisenseProvider", "ParseLine", "start");
            string line    = GetCurrentLine();
            int    pos     = _editor.CaretOffset > 0 ? _editor.CaretOffset - 1 : 0;
            var    loc     = _editor.DocumentGetLocation(pos);
            var    docLine = _editor.DocumentGetLineByOffset(pos);

            Log.Debug("{class} {method} {line} col:{column} off:{offset}", "DaxIntellisenseProvider", "ParseLine", line, loc.Column, docLine.Offset);
            return(DaxLineParser.ParseLine(line, loc.Column, docLine.Offset));
        }
예제 #2
0
        private bool FindNextInternal()
        {
            // TODO - if we have a multi-line selection then we only want to search inside that

            Regex regex = GetRegEx(TextToFind);
            int   start = regex.Options.HasFlag(RegexOptions.RightToLeft) ?
                          editor.SelectionStart : editor.SelectionStart + editor.SelectionLength;
            Match match = regex.Match(editor.Text, start);

            if (!match.Success)  // start again from beginning or end
            {
                if (regex.Options.HasFlag(RegexOptions.RightToLeft))
                {
                    match = regex.Match(editor.Text, editor.Text.Length);
                }
                else
                {
                    match = regex.Match(editor.Text, 0);
                }
            }

            if (match.Success)
            {
                editor.Select(match.Index, match.Length);
                TextLocation loc = editor.DocumentGetLocation(match.Index);
                editor.ScrollTo(loc.Line, loc.Column);
            }

            return(match.Success);
        }