Get PsiMethod at given line number in a file?


How to get the PsiMethod at a given line number in a VirtualFile or PsiFile?

1 comment
Comment actions Permalink

The line number is not precise enough - you can get an element at the specified offset with:

PsiUtilCore.getElementAtOffset(@NotNull PsiFile file, int offset)

Please sign in to leave a comment.