Show More
@@ -24,7 +24,10 b' _completion_sentinel = object()' | |||||
24 |
|
24 | |||
25 | def _elide(string, *, min_elide=30): |
|
25 | def _elide(string, *, min_elide=30): | |
26 | """ |
|
26 | """ | |
27 |
If a string is long enough, and has at least |
|
27 | If a string is long enough, and has at least 3 dots, | |
|
28 | replace the middle part with ellipses. | |||
|
29 | ||||
|
30 | If a string naming a file is long enough, and has at least 3 slashes, | |||
28 | replace the middle part with ellipses. |
|
31 | replace the middle part with ellipses. | |
29 |
|
32 | |||
30 | If three consecutive dots, or two consecutive dots are encountered these are |
|
33 | If three consecutive dots, or two consecutive dots are encountered these are | |
@@ -36,13 +39,17 b' def _elide(string, *, min_elide=30):' | |||||
36 | if len(string) < min_elide: |
|
39 | if len(string) < min_elide: | |
37 | return string |
|
40 | return string | |
38 |
|
41 | |||
39 | parts = string.split('.') |
|
42 | object_parts = string.split('.') | |
40 |
|
43 | file_parts = string.split('/') | ||
41 | if len(parts) <= 3: |
|
|||
42 | return string |
|
|||
43 |
|
44 | |||
|
45 | if len(object_parts) > 3: | |||
44 | return '{}.{}\N{HORIZONTAL ELLIPSIS}{}.{}'.format(parts[0], parts[1][0], parts[-2][-1], parts[-1]) |
|
46 | return '{}.{}\N{HORIZONTAL ELLIPSIS}{}.{}'.format(parts[0], parts[1][0], parts[-2][-1], parts[-1]) | |
45 |
|
47 | |||
|
48 | elif len(file_parts) > 3: | |||
|
49 | return '{}/{}\N{HORIZONTAL ELLIPSIS}{}/{}'.format(parts[0], parts[1][0], parts[-2][-1], parts[-1]) | |||
|
50 | ||||
|
51 | return string | |||
|
52 | ||||
46 |
|
53 | |||
47 | def _adjust_completion_text_based_on_context(text, body, offset): |
|
54 | def _adjust_completion_text_based_on_context(text, body, offset): | |
48 | if text.endswith('=') and len(body) > offset and body[offset] is '=': |
|
55 | if text.endswith('=') and len(body) > offset and body[offset] is '=': |
General Comments 0
You need to be logged in to leave comments.
Login now