We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Debugger raising IndexError
Microsoft/vscode-python#2499

```
PS C:\Users\Hugh.Groves> cd '\\global.arup.com\americas\Jobs\STJ\230000\230597-00(ACDO)\4-04 Engineering\4-04-02 Concrete\02 Calculations\19 Staged Construction\99-Tools\CreateBatches'; ${env:PYTHONIOENCODING}='UTF-8'; ${env:PYTHONUNBUFFNIOENCODING}='UTF-8'; ${env:PYTHONUNBUFFERED}='1'; ${env:PYTHONPATH}='c:\Users\Hugh.Groves\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd'; & 'C:\Users\Hugh.Groves\AppDthon.exe' '-m' 'ptvsd' '--host' 'localhoata\Local\Continuum\Anaconda3\envs\p3\python.exe' '-m' 'ptvsd' '--host' 'localhost' '--port' '53026' '\\global.arup.com\americas\Jobs\STJ\230000\230597-00(ACDO)\4-04 Engineering\4-04-02 Concrete\02 Calculations\19 Staged Construction\99-Tools\CreateBatches\CreateBatches_02.py'
Traceback (most recent call last):
  File "c:\Users\Hugh.Groves\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\wrapper.py", line 1254, in done
    fut.result()
  File "c:\Users\Hugh.Groves\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\futures.py", line 40, in result
    reraise(self._exc_info)
  File "c:\Users\Hugh.Groves\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\reraise3.py", line 8, in reraise
    raise exc_info[1].with_traceback(exc_info[2])
  File "c:\Users\Hugh.Groves\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\futures.py", line 155, in callback
    x = it.send(fut.result())
  File "c:\Users\Hugh.Groves\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\wrapper.py", line 1605, in on_stackTrace
    norm_path = self.path_casing.un_normcase(unquote(str(xframe['file'])))  # noqa
  File "c:\Users\Hugh.Groves\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\pathutils.py", line 30, in un_normcase
    file_path_to_return = self._get_actual_filename(file_path)
  File "c:\Users\Hugh.Groves\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\pathutils.py", line 60, in _get_actual_filename
    fragments += ["{}[{}]".format(d[:-1], d[-1])]
IndexError: string index out of range
Traceback (most recent call last):
  File "c:\Users\Hugh.Groves\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\wrapper.py", line 1254, in donetal\ptvsd\ptvsd\wrapper.py", line 1254, in done
    fut.result()                                                                               tal\ptvsd\ptvsd\futures.py", line 40, in result
  File "c:\Users\Hugh.Groves\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\futures.py", line 40, in result                                                tal\ptvsd\ptvsd\reraise3.py", line 8, in reraise
    reraise(self._exc_info)
  File "c:\Users\Hugh.Groves\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\futures.py", line 155, in callbacktal\ptvsd\ptvsd\reraise3.py", line 8, in reraise
    raise exc_info[1].with_traceback(exc_info[2])
  File "c:\Users\Hugh.Groves\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\futures.py", line 155, in callback    x = it.send(fut.result())
  File "c:\Users\Hugh.Groves\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\wrapper.py", line 1605, in on_stackTrace
    norm_path = self.path_casing.un_normcase(unquote(str(xframe['file'])))  # noqa  File "c:\Users\Hugh.Groves\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\pathutils.py", line 30, in un_normcase
    file_path_to_return = self._get_actual_filename(file_path)
  File "c:\Users\Hugh.Groves\.vscode\extensions\ms-python.python-2018.8.0\pythonFiles\experimental\ptvsd\ptvsd\pathutils.py", line 60, in _get_actual_filename    fragments += ["{}[{}]".format(d[:-1], d[-1])]
IndexError: string index out of range
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `ptvsd/pathutils.py`
Content:
```
1 # Copyright (c) Microsoft Corporation. All rights reserved.
2 # Licensed under the MIT License. See LICENSE in the project root
3 # for license information.
4 
5 from __future__ import print_function, with_statement, absolute_import
6 
7 from glob import glob
8 import os.path
9 import platform
10 
11 
12 MAX_FILES_TO_CACHE = 1000
13 
14 
15 class PathUnNormcase(object):
16     """Ensures path names of files are returned as they exist on the fs."""
17 
18     def __init__(self):
19         self._dict = {}
20         self._enabled = False
21 
22     def enable(self):
23         self._enabled = platform.system() == 'Windows'
24 
25     def un_normcase(self, file_path):
26         if not self._enabled or len(file_path) == 0:
27             return file_path
28         if file_path in self._dict:
29             return self._dict[file_path]
30         file_path_to_return = self._get_actual_filename(file_path)
31         self.track_file_path_case(file_path_to_return)
32         return file_path_to_return
33 
34     def track_file_path_case(self, file_path):
35         if not self._enabled:
36             return
37         if len(self._dict) > MAX_FILES_TO_CACHE:
38             self._dict.clear()
39         self._dict[file_path] = file_path
40 
41     def _get_actual_filename(self, name):
42         """
43         Use glob to search for a file by building a regex.
44         Original source from https://stackoverflow.com/a/30374360/4443457
45         (Modified to match file name as well).
46         """
47 
48         sep = os.path.sep
49         parts = os.path.normpath(name).split(sep)
50         dirs = parts[0:-1]
51         filename = '{}[{}]'.format(parts[-1][:-1], parts[-1][-1:])
52         path_fragment1 = dirs[0].upper()
53         if dirs[0] == os.path.splitdrive(name)[0]:
54             fragments = [path_fragment1]
55         else:
56             dir_names = os.listdir(os.getcwd())
57             fragments = list(filter(
58                             lambda x: x.upper() == path_fragment1, dir_names))
59         for d in dirs[1:]:
60             fragments += ["{}[{}]".format(d[:-1], d[-1])]
61         path = glob(sep.join(fragments))
62         if not path:
63             return name
64         res = glob(sep.join((path[0], filename)))
65         if not res:
66             return name
67         return res[0]
68
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/ptvsd/pathutils.py b/ptvsd/pathutils.py
--- a/ptvsd/pathutils.py
+++ b/ptvsd/pathutils.py
@@ -56,8 +56,7 @@
             dir_names = os.listdir(os.getcwd())
             fragments = list(filter(
                             lambda x: x.upper() == path_fragment1, dir_names))
