We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 34be02a commit c0aa6deCopy full SHA for c0aa6de
pylsp/_utils.py
@@ -6,6 +6,7 @@
6
import logging
7
import os
8
import pathlib
9
+import re
10
import threading
11
12
import jedi
@@ -14,6 +15,7 @@
14
15
16
log = logging.getLogger(__name__)
17
18
+EX_SNIPPET_RE = re.compile(r"\>\>\> .*(?:\r?\n(?!\r?\n).*)*")
19
20
def debounce(interval_s, keyed_by=None):
21
"""Debounce calls to this function until interval_s seconds have passed."""
@@ -146,6 +148,9 @@ def format_docstring(contents):
146
148
"""
147
149
contents = contents.replace('\t', u'\u00A0' * 4)
150
contents = contents.replace(' ', u'\u00A0' * 2)
151
+ example_snippets = re.findall(EX_SNIPPET_RE, contents)
152
+ for snippet in example_snippets:
153
+ contents = contents.replace(snippet, f"```python\n{snippet}\n```")
154
return contents
155
156
0 commit comments