Show More
@@ -1105,6 +1105,26 b' class IPCompleter(Completer):' | |||||
1105 |
|
1105 | |||
1106 | interpreter = jedi.Interpreter( |
|
1106 | interpreter = jedi.Interpreter( | |
1107 | text, namespaces, column=cursor_column, line=cursor_line + 1) |
|
1107 | text, namespaces, column=cursor_column, line=cursor_line + 1) | |
|
1108 | ||||
|
1109 | try_jedi = False | |||
|
1110 | ||||
|
1111 | try: | |||
|
1112 | # should we check the type of the node is Error ? | |||
|
1113 | from jedi.parser.tree import ErrorLeaf | |||
|
1114 | next_to_last_tree = interpreter._get_module().tree_node.children[-2] | |||
|
1115 | completing_string = False | |||
|
1116 | if isinstance(next_to_last_tree, ErrorLeaf): | |||
|
1117 | completing_string = interpreter._get_module().tree_node.children[-2].value[0] in {'"', "'"} | |||
|
1118 | # if we are in a string jedi is likely not the right candidate for | |||
|
1119 | # now. Skip it. | |||
|
1120 | try_jedi = not completing_string | |||
|
1121 | except Exception as e: | |||
|
1122 | # many of things can go wrong, we are using private API just don't crash. | |||
|
1123 | if self.debug: | |||
|
1124 | print("Error detecting if completing a non-finished string :", e, '|') | |||
|
1125 | ||||
|
1126 | if not try_jedi: | |||
|
1127 | return [] | |||
1108 | try: |
|
1128 | try: | |
1109 | return filter(completion_filter, interpreter.completions()) |
|
1129 | return filter(completion_filter, interpreter.completions()) | |
1110 | except Exception as e: |
|
1130 | except Exception as e: |
General Comments 0
You need to be logged in to leave comments.
Login now