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)); }
private LinePosition GetPreceedingWordSegment(IDocument document, ISegment completionSegment) { string line = ""; int pos = completionSegment.EndOffset - 1; var loc = document.GetLocation(pos); Log.Debug("{class} {method} pos:{position}", "DaxCompletionData", "GetPreceedingWordSegment", pos); var docLine = document.GetLineByOffset(pos); //line = textArea.Document.GetText(docLine.Offset, loc.Column); line = document.GetText(docLine.Offset, docLine.Length); Log.Verbose("{class} {method} {message}", "DaxCompletionData", "GetPreceedingWordSegment", "line: " + line); var daxState = DaxLineParser.ParseLine(line, loc.Column, 0); //TODO - look ahead to see if we have a table/column/function end character that we should replace upto return(DaxLineParser.GetPreceedingWordSegment(docLine.Offset, loc.Column, line, daxState)); }