static ResolveResult GetHeuristicResult (Document doc, DocumentLocation location, ref AstNode node)
{
int offset = doc.Editor.Caret.Offset;
bool wasLetter = false, wasWhitespaceAfterLetter = false;
while (offset < doc.Editor.Length) {
char ch = doc.Editor.GetCharAt (offset);
bool isLetter = char.IsLetterOrDigit (ch) || ch == '_';
bool isWhiteSpace = char.IsWhiteSpace (ch);
bool isValidPunc = ch == '.' || ch == '<' || ch == '>';
if (!(wasLetter && wasWhitespaceAfterLetter) && (isLetter || isWhiteSpace || isValidPunc)) {
if (isValidPunc) {
wasWhitespaceAfterLetter = false;
wasLetter = false;
}
offset++;
} else {
offset--;
while (offset > 1) {
ch = doc.Editor.GetCharAt (offset - 1);
if (!(ch == '.' || char.IsWhiteSpace (ch)))
break;
offset--;
}
break;
}
wasLetter |= isLetter;
if (wasLetter)
wasWhitespaceAfterLetter |= isWhiteSpace;
}
var unit = SyntaxTree.Parse (CreateStub (doc, offset), doc.FileName);
return ResolveAtLocation.Resolve (
doc.Compilation,
doc.ParsedDocument.ParsedFile as CSharpUnresolvedFile,
unit,
location,
out node);
}