MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / internal_get_completions

Function internal_get_completions

_pydevd_bundle/pydevd_comm.py:1395–1434  ·  view source on GitHub ↗

Note that if the column is >= 0, the act_tok is considered text and the actual activation token/qualifier is computed in this command.

(dbg, seq, thread_id, frame_id, act_tok, line=-1, column=-1)

Source from the content-addressed store, hash-verified

1393
1394
1395def internal_get_completions(dbg, seq, thread_id, frame_id, act_tok, line=-1, column=-1):
1396 """
1397 Note that if the column is >= 0, the act_tok is considered text and the actual
1398 activation token/qualifier is computed in this command.
1399 """
1400 try:
1401 remove_path = None
1402 try:
1403 qualifier = ""
1404 if column >= 0:
1405 token_and_qualifier = extract_token_and_qualifier(act_tok, line, column)
1406 act_tok = token_and_qualifier[0]
1407 if act_tok:
1408 act_tok += "."
1409 qualifier = token_and_qualifier[1]
1410
1411 frame = dbg.find_frame(thread_id, frame_id)
1412 if frame is not None:
1413 completions = _pydev_completer.generate_completions(frame, act_tok)
1414
1415 # Note that qualifier and start are only actually valid for the
1416 # Debug Adapter Protocol (for the line-based protocol, the IDE
1417 # is required to filter the completions returned).
1418 cmd = dbg.cmd_factory.make_get_completions_message(seq, completions, qualifier, start=column - len(qualifier))
1419 dbg.writer.add_command(cmd)
1420 else:
1421 cmd = dbg.cmd_factory.make_error_message(
1422 seq, "internal_get_completions: Frame not found: %s from thread: %s" % (frame_id, thread_id)
1423 )
1424 dbg.writer.add_command(cmd)
1425
1426 finally:
1427 if remove_path is not None:
1428 sys.path.remove(remove_path)
1429
1430 except:
1431 exc = get_exception_traceback_str()
1432 sys.stderr.write("%s\n" % (exc,))
1433 cmd = dbg.cmd_factory.make_error_message(seq, "Error evaluating expression " + exc)
1434 dbg.writer.add_command(cmd)
1435
1436
1437def internal_get_description(dbg, seq, thread_id, frame_id, expression):

Callers

nothing calls this directly

Calls 8

make_error_messageMethod · 0.80
find_frameMethod · 0.45
add_commandMethod · 0.45
removeMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected