Repository: microsoft/ptvsd

Issue:
Breaking on exception opens a duplicate editor window without breakpoints
* Debug a python program with a print statement `print(xyz)`
* VS Code breaks on the exception, but it opens another instance of the same file (duplicate file)
* This other file does not have breakpoints, 
* Problem = The path to the file is different (case sensitive paths)

* Workspace = c:\Temp\python\debuggerTesting
* File being debugged = one.py
* Contents of file:
```python
print(x)
```
* Add breakpoints to the first line
* Start debugging
* VS Code breaks at the exception, 
* VS Code opens the file "C:\temp\python\debuggertesting.py"
* The breakpoint we added is missing

The problem, is PTVS is returning the path to the file with lowercase
* On the file system "Temp" directory has an upper case "T"
* PTVSD seems to be returning the path for "Temp" with lowercase "T" same applies to "debuggerTesting" (returned path contains "debuggertesting")




Discussion:
It kinda feels like a VSC bug to me - paths *are* case-insensitive on Windows, and if trying to open the same file with a path that differs only by case opens a new tab, that's wrong (and will probably surface elsewhere as well, like opening files from command line).
> It kinda feels like a VSC bug to me

Agreed, will check VS Code 

Paths might be case-insensitive on Windows, but they are also case-preserving, so if you're forcing everyone's UX to use lower-case paths just because that what you function with at a lower level you're basically making case-preservation worthless.

We are currently marking this issue a release blocker on the PVSC side of things since I ran into this where I set a breakpoint before running the debugger and then when I do I end up with the breakpoint listed twice as it thought there was a breakpoint for `C.py` and `c.py`.
The UX should use properly cased path, of course. But in this scenario you already have one, and all it needs to do is correctly (i.e. case insensitively) match it against the path that it gets from the debugger.
I've filed an issue on VS Code for this. https://github.com/Microsoft/vscode/issues/44074
Looking at the responses, they are not going to be fixing this in VS Code any time soon (it's a known issue from Sep 2016).

Resolving patch:
diff --git a/ptvsd/wrapper.py b/ptvsd/wrapper.py
--- a/ptvsd/wrapper.py
+++ b/ptvsd/wrapper.py
@@ -511,8 +511,7 @@ def done(fut):
     def on_initialize(self, request, args):
         # TODO: docstring
         cmd = pydevd_comm.CMD_VERSION
-        os_id = 'WINDOWS' if platform.system() == 'Windows' else 'UNIX'
-        msg = '1.1\t{}\tID'.format(os_id)
+        msg = '1.1\tUNIX\tID'
         yield self.pydevd_request(cmd, msg)
         self.send_response(
             request,
@@ -545,7 +544,17 @@ def on_configurationDone(self, request, args):
         self.send_process_event(self.start_reason)
     
     def process_launch_arguments(self):
-        """Process the launch arguments to configure the debugger"""
+        """
+        Process the launch arguments to configure the debugger.
+        Further information can be found here https://code.visualstudio.com/docs/editor/debugging#_launchjson-attributes
+        {
+            type:'python',
+            request:'launch'|'attach',
+            name:'friendly name for debug config',
+            // Custom attributes supported by PTVSD.
+            redirectOutput:true|false,
+        }
+        """
         if self.launch_arguments is None:
             return
 


Test patch: