# Buggy code
def _group_references_by_file(
    self, references: "List[ReferenceDict]", base_dir: "Optional[str]"
) -> "Dict[str, List[Tuple[Point, str]]]":
    """Return a dictionary that groups references by the file it belongs."""
    grouped_references = {}  # type: Dict[str, List[Tuple[Point, str]]]
    for reference in references:
        file_path = uri_to_filename(reference["uri"])
        point = Point.from_lsp(reference["range"]["start"])

        # get line of the reference, to showcase its use
        reference_line = linecache.getline(file_path, point.row + 1).strip()

        if base_dir:
            file_path = os.path.relpath(file_path, base_dir)

        if grouped_references.get(file_path) is None:
            grouped_references[file_path] = []
        grouped_references[file_path].append((point, reference_line))

    # we don't want to cache the line, we always want to get fresh data
    linecache.clearcache()

    return grouped_references


# Traceback (ValueError)
LSP:  --> textDocument/references
LSP:      [{'uri': 'file:///D:/Amjad/rls-vscode/src/extension.ts', 'range': {'end': {'line': 25, 'character': 20}, 'start': {'line': 25, 'character': 9}}}, {'uri': 'file:///D:/Amjad/rls-vscode/src/extension.ts', 'range': {'end': {'line': 434, 'character': 25}, 'start': {'line': 434, 'character': 14}}}, {'uri': 'file:///D:/Amjad/rls-vscode/src/rustup.ts', 'range': {'end': {'line': 67, 'character': 33}, 'start': {'line': 67, 'character': 22}}}]
Error handling server payload
Traceback (most recent call last):
File "C:\Users\Lehdhili\AppData\Roaming\Sublime Text 3\Packages\LSP\plugin\core\rpc.py", line 150, in receive_payload
self.response_handler(payload)
File "C:\Users\Lehdhili\AppData\Roaming\Sublime Text 3\Packages\LSP\plugin\core\rpc.py", line 169, in response_handler
handler(response["result"])
File "C:\Users\Lehdhili\AppData\Roaming\Sublime Text 3\Packages\LSP\plugin\references.py", line 45, in <lambda>
request, lambda response: self.handle_response(response, pos))
File "C:\Users\Lehdhili\AppData\Roaming\Sublime Text 3\Packages\LSP\plugin\references.py", line 64, in handle_response
formatted_references = self._get_formatted_references(response, base_dir)
File "C:\Users\Lehdhili\AppData\Roaming\Sublime Text 3\Packages\LSP\plugin\references.py", line 142, in _get_formatted_references
grouped_references = self._group_references_by_file(references, base_dir)
File "C:\Users\Lehdhili\AppData\Roaming\Sublime Text 3\Packages\LSP\plugin\references.py", line 150, in _group_references_by_file
relative_file_path = os.path.relpath(file_path, base_dir)
File "./python3.3/ntpath.py", line 564, in relpath
ValueError: path is on mount 'D:', start on mount 'C:'

# Fixed code
def _group_references_by_file(
    self, references: "List[ReferenceDict]"
) -> "Dict[str, List[Tuple[Point, str]]]":
    """Return a dictionary that groups references by the file it belongs."""
    grouped_references = {}  # type: Dict[str, List[Tuple[Point, str]]]
    for reference in references:
        file_path = uri_to_filename(reference["uri"])
        point = Point.from_lsp(reference["range"]["start"])

        # get line of the reference, to showcase its use
        reference_line = linecache.getline(file_path, point.row + 1).strip()

        if grouped_references.get(file_path) is None:
            grouped_references[file_path] = []
        grouped_references[file_path].append((point, reference_line))

    # we don't want to cache the line, we always want to get fresh data
    linecache.clearcache()

    return grouped_references