mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-16 10:37:52 +08:00
The tokenizer now includes all newlines and comments in its prefix.
This commit is contained in:
@@ -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