How to find string line where cursor is
Answered
I have offset PlatformDataKeys.EDITOR.getData(e.dataContext).caretModel.offset that gives me offset from the beginning of the file.
I have val xmlFile = PsiManager.getInstance(project).findFile(file!!) as XmlFile.
How to use both of them to get the word or element where the cursor is and element?
Please sign in to leave a comment.
xmlFile.findElementAt(offset) see also https://plugins.jetbrains.com/docs/intellij/psi-elements.html