Skip to content

Commit f00d5d3

Browse files
committed
Preview number-like statements as well
1 parent ebbd8fa commit f00d5d3

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ installing this package.
66

77
This is powered by [Jedi](https://github.com/davidhalter/jedi).
88

9-
![Demo](https://cloud.githubusercontent.com/assets/193864/7388957/36019954-ee9c-11e4-8373-7bf551ed613f.gif)
10-
9+
![Demo](https://cloud.githubusercontent.com/assets/193864/7394244/e6906980-eec4-11e4-9ee2-8749d16ff468.gif)
1110

1211
# Features
1312

lib/completion.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
import jedi
77

88

9+
MAX_LENGTH = 70
10+
11+
912
class JediCompletion(object):
1013
basic_types = {
1114
'module': 'import',
@@ -46,7 +49,8 @@ def _additional_info(self, completion):
4649
return ''
4750
t = completion.type
4851
if t == 'statement':
49-
nodes_to_display = ['InstanceElement', 'String', 'Node', 'Lambda']
52+
nodes_to_display = ['InstanceElement', 'String', 'Node', 'Lambda',
53+
'Number']
5054
desc = ''.join(
5155
c.get_code() for c in completion._definition.children
5256
if type(c).__name__ in nodes_to_display).replace('\n', '')
@@ -59,7 +63,7 @@ def _additional_info(self, completion):
5963
else:
6064
desc = '.'.join(unicode(p) for p in completion._path())
6165
line = '' if completion.in_builtin_module else '@%s' % completion.line
62-
return ('%s: %s%s' % (t, desc, line))[:50]
66+
return ('%s: %s%s' % (t, desc, line))[:MAX_LENGTH - len(completion.name)]
6367

6468
@classmethod
6569
def _get_top_level_module(cls, path):

0 commit comments

Comments
 (0)