private IVariable GetCurrentVariable(Document document, int offset) { DomRegion domRegion; var resolveResult = document.GetLanguageItem(offset, out domRegion); IVariable element = null; if (resolveResult is LocalResolveResult) { element = ((LocalResolveResult)resolveResult).Variable; } else if (resolveResult is NamedArgumentResolveResult) { element = ((NamedArgumentResolveResult)resolveResult).Parameter; } return element; }
private INamedElement GetCurrentElement(Document document, int offset) { DomRegion domRegion; var resolveResult = document.GetLanguageItem(offset, out domRegion); INamedElement element = null; if (resolveResult is TypeResolveResult) { element = resolveResult.Type; } else if (resolveResult is InvocationResolveResult) { element = ((InvocationResolveResult)resolveResult).Member; } else if (resolveResult is MemberResolveResult) { element = ((MemberResolveResult)resolveResult).Member; } return element; }