prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  On Windows, the drive letter in server responsed file URIs are lowercase.
  **Describe the bug**
  
  I tried both intelephense and pyright, they both returned lowercased drive letter thus I suspect it's a standard. (or maybe VSCode's LSP lib does it)
  
  https://user-images.githubusercontent.com/6594915/123961095-96286c80-d9e2-11eb-8ada-0da9af754a55.mp4
  
  In "Goto Definition...", this causes ST to open a file whose drive letter is in lowercase. And that may cause various mysterious problem sometimes... Or maybe, this should be fixed in ST core.
  
  **To Reproduce**
  Steps to reproduce the behavior:
  1. Install LSP-intelephense with a Windows build ST
  2. Open a PHP project
  3. Make sure the definition file is not opened in a tab already
  4. Do "Goto Definition"
  5. The newly opened tab should have a lower drive letter
  
  **Expected behavior**
  
  The drive letter should be uppercase.
  
  **Environment (please complete the following information):**
  - OS: Win10 21H1 x64
  - Sublime Text version: 4109
  - LSP version: 4070-1.6.1
  - Language servers used: intelephense, pyright
  
  **Additional context**
  
  This is a Windows-only issue as it's case-insensitive.
  
  
  </issue>
  <code>
  [start of plugin/core/url.py]
  1 from .typing import Any, Tuple
  2 from urllib.parse import quote
  3 from urllib.parse import urljoin
  4 from urllib.parse import urlparse
  5 from urllib.request import pathname2url
  6 from urllib.request import url2pathname
  7 import os
  8 import re
  9 
  10 import sublime
  11 
  12 
  13 def filename_to_uri(file_name: str) -> str:
  14     """
  15     Convert a file name obtained from view.file_name() into an URI
  16     """
  17     prefix = sublime.installed_packages_path()
  18     if file_name.startswith(prefix):
  19         return _to_resource_uri(file_name, prefix)
  20     prefix = sublime.packages_path()
  21     if file_name.startswith(prefix) and not os.path.exists(file_name):
  22         return _to_resource_uri(file_name, prefix)
  23     path = pathname2url(file_name)
  24     re.sub(r"^([A-Z]):/", _lowercase_driveletter, path)
  25     return urljoin("file:", path)
  26 
  27 
  28 def view_to_uri(view: sublime.View) -> str:
  29     file_name = view.file_name()
  30     if not file_name:
  31         return "buffer://sublime/{}".format(view.buffer_id())
  32     return filename_to_uri(file_name)
  33 
  34 
  35 def uri_to_filename(uri: str) -> str:
  36     """
  37     DEPRECATED: An URI associated to a view does not necessarily have a "file:" scheme.
  38     Use urllib.parse.urlparse to determine the scheme and go from there.
  39     Use urllib.parse.unquote to unquote the path.
  40     """
  41     parsed = urlparse(uri)
  42     assert parsed.scheme == "file"
  43     if os.name == 'nt':
  44         # url2pathname does not understand %3A (VS Code's encoding forced on all servers :/)
  45         return url2pathname(parsed.path).strip('\\')
  46     else:
  47         return url2pathname(parsed.path)
  48 
  49 
  50 def parse_uri(uri: str) -> Tuple[str, str]:
  51     """
  52     Parses an URI into a tuple where the first element is the URI scheme. The
  53     second element is the local filesystem path if the URI is a file URI,
  54     otherwise the second element is the original URI.
  55     """
  56     parsed = urlparse(uri)
  57     if parsed.scheme == "file":
  58         if os.name == 'nt':
  59             # TODO: this is wrong for UNC paths
  60             return parsed.scheme, url2pathname(parsed.path).strip('\\')
  61         return parsed.scheme, url2pathname(parsed.path)
  62     return parsed.scheme, uri
  63 
  64 
  65 def _to_resource_uri(path: str, prefix: str) -> str:
  66     """
  67     Terrible hacks from ST core leak into packages as well.
  68 
  69     See: https://github.com/sublimehq/sublime_text/issues/3742
  70     """
  71     return "res://Packages{}".format(quote(path[len(prefix):]))
  72 
  73 
  74 def _lowercase_driveletter(match: Any) -> str:
  75     """
  76     For compatibility with certain other language clients.
  77     """
  78     return "{}:/".format(match.group(1).lower())
  79
  [end of plugin/core/url.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/plugin/core/url.py b/plugin/core/url.py
  --- a/plugin/core/url.py
  +++ b/plugin/core/url.py
  @@ -21,7 +21,6 @@
       if file_name.startswith(prefix) and not os.path.exists(file_name):
           return _to_resource_uri(file_name, prefix)
       path = pathname2url(file_name)
  -    re.sub(r"^([A-Z]):/", _lowercase_driveletter, path)
       return urljoin("file:", path)
   
   
  @@ -42,7 +41,8 @@
       assert parsed.scheme == "file"
       if os.name == 'nt':
           # url2pathname does not understand %3A (VS Code's encoding forced on all servers :/)
  -        return url2pathname(parsed.path).strip('\\')
  +        path = url2pathname(parsed.path).strip('\\')
  +        return re.sub(r"^([a-z]):", _uppercase_driveletter, path)
       else:
           return url2pathname(parsed.path)
   
  @@ -71,8 +71,8 @@
       return "res://Packages{}".format(quote(path[len(prefix):]))
   
   
  -def _lowercase_driveletter(match: Any) -> str:
  +def _uppercase_driveletter(match: Any) -> str:
       """
  -    For compatibility with certain other language clients.
  +    For compatibility with Sublime's VCS status in the status bar.
       """
  -    return "{}:/".format(match.group(1).lower())
  +    return "{}:".format(match.group(1).upper())
  
verification_info: {"golden_diff": "diff --git a/plugin/core/url.py b/plugin/core/url.py\n--- a/plugin/core/url.py\n+++ b/plugin/core/url.py\n@@ -21,7 +21,6 @@\n     if file_name.startswith(prefix) and not os.path.exists(file_name):\n         return _to_resource_uri(file_name, prefix)\n     path = pathname2url(file_name)\n-    re.sub(r\"^([A-Z]):/\", _lowercase_driveletter, path)\n     return urljoin(\"file:\", path)\n \n \n@@ -42,7 +41,8 @@\n     assert parsed.scheme == \"file\"\n     if os.name == 'nt':\n         # url2pathname does not understand %3A (VS Code's encoding forced on all servers :/)\n-        return url2pathname(parsed.path).strip('\\\\')\n+        path = url2pathname(parsed.path).strip('\\\\')\n+        return re.sub(r\"^([a-z]):\", _uppercase_driveletter, path)\n     else:\n         return url2pathname(parsed.path)\n \n@@ -71,8 +71,8 @@\n     return \"res://Packages{}\".format(quote(path[len(prefix):]))\n \n \n-def _lowercase_driveletter(match: Any) -> str:\n+def _uppercase_driveletter(match: Any) -> str:\n     \"\"\"\n-    For compatibility with certain other language clients.\n+    For compatibility with Sublime's VCS status in the status bar.\n     \"\"\"\n-    return \"{}:/\".format(match.group(1).lower())\n+    return \"{}:\".format(match.group(1).upper())\n", "issue": "On Windows, the drive letter in server responsed file URIs are lowercase.\n**Describe the bug**\r\n\r\nI tried both intelephense and pyright, they both returned lowercased drive letter thus I suspect it's a standard. (or maybe VSCode's LSP lib does it)\r\n\r\nhttps://user-images.githubusercontent.com/6594915/123961095-96286c80-d9e2-11eb-8ada-0da9af754a55.mp4\r\n\r\nIn \"Goto Definition...\", this causes ST to open a file whose drive letter is in lowercase. And that may cause various mysterious problem sometimes... Or maybe, this should be fixed in ST core.\r\n\r\n**To Reproduce**\r\nSteps to reproduce the behavior:\r\n1. Install LSP-intelephense with a Windows build ST\r\n2. Open a PHP project\r\n3. Make sure the definition file is not opened in a tab already\r\n4. Do \"Goto Definition\"\r\n5. The newly opened tab should have a lower drive letter\r\n\r\n**Expected behavior**\r\n\r\nThe drive letter should be uppercase.\r\n\r\n**Environment (please complete the following information):**\r\n- OS: Win10 21H1 x64\r\n- Sublime Text version: 4109\r\n- LSP version: 4070-1.6.1\r\n- Language servers used: intelephense, pyright\r\n\r\n**Additional context**\r\n\r\nThis is a Windows-only issue as it's case-insensitive.\r\n\n", "before_files": [{"content": "from .typing import Any, Tuple\nfrom urllib.parse import quote\nfrom urllib.parse import urljoin\nfrom urllib.parse import urlparse\nfrom urllib.request import pathname2url\nfrom urllib.request import url2pathname\nimport os\nimport re\n\nimport sublime\n\n\ndef filename_to_uri(file_name: str) -> str:\n    \"\"\"\n    Convert a file name obtained from view.file_name() into an URI\n    \"\"\"\n    prefix = sublime.installed_packages_path()\n    if file_name.startswith(prefix):\n        return _to_resource_uri(file_name, prefix)\n    prefix = sublime.packages_path()\n    if file_name.startswith(prefix) and not os.path.exists(file_name):\n        return _to_resource_uri(file_name, prefix)\n    path = pathname2url(file_name)\n    re.sub(r\"^([A-Z]):/\", _lowercase_driveletter, path)\n    return urljoin(\"file:\", path)\n\n\ndef view_to_uri(view: sublime.View) -> str:\n    file_name = view.file_name()\n    if not file_name:\n        return \"buffer://sublime/{}\".format(view.buffer_id())\n    return filename_to_uri(file_name)\n\n\ndef uri_to_filename(uri: str) -> str:\n    \"\"\"\n    DEPRECATED: An URI associated to a view does not necessarily have a \"file:\" scheme.\n    Use urllib.parse.urlparse to determine the scheme and go from there.\n    Use urllib.parse.unquote to unquote the path.\n    \"\"\"\n    parsed = urlparse(uri)\n    assert parsed.scheme == \"file\"\n    if os.name == 'nt':\n        # url2pathname does not understand %3A (VS Code's encoding forced on all servers :/)\n        return url2pathname(parsed.path).strip('\\\\')\n    else:\n        return url2pathname(parsed.path)\n\n\ndef parse_uri(uri: str) -> Tuple[str, str]:\n    \"\"\"\n    Parses an URI into a tuple where the first element is the URI scheme. The\n    second element is the local filesystem path if the URI is a file URI,\n    otherwise the second element is the original URI.\n    \"\"\"\n    parsed = urlparse(uri)\n    if parsed.scheme == \"file\":\n        if os.name == 'nt':\n            # TODO: this is wrong for UNC paths\n            return parsed.scheme, url2pathname(parsed.path).strip('\\\\')\n        return parsed.scheme, url2pathname(parsed.path)\n    return parsed.scheme, uri\n\n\ndef _to_resource_uri(path: str, prefix: str) -> str:\n    \"\"\"\n    Terrible hacks from ST core leak into packages as well.\n\n    See: https://github.com/sublimehq/sublime_text/issues/3742\n    \"\"\"\n    return \"res://Packages{}\".format(quote(path[len(prefix):]))\n\n\ndef _lowercase_driveletter(match: Any) -> str:\n    \"\"\"\n    For compatibility with certain other language clients.\n    \"\"\"\n    return \"{}:/\".format(match.group(1).lower())\n", "path": "plugin/core/url.py"}]}