title: vscode: evaluating multiple selected lines in the debug console causes an indentation error (with python classes)
body: <p>I have been struggling for a while with the problem that in VSCode I would like to evaluate multiple lines of Python code in the debug console without having to select each line individually and send it to the debug console. However, when I select multiple lines at once and want to evaluate them in the debug console, the existing indentations are copied to the debug console and cause an indentation error there. I have since been able to narrow down the problem to the point where I have determined that this occurs mainly when debugging class methods. A minimal example is given below.</p>
  <pre><code>class MyClass:
      def __init__(self):
          pass
      def run(self):
          a = 3
          b = 4
          c = a + b
  MyClass().run()
    
  </code></pre>
  <p>If I set a breakpoint at line <code>a = 3</code>, which is then reached during debugging, and I then select lines <code>a = 3</code> up to and including <code>c = a + b</code> and want to have all 3 lines evaluated in the debug console, this results in the lines being copied to the debug console as follows:</p>
  <pre><code>a = 3
          b = 4
          c = a + b
  </code></pre>
  <p>Which causes the following error:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;/home/lukas/.vscode/extensions/ms-python.python-2021.9.1230869389/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_vars.py&quot;, line 419, in evaluate_expression
      compiled = compile(_expression_to_evaluate(expression), '&lt;string&gt;', 'eval')
    File &quot;&lt;string&gt;&quot;, line 1
      a = 3
        ^
  SyntaxError: invalid syntax
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File &quot;/home/lukas/.vscode/extensions/ms-python.python-2021.9.1230869389/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_comm.py&quot;, line 1207, in internal_evaluate_expression_json
      pydevd_vars.evaluate_expression(py_db, frame, expression, is_exec=True)
    File &quot;/home/lukas/.vscode/extensions/ms-python.python-2021.9.1230869389/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_vars.py&quot;, line 371, in new_func
      return _run_with_unblock_threads(original_func, py_db, curr_thread, frame, expression, is_exec)
    File &quot;/home/lukas/.vscode/extensions/ms-python.python-2021.9.1230869389/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_vars.py&quot;, line 339, in _run_with_unblock_threads
      return _run_with_interrupt_thread(original_func, py_db, curr_thread, frame, expression, is_exec)
    File &quot;/home/lukas/.vscode/extensions/ms-python.python-2021.9.1230869389/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_vars.py&quot;, line 310, in _run_with_interrupt_thread
      return original_func(py_db, frame, expression, is_exec)
    File &quot;/home/lukas/.vscode/extensions/ms-python.python-2021.9.1230869389/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_vars.py&quot;, line 421, in evaluate_expression
      Exec(_expression_to_evaluate(expression), updated_globals, frame.f_locals)
    File &quot;/home/lukas/.vscode/extensions/ms-python.python-2021.9.1230869389/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_exec2.py&quot;, line 3, in Exec
      exec(exp, global_vars, local_vars)
    File &quot;&lt;string&gt;&quot;, line 2
      b = 4
      ^
  IndentationError: unexpected indent
  </code></pre>
  <p>This is a very annoying problem. Any solution would be greatly appreciated.</p>