Repository: microsoft/ptvsd

Issue:
The first output is incorrect in "Output->Debug" when press F11
@xiaofeng0123 commented on [Fri Oct 11 2019](https://github.com/microsoft/PTVS/issues/5813)

VS Version: 16.4.0 Preview 2.0 [29410.124.d16.4]
Python Tool Version: 16.4.19275.1

**Steps to Reproduce**
1.Create a python application and type below code:
```
from math import cos, radians
def make_dot_string(x):
	rad = radians(x)                             
	numspaces = int(20 * cos(radians(x)) + 20)   
	st = ' ' * numspaces + 'o'                
	return st
	
def main():
	for i in range(0, 1800, 12):
	    s = make_dot_string(i)
	    print(s)
	
main()
```
2.Set a breakpoint
3.Start debug and press F11

**Expected behavior**
The first output should like below
![image](https://user-images.githubusercontent.com/41426540/66638388-6c944400-ec47-11e9-9a61-d82e2dd557ea.png)

**Actual behavior**
The first output is incorrect
![image](https://user-images.githubusercontent.com/41426540/66638257-2b9c2f80-ec47-11e9-92a6-3ae1bb3dd95c.png)



---

@huguesv commented on [Mon Oct 14 2019](https://github.com/microsoft/PTVS/issues/5813#issuecomment-541823720)

Looks like the previous message about JustMyCode isn't ending with a new line.

---

@huguesv commented on [Mon Oct 14 2019](https://github.com/microsoft/PTVS/issues/5813#issuecomment-541825802)

What do you think @karthiknadig ? The message comes from pydevd:
https://github.com/microsoft/ptvsd/blob/a4892f4cd4152b6bcaa600d2a1381e814d725551/src/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_net_command_factory_json.py#L355



---

@karthiknadig commented on [Mon Oct 14 2019](https://github.com/microsoft/PTVS/issues/5813#issuecomment-541880746)

Yep that is the issue.




Discussion:

Resolving patch:
diff --git a/src/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_net_command_factory_json.py b/src/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_net_command_factory_json.py
--- a/src/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_net_command_factory_json.py
+++ b/src/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_net_command_factory_json.py
@@ -367,7 +367,7 @@ def make_skipped_step_in_because_of_filters(self, py_db, frame):
         msg = 'Frame skipped from debugging during step-in.'
         if py_db.get_use_libraries_filter():
             msg += ('\nNote: may have been skipped because of "justMyCode" option (default == true). '
-                    'Try setting \"justMyCode\": false in the debug configuration (e.g., launch.json).')
+                    'Try setting \"justMyCode\": false in the debug configuration (e.g., launch.json).\n')
 
         body = OutputEventBody(msg, category='console')
         event = OutputEvent(body)
diff --git a/src/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_process_net_command_json.py b/src/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_process_net_command_json.py
--- a/src/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_process_net_command_json.py
+++ b/src/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_process_net_command_json.py
@@ -589,7 +589,7 @@ def on_setbreakpoints_request(self, py_db, request):
                     error_msg = 'Breakpoint in file excluded by filters.'
                     if py_db.get_use_libraries_filter():
                         error_msg += ('\nNote: may be excluded because of "justMyCode" option (default == true).'
-                                      'Try setting \"justMyCode\": false in the debug configuration (e.g., launch.json).')
+                                      'Try setting \"justMyCode\": false in the debug configuration (e.g., launch.json).\n')
 
                 else:
                     # Shouldn't get here.


Test patch:
diff --git a/src/ptvsd/_vendored/pydevd/tests_python/test_debugger_json.py b/src/ptvsd/_vendored/pydevd/tests_python/test_debugger_json.py
--- a/src/ptvsd/_vendored/pydevd/tests_python/test_debugger_json.py
+++ b/src/ptvsd/_vendored/pydevd/tests_python/test_debugger_json.py
@@ -872,7 +872,7 @@ def test_case_skipping_filters(case_setup, custom_setup):
                 33, filename=other_filename, verified=False, expected_lines_in_response=[14])
             assert response.body.breakpoints == [{
                 'verified': False,
-                'message': 'Breakpoint in file excluded by filters.\nNote: may be excluded because of \"justMyCode\" option (default == true).Try setting \"justMyCode\": false in the debug configuration (e.g., launch.json).',
+                'message': 'Breakpoint in file excluded by filters.\nNote: may be excluded because of \"justMyCode\" option (default == true).Try setting \"justMyCode\": false in the debug configuration (e.g., launch.json).\n',
                 'source': {'path': other_filename},
                 'line': 14
             }]