Skip to content

Commit c2a8d9e

Browse files
authored
stop accumulating code for completions (#37)
1 parent 74b8690 commit c2a8d9e

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

swift_kernel.py

+1-12
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,6 @@ def __init__(self, **kwargs):
160160
# the kernel a lot so it is opt-in for now).
161161
self.completion_enabled = False
162162

163-
# Accumulate successfully-executed code, for the completer. This
164-
# accumulates code even when completion is disabled, so that completion
165-
# works if it's enabled later.
166-
self.accumulated_code = ''
167-
168163
self._init_repl_process()
169164
self._init_kernel_communicator()
170165
self._init_int_bitwidth()
@@ -338,16 +333,10 @@ def _execute(self, code):
338333
codeWithLocationDirective, self.expr_opts)
339334

340335
if result.error.type == lldb.eErrorTypeInvalid:
341-
self.accumulated_code += codeWithLocationDirective + '\n'
342336
return SuccessWithValue(result)
343337
elif result.error.type == lldb.eErrorTypeGeneric:
344-
self.accumulated_code += codeWithLocationDirective + '\n'
345338
return SuccessWithoutValue()
346339
else:
347-
# TODO: We should accumulate code if there is a runtime error. But
348-
# I don't know how to distinguish between compile and runtime error
349-
# here. Note that this TODO is throwaway work, because I intend to
350-
# make the completer work without accumulated code soon.
351340
return SwiftError(result)
352341

353342
def _after_successful_execution(self):
@@ -530,7 +519,7 @@ def do_complete(self, code, cursor_pos):
530519

531520
code_to_cursor = code[:cursor_pos]
532521
sbresponse = self.target.CompleteCode(
533-
self.swift_language, None, self.accumulated_code + code_to_cursor)
522+
self.swift_language, None, code_to_cursor)
534523
prefix = sbresponse.GetPrefix()
535524
insertable_matches = []
536525
for i in range(sbresponse.GetNumMatches()):

0 commit comments

Comments
 (0)