I'm building an RCP app that serves as an IDE for a custom domain. One of the things we do in that domain is write python scripts that use domain-specific commands which have been wrapped as python functions. I implemented hover text support integrated with PyDev, so that if there is any domain-specific hover text available, it calls a custom ITextHover instead of PyDev's.
I have this working, but I see that if I have a string literal argument to a function, the getTextHover() method is never called on the IHoverText instance. I traced this behavior to the partitioning implementation provided by getConfiguredDocumentPartitioning in PyEditConfiguration.
Is there a way I can use PyDev's partitioning scheme but somehow override the above behavior, so that getTextHover() is called for String literal arguments? I don't see anything in the preferences, and trying to follow the implementation in the PyDev source code was not successful.
EDIT: overriding TextSourceViewerConfiguration#getConfiguredDocumentPartitioning() to return IPythonPartitions.PY_DEFAULT solves the problem. But I'm not sure what the implications are of returning this rather than IPythonPartitions.PYTHON_PARTITION_TYPE, which is the behavior provided by PyEditCOnfigurationWithoutEditor.
You shouldn't change what you changed...
The proper way would be changing PyDev itself to support your use case.
You should provide your IPyHoverParticipant (instead of doing your own text hover) and create a pull request for PyDev so that the hover works in comments/strings (i.e.: skip the "if (!pythonCommentOrMultiline) {" in org.python.pydev.editor.hover.PyTextHover.getHoverInfo(ITextViewer, IRegion) if your hover implements IPyHoverParticipant2).
Pydev No Hover Text for String arguments