We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
`force_group` argument support for `lsp_symbol_references` command
Working in multiple groups, `lsp_symbol_references` command doesn't work across groups but instead duplicates already open files when one of the listed references is selected to open. It should have a flag to disable `force_group` setting.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `plugin/references.py`
Content:
```
1 from .core.protocol import Location
2 from .core.protocol import Point
3 from .core.protocol import Request
4 from .core.registry import get_position
5 from .core.registry import LspTextCommand
6 from .core.registry import windows
7 from .core.sessions import Session
8 from .core.settings import userprefs
9 from .core.types import ClientConfig
10 from .core.typing import Dict, List, Optional, Tuple
11 from .core.views import get_line
12 from .core.views import get_symbol_kind_from_scope
13 from .core.views import get_uri_and_position_from_location
14 from .core.views import text_document_position_params
15 from .locationpicker import LocationPicker
16 import functools
17 import linecache
18 import os
19 import sublime
20 
21 
22 class LspSymbolReferencesCommand(LspTextCommand):
23 
24     capability = 'referencesProvider'
25 
26     def is_enabled(
27         self,
28         event: Optional[dict] = None,
29         point: Optional[int] = None,
30         side_by_side: bool = False,
31         fallback: bool = False,
32     ) -> bool:
33         return fallback or super().is_enabled(event, point)
34 
35     def is_visible(
36         self,
37         event: Optional[dict] = None,
38         point: Optional[int] = None,
39         side_by_side: bool = False,
40         fallback: bool = False,
41     ) -> bool:
42         if self.applies_to_context_menu(event):
43             return self.is_enabled(event, point, side_by_side, fallback)
44         return True
45 
46     def run(
47         self,
48         _: sublime.Edit,
49         event: Optional[dict] = None,
50         point: Optional[int] = None,
51         side_by_side: bool = False,
52         fallback: bool = False,
53     ) -> None:
54         session = self.best_session(self.capability)
55         file_path = self.view.file_name()
56         pos = get_position(self.view, event, point)
57         if session and file_path and pos is not None:
58             position_params = text_document_position_params(self.view, pos)
59             params = {
60                 'textDocument': position_params['textDocument'],
61                 'position': position_params['position'],
62                 'context': {"includeDeclaration": False},
63             }
64             request = Request("textDocument/references", params, self.view, progress=True)
65             word_range = self.view.word(pos)
66             session.send_request(
67                 request,
68                 functools.partial(
69                     self._handle_response_async,
70                     self.view.substr(word_range),
71                     session,
72                     side_by_side,
73                     fallback,
74                     word_range.begin()
75                 )
76             )
77         else:
78             self._handle_no_results(fallback, side_by_side)
79 
80     def _handle_response_async(
81         self,
82         word: str,
83         session: Session,
84         side_by_side: bool,
85         fallback: bool,
86         position: int,
87         response: Optional[List[Location]]
88     ) -> None:
89         sublime.set_timeout(lambda: self._handle_response(word, session, side_by_side, fallback, position, response))
90 
91     def _handle_response(
92         self,
93         word: str,
94         session: Session,
95         side_by_side: bool,
96         fallback: bool,
97         position: int,
98         response: Optional[List[Location]]
99     ) -> None:
100         if response:
101             if userprefs().show_references_in_quick_panel:
102                 self._show_references_in_quick_panel(word, session, response, side_by_side, position)
103             else:
104                 self._show_references_in_output_panel(word, session, response)
105         else:
106             self._handle_no_results(fallback, side_by_side)
107 
108     def _handle_no_results(self, fallback: bool = False, side_by_side: bool = False) -> None:
109         window = self.view.window()
110         if not window:
111             return
112         if fallback:
113             window.run_command("goto_reference", {"side_by_side": side_by_side})
114         else:
115             window.status_message("No references found")
116 
117     def _show_references_in_quick_panel(
118         self, word: str, session: Session, locations: List[Location], side_by_side: bool, position: int
119     ) -> None:
120         self.view.run_command("add_jump_record", {"selection": [(r.a, r.b) for r in self.view.sel()]})
121         kind = get_symbol_kind_from_scope(self.view.scope_name(position))
122         LocationPicker(self.view, session, locations, side_by_side, placeholder="References to " + word, kind=kind)
123 
124     def _show_references_in_output_panel(self, word: str, session: Session, locations: List[Location]) -> None:
125         wm = windows.lookup(session.window)
126         if not wm:
127             return
128         panel = wm.panel_manager and wm.panel_manager.ensure_references_panel()
129         if not panel:
130             return
131         base_dir = wm.get_project_path(self.view.file_name() or "")
132         to_render = []  # type: List[str]
133         references_count = 0
134         references_by_file = _group_locations_by_uri(wm.window, session.config, locations)
135         for file, references in references_by_file.items():
136             to_render.append('{}:'.format(_get_relative_path(base_dir, file)))
137             for reference in references:
138                 references_count += 1
139                 point, line = reference
140                 to_render.append(" {:>4}:{:<4} {}".format(point.row + 1, point.col + 1, line))
141             to_render.append("")  # add spacing between filenames
142         characters = "\n".join(to_render)
143         panel.settings().set("result_base_dir", base_dir)
144         panel.run_command("lsp_clear_panel")
145         wm.window.run_command("show_panel", {"panel": "output.references"})
146         panel.run_command('append', {
147             'characters': "{} references for '{}'\n\n{}".format(references_count, word, characters),
148             'force': True,
149             'scroll_to_end': False
150         })
151         # highlight all word occurrences
152         regions = panel.find_all(r"\b{}\b".format(word))
153         panel.add_regions('ReferenceHighlight', regions, 'comment', flags=sublime.DRAW_OUTLINED)
154 
155 
156 def _get_relative_path(base_dir: Optional[str], file_path: str) -> str:
157     if base_dir:
158         try:
159             return os.path.relpath(file_path, base_dir)
160         except ValueError:
161             # On Windows, ValueError is raised when path and start are on different drives.
162             pass
163     return file_path
164 
165 
166 def _group_locations_by_uri(
167     window: sublime.Window,
168     config: ClientConfig,
169     locations: List[Location]
170 ) -> Dict[str, List[Tuple[Point, str]]]:
171     """Return a dictionary that groups locations by the URI it belongs."""
172     grouped_locations = {}  # type: Dict[str, List[Tuple[Point, str]]]
173     for location in locations:
174         uri, position = get_uri_and_position_from_location(location)
175         file_path = config.map_server_uri_to_client_path(uri)
176         point = Point.from_lsp(position)
177         # get line of the reference, to showcase its use
178         reference_line = get_line(window, file_path, point.row)
179         if grouped_locations.get(file_path) is None:
180             grouped_locations[file_path] = []
181         grouped_locations[file_path].append((point, reference_line))
182     # we don't want to cache the line, we always want to get fresh data
183     linecache.clearcache()
184     return grouped_locations
185
```
--- 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/plugin/references.py b/plugin/references.py
--- a/plugin/references.py
+++ b/plugin/references.py
@@ -28,7 +28,9 @@
         event: Optional[dict] = None,
         point: Optional[int] = None,
         side_by_side: bool = False,