-        for d in dirs[1:]:
-            fragments += ["{}[{}]".format(d[:-1], d[-1])]
+        fragments += list(d for d in dirs[1:] if d)
         path = glob(sep.join(fragments))
         if not path:
             return name

{"golden_diff": "diff --git a/ptvsd/pathutils.py b/ptvsd/pathutils.py\n--- a/ptvsd/pathutils.py\n+++ b/ptvsd/pathutils.py\n@@ -56,8 +56,7 @@\n             dir_names = os.listdir(os.getcwd())\n             fragments = list(filter(\n                             lambda x: x.upper() == path_fragment1, dir_names))\n-        for d in dirs[1:]:\n-            fragments += [\"{}[{}]\".format(d[:-1], d[-1])]\n+        fragments += list(d for d in dirs[1:] if d)\n         path = glob(sep.join(fragments))\n         if not path:\n             return name\n", "issue": "Debugger raising IndexError\nMicrosoft/vscode-python#2499\r\n\r\n```\r\nPS C:\\Users\\Hugh.Groves> cd '\\\\global.arup.com\\americas\\Jobs\\STJ\\230000\\230597-00(ACDO)\\4-04 Engineering\\4-04-02 Concrete\\02 Calculations\\19 Staged Construction\\99-Tools\\CreateBatches'; ${env:PYTHONIOENCODING}='UTF-8'; ${env:PYTHONUNBUFFNIOENCODING}='UTF-8'; ${env:PYTHONUNBUFFERED}='1'; ${env:PYTHONPATH}='c:\\Users\\Hugh.Groves\\.vscode\\extensions\\ms-python.python-2018.8.0\\pythonFiles\\experimental\\ptvsd'; & 'C:\\Users\\Hugh.Groves\\AppDthon.exe' '-m' 'ptvsd' '--host' 'localhoata\\Local\\Continuum\\Anaconda3\\envs\\p3\\python.exe' '-m' 'ptvsd' '--host' 'localhost' '--port' '53026' '\\\\global.arup.com\\americas\\Jobs\\STJ\\230000\\230597-00(ACDO)\\4-04 Engineering\\4-04-02 Concrete\\02 Calculations\\19 Staged Construction\\99-Tools\\CreateBatches\\CreateBatches_02.py'\r\nTraceback (most recent call last):\r\n  File \"c:\\Users\\Hugh.Groves\\.vscode\\extensions\\ms-python.python-2018.8.0\\pythonFiles\\experimental\\ptvsd\\ptvsd\\wrapper.py\", line 1254, in done\r\n    fut.result()\r\n  File \"c:\\Users\\Hugh.Groves\\.vscode\\extensions\\ms-python.python-2018.8.0\\pythonFiles\\experimental\\ptvsd\\ptvsd\\futures.py\", line 40, in result\r\n    reraise(self._exc_info)\r\n  File \"c:\\Users\\Hugh.Groves\\.vscode\\extensions\\ms-python.python-2018.8.0\\pythonFiles\\experimental\\ptvsd\\ptvsd\\reraise3.py\", line 8, in reraise\r\n    raise exc_info[1].with_traceback(exc_info[2])\r\n  File \"c:\\Users\\Hugh.Groves\\.vscode\\extensions\\ms-python.python-2018.8.0\\pythonFiles\\experimental\\ptvsd\\ptvsd\\futures.py\", line 155, in callback\r\n    x = it.send(fut.result())\r\n  File \"c:\\Users\\Hugh.Groves\\.vscode\\extensions\\ms-python.python-2018.8.0\\pythonFiles\\experimental\\ptvsd\\ptvsd\\wrapper.py\", line 1605, in on_stackTrace\r\n    norm_path = self.path_casing.un_normcase(unquote(str(xframe['file'])))  # noqa\r\n  File \"c:\\Users\\Hugh.Groves\\.vscode\\extensions\\ms-python.python-2018.8.0\\pythonFiles\\experimental\\ptvsd\\ptvsd\\pathutils.py\", line 30, in un_normcase\r\n    file_path_to_return = self._get_actual_filename(file_path)\r\n  File \"c:\\Users\\Hugh.Groves\\.vscode\\extensions\\ms-python.python-2018.8.0\\pythonFiles\\experimental\\ptvsd\\ptvsd\\pathutils.py\", line 60, in _get_actual_filename\r\n    fragments += [\"{}[{}]\".format(d[:-1], d[-1])]\r\nIndexError: string index out of range\r\nTraceback (most recent call last):\r\n  File \"c:\\Users\\Hugh.Groves\\.vscode\\extensions\\ms-python.python-2018.8.0\\pythonFiles\\experimental\\ptvsd\\ptvsd\\wrapper.py\", line 1254, in donetal\\ptvsd\\ptvsd\\wrapper.py\", line 1254, in done\r\n    fut.result()                                                                               tal\\ptvsd\\ptvsd\\futures.py\", line 40, in result\r\n  File \"c:\\Users\\Hugh.Groves\\.vscode\\extensions\\ms-python.python-2018.8.0\\pythonFiles\\experimental\\ptvsd\\ptvsd\\futures.py\", line 40, in result                                                tal\\ptvsd\\ptvsd\\reraise3.py\", line 8, in reraise\r\n    reraise(self._exc_info)\r\n  File \"c:\\Users\\Hugh.Groves\\.vscode\\extensions\\ms-python.python-2018.8.0\\pythonFiles\\experimental\\ptvsd\\ptvsd\\futures.py\", line 155, in callbacktal\\ptvsd\\ptvsd\\reraise3.py\", line 8, in reraise\r\n    raise exc_info[1].with_traceback(exc_info[2])\r\n  File \"c:\\Users\\Hugh.Groves\\.vscode\\extensions\\ms-python.python-2018.8.0\\pythonFiles\\experimental\\ptvsd\\ptvsd\\futures.py\", line 155, in callback    x = it.send(fut.result())\r\n  File \"c:\\Users\\Hugh.Groves\\.vscode\\extensions\\ms-python.python-2018.8.0\\pythonFiles\\experimental\\ptvsd\\ptvsd\\wrapper.py\", line 1605, in on_stackTrace\r\n    norm_path = self.path_casing.un_normcase(unquote(str(xframe['file'])))  # noqa  File \"c:\\Users\\Hugh.Groves\\.vscode\\extensions\\ms-python.python-2018.8.0\\pythonFiles\\experimental\\ptvsd\\ptvsd\\pathutils.py\", line 30, in un_normcase\r\n    file_path_to_return = self._get_actual_filename(file_path)\r\n  File \"c:\\Users\\Hugh.Groves\\.vscode\\extensions\\ms-python.python-2018.8.0\\pythonFiles\\experimental\\ptvsd\\ptvsd\\pathutils.py\", line 60, in _get_actual_filename    fragments += [\"{}[{}]\".format(d[:-1], d[-1])]\r\nIndexError: string index out of range\r\n```\n", "before_files": [{"content": "# Copyright (c) Microsoft Corporation. All rights reserved.\n# Licensed under the MIT License. See LICENSE in the project root\n# for license information.\n\nfrom __future__ import print_function, with_statement, absolute_import\n\nfrom glob import glob\nimport os.path\nimport platform\n\n\nMAX_FILES_TO_CACHE = 1000\n\n\nclass PathUnNormcase(object):\n    \"\"\"Ensures path names of files are returned as they exist on the fs.\"\"\"\n\n    def __init__(self):\n        self._dict = {}\n        self._enabled = False\n\n    def enable(self):\n        self._enabled = platform.system() == 'Windows'\n\n    def un_normcase(self, file_path):\n        if not self._enabled or len(file_path) == 0:\n            return file_path\n        if file_path in self._dict:\n            return self._dict[file_path]\n        file_path_to_return = self._get_actual_filename(file_path)\n        self.track_file_path_case(file_path_to_return)\n        return file_path_to_return\n\n    def track_file_path_case(self, file_path):\n        if not self._enabled:\n            return\n        if len(self._dict) > MAX_FILES_TO_CACHE:\n            self._dict.clear()\n        self._dict[file_path] = file_path\n\n    def _get_actual_filename(self, name):\n        \"\"\"\n        Use glob to search for a file by building a regex.\n        Original source from https://stackoverflow.com/a/30374360/4443457\n        (Modified to match file name as well).\n        \"\"\"\n\n        sep = os.path.sep\n        parts = os.path.normpath(name).split(sep)\n        dirs = parts[0:-1]\n        filename = '{}[{}]'.format(parts[-1][:-1], parts[-1][-1:])\n        path_fragment1 = dirs[0].upper()\n        if dirs[0] == os.path.splitdrive(name)[0]:\n            fragments = [path_fragment1]\n        else:\n            dir_names = os.listdir(os.getcwd())\n            fragments = list(filter(\n                            lambda x: x.upper() == path_fragment1, dir_names))\n        for d in dirs[1:]:\n            fragments += [\"{}[{}]\".format(d[:-1], d[-1])]\n        path = glob(sep.join(fragments))\n        if not path:\n            return name\n        res = glob(sep.join((path[0], filename)))\n        if not res:\n            return name\n        return res[0]\n", "path": "ptvsd/pathutils.py"}], "after_files": [{"content": "# Copyright (c) Microsoft Corporation. All rights reserved.\n# Licensed under the MIT License. See LICENSE in the project root\n# for license information.\n\nfrom __future__ import print_function, with_statement, absolute_import\n\nfrom glob import glob\nimport os.path\nimport platform\n\n\nMAX_FILES_TO_CACHE = 1000\n\n\nclass PathUnNormcase(object):\n    \"\"\"Ensures path names of files are returned as they exist on the fs.\"\"\"\n\n    def __init__(self):\n        self._dict = {}\n        self._enabled = False\n\n    def enable(self):\n        self._enabled = platform.system() == 'Windows'\n\n    def un_normcase(self, file_path):\n        if not self._enabled or len(file_path) == 0:\n            return file_path\n        if file_path in self._dict:\n            return self._dict[file_path]\n        file_path_to_return = self._get_actual_filename(file_path)\n        self.track_file_path_case(file_path_to_return)\n        return file_path_to_return\n\n    def track_file_path_case(self, file_path):\n        if not self._enabled:\n            return\n        if len(self._dict) > MAX_FILES_TO_CACHE:\n            self._dict.clear()\n        self._dict[file_path] = file_path\n\n    def _get_actual_filename(self, name):\n        \"\"\"\n        Use glob to search for a file by building a regex.\n        Original source from https://stackoverflow.com/a/30374360/4443457\n        (Modified to match file name as well).\n        \"\"\"\n\n        sep = os.path.sep\n        parts = os.path.normpath(name).split(sep)\n        dirs = parts[0:-1]\n        filename = '{}[{}]'.format(parts[-1][:-1], parts[-1][-1:])\n        path_fragment1 = dirs[0].upper()\n        if dirs[0] == os.path.splitdrive(name)[0]:\n            fragments = [path_fragment1]\n        else:\n            dir_names = os.listdir(os.getcwd())\n            fragments = list(filter(\n                            lambda x: x.upper() == path_fragment1, dir_names))\n        fragments += list(d for d in dirs[1:] if d)\n        path = glob(sep.join(fragments))\n        if not path:\n            return name\n        res = glob(sep.join((path[0], filename)))\n        if not res:\n            return name\n        return res[0]\n", "path": "ptvsd/pathutils.py"}]}