mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
fixed PY-8025 Enable rest, epytext and doctest highlighting in strings literal assigned to __doc__
This commit is contained in:
@@ -30,7 +30,7 @@ public class DocStringAnnotator extends PyAnnotator {
|
||||
@Override
|
||||
public void visitPyAssignmentStatement(PyAssignmentStatement node) {
|
||||
PyExpression left = node.getLeftHandSideExpression();
|
||||
if (left != null && "__doc__".equals(left.getText())) {
|
||||
if (left != null && "__doc__".equals(left.getName())) {
|
||||
PyExpression right = node.getAssignedValue();
|
||||
if (right instanceof PyStringLiteralExpression) {
|
||||
Annotation ann = getHolder().createInfoAnnotation(right, null);
|
||||
|
||||
10
python/testData/highlighting/docstring.py
Normal file
10
python/testData/highlighting/docstring.py
Normal file
@@ -0,0 +1,10 @@
|
||||
__doc__= <info descr="null">"""<info descr="null">:param</info> v: """</info>
|
||||
|
||||
def <info descr="null">foo</info>(<info descr="null">a</info>, <info descr="null">v</info>):
|
||||
"""
|
||||
<info descr="null">:param</info> a:
|
||||
<info descr="null">:param</info> v:
|
||||
"""
|
||||
pass
|
||||
|
||||
foo.<info descr="null">__doc__</info>= <info descr="null">"""<info descr="null">:param</info> v: """</info>
|
||||
@@ -170,6 +170,10 @@ public class PythonHighlightingTest extends PyTestCase {
|
||||
doTest(LanguageLevel.PYTHON32, true, false);
|
||||
}
|
||||
|
||||
public void testDocstring() { // PY-8025
|
||||
doTest(false, true);
|
||||
}
|
||||
|
||||
public void testYieldInNestedFunction() {
|
||||
// highlight func declaration first, lest we get an "Extra fragment highlighted" error.
|
||||
EditorColorsManager manager = EditorColorsManager.getInstance();
|
||||
|
||||
Reference in New Issue
Block a user