The PSI does not contain any information about line numbers. You can use PsiDocumentManager.getDocument() to get the document for the file and use Document.getLineNumber() and Document,getLineStartOffset() to determine the position.
Thought I should add a note: IntelliJ displays line numbers as 1-indexed, but `Document.getLineNumber` will return a 0-indexed number, so you need to add `+ 1` to get the line number that the user can see.
The PSI does not contain any information about line numbers. You can use PsiDocumentManager.getDocument() to get the document for the file and use Document.getLineNumber() and Document,getLineStartOffset() to determine the position.
This is the code I was able to figure out by following the available method list for each class along the way:
Thought I should add a note: IntelliJ displays line numbers as 1-indexed, but `Document.getLineNumber` will return a 0-indexed number, so you need to add `+ 1` to get the line number that the user can see.