@@ -1238,14 +1238,17 @@ def schedule_work(self, work):
12381238 self .unblock_work = work
12391239 self .unblock ()
12401240
1241- def run_on_thread (self , text , cur_frame , execution_id , frame_kind , repr_kind = PYTHON_EVALUATION_RESULT_REPR_KIND_NORMAL ):
1241+ def run_on_thread (self , text , cur_frame , execution_id , frame_kind , repr_kind = PYTHON_EVALUATION_RESULT_REPR_KIND_NORMAL , mode = 'eval' ):
12421242 self ._block_starting_lock .acquire ()
12431243
12441244 if not self ._is_blocked :
1245+ print ('blocked' )
12451246 report_execution_error ('<expression cannot be evaluated at this time>' , execution_id )
12461247 elif not self ._is_working :
1247- self .schedule_work (lambda : self .run_locally (text , cur_frame , execution_id , frame_kind , repr_kind ))
1248+ print ('schedule' )
1249+ self .schedule_work (lambda : self .run_locally (text , cur_frame , execution_id , frame_kind , repr_kind , mode ))
12481250 else :
1251+ print ('previous eval' )
12491252 report_execution_error ('<error: previous evaluation has not completed>' , execution_id )
12501253
12511254 self ._block_starting_lock .release ()
@@ -1293,22 +1296,26 @@ def locals_to_fast(self, frame):
12931296 except :
12941297 pass
12951298
1296- def compile (self , text , cur_frame ):
1299+ def compile (self , text , cur_frame , mode = 'eval' ):
12971300 try :
1298- code = compile (text , '<debug input>' , 'eval' )
1301+ code = compile (text , '<debug input>' , mode )
12991302 except :
13001303 code = compile (text , '<debug input>' , 'exec' )
13011304 return code
13021305
1303- def run_locally (self , text , cur_frame , execution_id , frame_kind , repr_kind = PYTHON_EVALUATION_RESULT_REPR_KIND_NORMAL ):
1306+ def run_locally (self , text , cur_frame , execution_id , frame_kind , repr_kind = PYTHON_EVALUATION_RESULT_REPR_KIND_NORMAL , mode = 'eval' ):
1307+ print ('run locally' )
13041308 try :
1305- code = self .compile (text , cur_frame )
1309+ code = self .compile (text , cur_frame , mode )
13061310 res = eval (code , cur_frame .f_globals , self .get_locals (cur_frame , frame_kind ))
1311+ print ('run locally evaluated' )
13071312 self .locals_to_fast (cur_frame )
13081313 # Report any updated variable values first
13091314 self .enum_thread_frames_locally ()
1315+ print ('run locally before send result' )
13101316 report_execution_result (execution_id , res , repr_kind )
13111317 except :
1318+ print ('error run locally' )
13121319 # Report any updated variable values first
13131320 self .enum_thread_frames_locally ()
13141321 report_execution_exception (execution_id , sys .exc_info ())
@@ -1753,6 +1760,7 @@ def command_get_breakpoint_hit_count(self):
17531760 def command_get_completion (self ):
17541761 # req_id = read_int(self.conn)
17551762 # expr = read_string(self.conn)
1763+ print ('test' )
17561764 try :
17571765 # execute given text in specified frame
17581766 text = read_string (self .conn )
@@ -1761,12 +1769,16 @@ def command_get_completion(self):
17611769 eid = read_int (self .conn ) # execution id
17621770 frame_kind = read_int (self .conn )
17631771 repr_kind = read_int (self .conn )
1764- script = "jedi.Interpreter('" + text + "', [locals()]).completions()"
1772+ script = "import jedi\n jedi.Interpreter('" + text + "', [locals()]).completions()"
1773+ script = "a"
1774+ print ('ok sofar' )
17651775
17661776 thread , cur_frame = self .get_thread_and_frame (tid , fid , frame_kind )
17671777 if thread is not None and cur_frame is not None :
1768- thread .run_on_thread (script , cur_frame , eid , frame_kind , repr_kind )
1778+ print ('time to evaluate' )
1779+ thread .run_on_thread (script , cur_frame , eid , frame_kind , repr_kind , 'eval' )
17691780 except expression as identifier :
1781+ print ('error' )
17701782 with _SendLockCtx :
17711783 write_bytes (conn , COMP )
17721784 write_int (conn , req_id )
0 commit comments