mirror of
https://github.com/davidhalter/jedi.git
synced 2026-10-10 04:45:50 +08:00
The tokenizer now includes all newlines and comments in its prefix.
This commit is contained in:
1 parent
9cdf6de206
commit
b2e54ca1eb
4 files changed
+24
-13
No files matched your search
+5
-1
@@ -5,6 +5,7 @@ the interesting information about completion and goto operations.
|
||||
"""
|
||||
import warnings
|
||||
from itertools import chain
|
||||
import re
|
||||
|
||||
from jedi._compatibility import next, unicode, use_metaclass
|
||||
from jedi import settings
|
||||
@@ -579,7 +580,10 @@ class Definition(use_metaclass(CachedMetaClass, BaseDefinition)):
|
||||
d = d.get_code()
|
||||
finally:
|
||||
first_leaf.prefix = old
|
||||
return d.replace('\n', '').replace('\r', '')
|
||||
# Delete comments:
|
||||
d = re.sub('#[^\n]+\n', ' ', d)
|
||||
# Delete multi spaces/newlines
|
||||
return re.sub('\s+', ' ', d).strip()
|
||||
|
||||
@property
|
||||
def desc_with_module(self):
|
||||
|
||||
Reference in new issue
Block a user