I am developing a plugin for Chef development.
My goal is to reference one file from another file.
For examlpe i would like to make this kind of line in file:
to refernece to specific file with nginx role declaration.
Files containig this text are ruby files (*.rb) but with specific Chef DSL. I would like to treat them just like plain text files. No matter if ruby plugin is installed or not.
I wrote my own PsiReferenceContributor but i have troubles to make a pattern for this kind of text.
I have smth like this:
PsiElementPattern.Capture<PsiElement> elementCapture = PlatformPatterns.psiElement().withText(StandardPatterns.string().contains("role["));
But this calls my PsiReferenceProvider with element of type PsiPlainTextFile. So i am getting whole file instead of that particular line.
How to construct pattern to have smthing like PsiPlainText (containing one selected line of text) given in provider as element instead of whole file?