+        force_group: bool = True,
         fallback: bool = False,
+        group: int = -1
     ) -> bool:
         return fallback or super().is_enabled(event, point)
 
@@ -37,7 +39,9 @@
         event: Optional[dict] = None,
         point: Optional[int] = None,
         side_by_side: bool = False,
+        force_group: bool = True,
         fallback: bool = False,
+        group: int = -1
     ) -> bool:
         if self.applies_to_context_menu(event):
             return self.is_enabled(event, point, side_by_side, fallback)
@@ -49,7 +53,9 @@
         event: Optional[dict] = None,
         point: Optional[int] = None,
         side_by_side: bool = False,
+        force_group: bool = True,
         fallback: bool = False,
+        group: int = -1
     ) -> None:
         session = self.best_session(self.capability)
         file_path = self.view.file_name()
@@ -70,7 +76,9 @@
                     self.view.substr(word_range),
                     session,
                     side_by_side,
+                    force_group,
                     fallback,
+                    group,
                     word_range.begin()
                 )
             )
@@ -82,24 +90,30 @@
         word: str,
         session: Session,
         side_by_side: bool,
+        force_group: bool,
         fallback: bool,
+        group: int,
         position: int,
         response: Optional[List[Location]]
     ) -> None:
-        sublime.set_timeout(lambda: self._handle_response(word, session, side_by_side, fallback, position, response))
+        sublime.set_timeout(lambda: self._handle_response(
+            word, session, side_by_side, force_group, fallback, group, position, response))
 
     def _handle_response(
         self,
         word: str,
         session: Session,
         side_by_side: bool,
+        force_group: bool,
         fallback: bool,
+        group: int,
         position: int,
         response: Optional[List[Location]]
     ) -> None:
         if response:
             if userprefs().show_references_in_quick_panel:
