Question about custom languages, renaming, and references Follow
I have a custom language based on Pythonid language. I extend the AbstractPythonLanguage class that it declares.
The most important elements of my language are toplevel python function calls. They have names and are referenced between files. For example:
As I said some references are between files as well. The problem is, Pythonid's string literal and function call elements don't implement PsiNamedElement, which appears to be needed for refactoring.
How could I implement refactoring of these function calls without PsiNamedElement?
Please sign in to leave a comment.
You should make function call's getReference(s) return the reference resolving to proper target with getRangeInElement() equal to relative range of the argument in the function call.
Eugene, is this the only way? I'd rather not modify the Python PSI itself (but I will if it's necessary). It would actually be convenient in this case to be able to specify another PSI layer over the Python PSI, similar to how PSI is a layer above the AST. I'd like to be able to say "this collection of python PSI elements represents a PSI element of my language." Could lanuage injection be used for this?