diff --git a/python/src/com/jetbrains/python/documentation/SphinxDocString.java b/python/src/com/jetbrains/python/documentation/SphinxDocString.java index 53a136a3a440..3ebc8a5736d2 100644 --- a/python/src/com/jetbrains/python/documentation/SphinxDocString.java +++ b/python/src/com/jetbrains/python/documentation/SphinxDocString.java @@ -83,8 +83,8 @@ public class SphinxDocString extends StructuredDocString { if (tagEnd < 0) return index; String tagName = line.substring(1, tagEnd); String tagValue = line.substring(tagEnd).trim(); - tagValue = tagValue.replaceAll(":py:class:", ""); - tagValue = tagValue.replaceAll(":class:", ""); + tagValue = StringUtil.replace(tagValue, ":py:class:", ""); + tagValue = StringUtil.replace(tagValue, ":class:", ""); tagValue = tagValue.replaceAll("`(\\w+)`", "$1"); int pos = tagValue.indexOf(':'); if (pos < 0) return index; diff --git a/python/testSrc/com/jetbrains/python/PyTypeTest.java b/python/testSrc/com/jetbrains/python/PyTypeTest.java index 92504ea29a1c..266d05e3d929 100644 --- a/python/testSrc/com/jetbrains/python/PyTypeTest.java +++ b/python/testSrc/com/jetbrains/python/PyTypeTest.java @@ -185,6 +185,12 @@ public class PyTypeTest extends PyLightFixtureTestCase { assertEquals("int", type.getName()); } + public void testRestClassType() { //PY-3849 + PyClassType type = (PyClassType) doTest("class Foo: pass\ndef foo(limit):\n" + + " ''':param :class:`Foo` limit: maximum number of stack frames to show'''\n" + + " expr = limit"); + assertEquals("Foo", type.getName()); + } private PyType doTest(final String text) { myFixture.configureByText(PythonFileType.INSTANCE, text);