-                self._show_references_in_quick_panel(word, session, response, side_by_side, position)
+                self._show_references_in_quick_panel(
+                    word, session, response, side_by_side, force_group, group, position)
             else:
                 self._show_references_in_output_panel(word, session, response)
         else:
@@ -115,11 +129,19 @@
             window.status_message("No references found")
 
     def _show_references_in_quick_panel(
-        self, word: str, session: Session, locations: List[Location], side_by_side: bool, position: int
+        self,
+        word: str,
+        session: Session,
+        locations: List[Location],
+        side_by_side: bool,
+        force_group: bool,
+        group: int,
+        position: int
     ) -> None:
         self.view.run_command("add_jump_record", {"selection": [(r.a, r.b) for r in self.view.sel()]})
+        placeholder = "References to " + word
         kind = get_symbol_kind_from_scope(self.view.scope_name(position))
-        LocationPicker(self.view, session, locations, side_by_side, placeholder="References to " + word, kind=kind)
+        LocationPicker(self.view, session, locations, side_by_side, force_group, group, placeholder, kind)
 
     def _show_references_in_output_panel(self, word: str, session: Session, locations: List[Location]) -> None:
         wm = windows.lookup(session.window)

{"golden_diff": "diff --git a/plugin/references.py b/plugin/references.py\n--- a/plugin/references.py\n+++ b/plugin/references.py\n@@ -28,7 +28,9 @@\n         event: Optional[dict] = None,\n         point: Optional[int] = None,\n         side_by_side: bool = False,\n+        force_group: bool = True,\n         fallback: bool = False,\n+        group: int = -1\n     ) -> bool:\n         return fallback or super().is_enabled(event, point)\n \n@@ -37,7 +39,9 @@\n         event: Optional[dict] = None,\n         point: Optional[int] = None,\n         side_by_side: bool = False,\n+        force_group: bool = True,\n         fallback: bool = False,\n+        group: int = -1\n     ) -> bool:\n         if self.applies_to_context_menu(event):\n             return self.is_enabled(event, point, side_by_side, fallback)\n@@ -49,7 +53,9 @@\n         event: Optional[dict] = None,\n         point: Optional[int] = None,\n         side_by_side: bool = False,\n+        force_group: bool = True,\n         fallback: bool = False,\n+        group: int = -1\n     ) -> None:\n         session = self.best_session(self.capability)\n         file_path = self.view.file_name()\n@@ -70,7 +76,9 @@\n                     self.view.substr(word_range),\n                     session,\n                     side_by_side,\n+                    force_group,\n                     fallback,\n+                    group,\n                     word_range.begin()\n                 )\n             )\n@@ -82,24 +90,30 @@\n         word: str,\n         session: Session,\n         side_by_side: bool,\n+        force_group: bool,\n         fallback: bool,\n+        group: int,\n         position: int,\n         response: Optional[List[Location]]\n     ) -> None:\n-        sublime.set_timeout(lambda: self._handle_response(word, session, side_by_side, fallback, position, response))\n+        sublime.set_timeout(lambda: self._handle_response(\n+            word, session, side_by_side, force_group, fallback, group, position, response))\n \n     def _handle_response(\n         self,\n         word: str,\n         session: Session,\n         side_by_side: bool,\n+        force_group: bool,\n         fallback: bool,\n+        group: int,\n         position: int,\n         response: Optional[List[Location]]\n     ) -> None:\n         if response:\n             if userprefs().show_references_in_quick_panel:\n-                self._show_references_in_quick_panel(word, session, response, side_by_side, position)\n+                self._show_references_in_quick_panel(\n+                    word, session, response, side_by_side, force_group, group, position)\n             else:\n                 self._show_references_in_output_panel(word, session, response)\n         else:\n@@ -115,11 +129,19 @@\n             window.status_message(\"No references found\")\n \n     def _show_references_in_quick_panel(\n-        self, word: str, session: Session, locations: List[Location], side_by_side: bool, position: int\n+        self,\n+        word: str,\n+        session: Session,\n+        locations: List[Location],\n+        side_by_side: bool,\n+        force_group: bool,\n+        group: int,\n+        position: int\n     ) -> None:\n         self.view.run_command(\"add_jump_record\", {\"selection\": [(r.a, r.b) for r in self.view.sel()]})\n+        placeholder = \"References to \" + word\n         kind = get_symbol_kind_from_scope(self.view.scope_name(position))\n-        LocationPicker(self.view, session, locations, side_by_side, placeholder=\"References to \" + word, kind=kind)\n+        LocationPicker(self.view, session, locations, side_by_side, force_group, group, placeholder, kind)\n \n     def _show_references_in_output_panel(self, word: str, session: Session, locations: List[Location]) -> None:\n         wm = windows.lookup(session.window)\n", "issue": "`force_group` argument support for `lsp_symbol_references` command\nWorking in multiple groups, `lsp_symbol_references` command doesn't work across groups but instead duplicates already open files when one of the listed references is selected to open. It should have a flag to disable `force_group` setting.\n", "before_files": [{"content": "from .core.protocol import Location\nfrom .core.protocol import Point\nfrom .core.protocol import Request\nfrom .core.registry import get_position\nfrom .core.registry import LspTextCommand\nfrom .core.registry import windows\nfrom .core.sessions import Session\nfrom .core.settings import userprefs\nfrom .core.types import ClientConfig\nfrom .core.typing import Dict, List, Optional, Tuple\nfrom .core.views import get_line\nfrom .core.views import get_symbol_kind_from_scope\nfrom .core.views import get_uri_and_position_from_location\nfrom .core.views import text_document_position_params\nfrom .locationpicker import LocationPicker\nimport functools\nimport linecache\nimport os\nimport sublime\n\n\nclass LspSymbolReferencesCommand(LspTextCommand):\n\n    capability = 'referencesProvider'\n\n    def is_enabled(\n        self,\n        event: Optional[dict] = None,\n        point: Optional[int] = None,\n        side_by_side: bool = False,\n        fallback: bool = False,\n    ) -> bool:\n        return fallback or super().is_enabled(event, point)\n\n    def is_visible(\n        self,\n        event: Optional[dict] = None,\n        point: Optional[int] = None,\n        side_by_side: bool = False,\n        fallback: bool = False,\n    ) -> bool:\n        if self.applies_to_context_menu(event):\n            return self.is_enabled(event, point, side_by_side, fallback)\n        return True\n\n    def run(\n        self,\n        _: sublime.Edit,\n        event: Optional[dict] = None,\n        point: Optional[int] = None,\n        side_by_side: bool = False,\n        fallback: bool = False,\n    ) -> None:\n        session = self.best_session(self.capability)\n        file_path = self.view.file_name()\n        pos = get_position(self.view, event, point)\n        if session and file_path and pos is not None:\n            position_params = text_document_position_params(self.view, pos)\n            params = {\n                'textDocument': position_params['textDocument'],\n                'position': position_params['position'],\n                'context': {\"includeDeclaration\": False},\n            }\n            request = Request(\"textDocument/references\", params, self.view, progress=True)\n            word_range = self.view.word(pos)\n            session.send_request(\n                request,\n                functools.partial(\n                    self._handle_response_async,\n                    self.view.substr(word_range),\n                    session,\n                    side_by_side,\n                    fallback,\n                    word_range.begin()\n                )\n            )\n        else:\n            self._handle_no_results(fallback, side_by_side)\n\n    def _handle_response_async(\n        self,\n        word: str,\n        session: Session,\n        side_by_side: bool,\n        fallback: bool,\n        position: int,\n        response: Optional[List[Location]]\n    ) -> None:\n        sublime.set_timeout(lambda: self._handle_response(word, session, side_by_side, fallback, position, response))\n\n    def _handle_response(\n        self,\n        word: str,\n        session: Session,\n        side_by_side: bool,\n        fallback: bool,\n        position: int,\n        response: Optional[List[Location]]\n    ) -> None:\n        if response:\n            if userprefs().show_references_in_quick_panel:\n                self._show_references_in_quick_panel(word, session, response, side_by_side, position)\n            else:\n                self._show_references_in_output_panel(word, session, response)\n        else:\n            self._handle_no_results(fallback, side_by_side)\n\n    def _handle_no_results(self, fallback: bool = False, side_by_side: bool = False) -> None:\n        window = self.view.window()\n        if not window:\n            return\n        if fallback:\n            window.run_command(\"goto_reference\", {\"side_by_side\": side_by_side})\n        else:\n            window.status_message(\"No references found\")\n\n    def _show_references_in_quick_panel(\n        self, word: str, session: Session, locations: List[Location], side_by_side: bool, position: int\n    ) -> None:\n        self.view.run_command(\"add_jump_record\", {\"selection\": [(r.a, r.b) for r in self.view.sel()]})\n        kind = get_symbol_kind_from_scope(self.view.scope_name(position))\n        LocationPicker(self.view, session, locations, side_by_side, placeholder=\"References to \" + word, kind=kind)\n\n    def _show_references_in_output_panel(self, word: str, session: Session, locations: List[Location]) -> None:\n        wm = windows.lookup(session.window)\n        if not wm:\n            return\n        panel = wm.panel_manager and wm.panel_manager.ensure_references_panel()\n        if not panel:\n            return\n        base_dir = wm.get_project_path(self.view.file_name() or \"\")\n        to_render = []  # type: List[str]\n        references_count = 0\n        references_by_file = _group_locations_by_uri(wm.window, session.config, locations)\n        for file, references in references_by_file.items():\n            to_render.append('{}:'.format(_get_relative_path(base_dir, file)))\n            for reference in references:\n                references_count += 1\n                point, line = reference\n                to_render.append(\" {:>4}:{:<4} {}\".format(point.row + 1, point.col + 1, line))\n            to_render.append(\"\")  # add spacing between filenames\n        characters = \"\\n\".join(to_render)\n        panel.settings().set(\"result_base_dir\", base_dir)\n        panel.run_command(\"lsp_clear_panel\")\n        wm.window.run_command(\"show_panel\", {\"panel\": \"output.references\"})\n        panel.run_command('append', {\n            'characters': \"{} references for '{}'\\n\\n{}\".format(references_count, word, characters),\n            'force': True,\n            'scroll_to_end': False\n        })\n        # highlight all word occurrences\n        regions = panel.find_all(r\"\\b{}\\b\".format(word))\n        panel.add_regions('ReferenceHighlight', regions, 'comment', flags=sublime.DRAW_OUTLINED)\n\n\ndef _get_relative_path(base_dir: Optional[str], file_path: str) -> str:\n    if base_dir:\n        try:\n            return os.path.relpath(file_path, base_dir)\n        except ValueError:\n            # On Windows, ValueError is raised when path and start are on different drives.\n            pass\n    return file_path\n\n\ndef _group_locations_by_uri(\n    window: sublime.Window,\n    config: ClientConfig,\n    locations: List[Location]\n) -> Dict[str, List[Tuple[Point, str]]]:\n    \"\"\"Return a dictionary that groups locations by the URI it belongs.\"\"\"\n    grouped_locations = {}  # type: Dict[str, List[Tuple[Point, str]]]\n    for location in locations:\n        uri, position = get_uri_and_position_from_location(location)\n        file_path = config.map_server_uri_to_client_path(uri)\n        point = Point.from_lsp(position)\n        # get line of the reference, to showcase its use\n        reference_line = get_line(window, file_path, point.row)\n        if grouped_locations.get(file_path) is None:\n            grouped_locations[file_path] = []\n        grouped_locations[file_path].append((point, reference_line))\n    # we don't want to cache the line, we always want to get fresh data\n    linecache.clearcache()\n    return grouped_locations\n", "path": "plugin/references.py"}], "after_files": [{"content": "from .core.protocol import Location\nfrom .core.protocol import Point\nfrom .core.protocol import Request\nfrom .core.registry import get_position\nfrom .core.registry import LspTextCommand\nfrom .core.registry import windows\nfrom .core.sessions import Session\nfrom .core.settings import userprefs\nfrom .core.types import ClientConfig\nfrom .core.typing import Dict, List, Optional, Tuple\nfrom .core.views import get_line\nfrom .core.views import get_symbol_kind_from_scope\nfrom .core.views import get_uri_and_position_from_location\nfrom .core.views import text_document_position_params\nfrom .locationpicker import LocationPicker\nimport functools\nimport linecache\nimport os\nimport sublime\n\n\nclass LspSymbolReferencesCommand(LspTextCommand):\n\n    capability = 'referencesProvider'\n\n    def is_enabled(\n        self,\n        event: Optional[dict] = None,\n        point: Optional[int] = None,\n        side_by_side: bool = False,\n        force_group: bool = True,\n        fallback: bool = False,\n        group: int = -1\n    ) -> bool:\n        return fallback or super().is_enabled(event, point)\n\n    def is_visible(\n        self,\n        event: Optional[dict] = None,\n        point: Optional[int] = None,\n        side_by_side: bool = False,\n        force_group: bool = True,\n        fallback: bool = False,\n        group: int = -1\n    ) -> bool:\n        if self.applies_to_context_menu(event):\n            return self.is_enabled(event, point, side_by_side, fallback)\n        return True\n\n    def run(\n        self,\n        _: sublime.Edit,\n        event: Optional[dict] = None,\n        point: Optional[int] = None,\n        side_by_side: bool = False,\n        force_group: bool = True,\n        fallback: bool = False,\n        group: int = -1\n    ) -> None:\n        session = self.best_session(self.capability)\n        file_path = self.view.file_name()\n        pos = get_position(self.view, event, point)\n        if session and file_path and pos is not None:\n            position_params = text_document_position_params(self.view, pos)\n            params = {\n                'textDocument': position_params['textDocument'],\n                'position': position_params['position'],\n                'context': {\"includeDeclaration\": False},\n            }\n            request = Request(\"textDocument/references\", params, self.view, progress=True)\n            word_range = self.view.word(pos)\n            session.send_request(\n                request,\n                functools.partial(\n                    self._handle_response_async,\n                    self.view.substr(word_range),\n                    session,\n                    side_by_side,\n                    force_group,\n                    fallback,\n                    group,\n                    word_range.begin()\n                )\n            )\n        else:\n            self._handle_no_results(fallback, side_by_side)\n\n    def _handle_response_async(\n        self,\n        word: str,\n        session: Session,\n        side_by_side: bool,\n        force_group: bool,\n        fallback: bool,\n        group: int,\n        position: int,\n        response: Optional[List[Location]]\n    ) -> None:\n        sublime.set_timeout(lambda: self._handle_response(\n            word, session, side_by_side, force_group, fallback, group, position, response))\n\n    def _handle_response(\n        self,\n        word: str,\n        session: Session,\n        side_by_side: bool,\n        force_group: bool,\n        fallback: bool,\n        group: int,\n        position: int,\n        response: Optional[List[Location]]\n    ) -> None:\n        if response:\n            if userprefs().show_references_in_quick_panel:\n                self._show_references_in_quick_panel(\n                    word, session, response, side_by_side, force_group, group, position)\n            else:\n                self._show_references_in_output_panel(word, session, response)\n        else:\n            self._handle_no_results(fallback, side_by_side)\n\n    def _handle_no_results(self, fallback: bool = False, side_by_side: bool = False) -> None:\n        window = self.view.window()\n        if not window:\n            return\n        if fallback:\n            window.run_command(\"goto_reference\", {\"side_by_side\": side_by_side})\n        else:\n            window.status_message(\"No references found\")\n\n    def _show_references_in_quick_panel(\n        self,\n        word: str,\n        session: Session,\n        locations: List[Location],\n        side_by_side: bool,\n        force_group: bool,\n        group: int,\n        position: int\n    ) -> None:\n        self.view.run_command(\"add_jump_record\", {\"selection\": [(r.a, r.b) for r in self.view.sel()]})\n        placeholder = \"References to \" + word\n        kind = get_symbol_kind_from_scope(self.view.scope_name(position))\n        LocationPicker(self.view, session, locations, side_by_side, force_group, group, placeholder, kind)\n\n    def _show_references_in_output_panel(self, word: str, session: Session, locations: List[Location]) -> None:\n        wm = windows.lookup(session.window)\n        if not wm:\n            return\n        panel = wm.panel_manager and wm.panel_manager.ensure_references_panel()\n        if not panel:\n            return\n        base_dir = wm.get_project_path(self.view.file_name() or \"\")\n        to_render = []  # type: List[str]\n        references_count = 0\n        references_by_file = _group_locations_by_uri(wm.window, session.config, locations)\n        for file, references in references_by_file.items():\n            to_render.append('{}:'.format(_get_relative_path(base_dir, file)))\n            for reference in references:\n                references_count += 1\n                point, line = reference\n                to_render.append(\" {:>4}:{:<4} {}\".format(point.row + 1, point.col + 1, line))\n            to_render.append(\"\")  # add spacing between filenames\n        characters = \"\\n\".join(to_render)\n        panel.settings().set(\"result_base_dir\", base_dir)\n        panel.run_command(\"lsp_clear_panel\")\n        wm.window.run_command(\"show_panel\", {\"panel\": \"output.references\"})\n        panel.run_command('append', {\n            'characters': \"{} references for '{}'\\n\\n{}\".format(references_count, word, characters),\n            'force': True,\n            'scroll_to_end': False\n        })\n        # highlight all word occurrences\n        regions = panel.find_all(r\"\\b{}\\b\".format(word))\n        panel.add_regions('ReferenceHighlight', regions, 'comment', flags=sublime.DRAW_OUTLINED)\n\n\ndef _get_relative_path(base_dir: Optional[str], file_path: str) -> str:\n    if base_dir:\n        try:\n            return os.path.relpath(file_path, base_dir)\n        except ValueError:\n            # On Windows, ValueError is raised when path and start are on different drives.\n            pass\n    return file_path\n\n\ndef _group_locations_by_uri(\n    window: sublime.Window,\n    config: ClientConfig,\n    locations: List[Location]\n) -> Dict[str, List[Tuple[Point, str]]]:\n    \"\"\"Return a dictionary that groups locations by the URI it belongs.\"\"\"\n    grouped_locations = {}  # type: Dict[str, List[Tuple[Point, str]]]\n    for location in locations:\n        uri, position = get_uri_and_position_from_location(location)\n        file_path = config.map_server_uri_to_client_path(uri)\n        point = Point.from_lsp(position)\n        # get line of the reference, to showcase its use\n        reference_line = get_line(window, file_path, point.row)\n        if grouped_locations.get(file_path) is None:\n            grouped_locations[file_path] = []\n        grouped_locations[file_path].append((point, reference_line))\n    # we don't want to cache the line, we always want to get fresh data\n    linecache.clearcache()\n    return grouped_locations\n", "path": "plugin/references.py"}]}