We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Don't move cursor at the end when populating the diagnostics panel
When the diagnostics are populated the cursor in the panel is moved to the end. See [here](https://github.com/tomv564/LSP/blob/2869978d8b46d717da27eb0ac7a7e234840b218d/plugin/core/panels.py#L53-L56).

Is there a reason for this? 

Because I can't use the `f4` keybinding to goto the next result when it is opened.
Instead I need first to press the `shift + f4`, which is the backward direction.


Here is a simple solution.
```diff
     def run(self, edit, characters):
         self.view.replace(edit, sublime.Region(0, self.view.size()), characters)
 
-        # Move cursor to the end
+        # Clear the selection
         selection = self.view.sel()
         selection.clear()
-        selection.add(sublime.Region(self.view.size(), self.view.size()))
```


--- 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/core/panels.py`
Content:
```
1 import sublime
2 import sublime_plugin
3 
4 
5 OUTPUT_PANEL_SETTINGS = {
6     "auto_indent": False,
7     "draw_indent_guides": False,
8     "draw_white_space": "None",
9     "gutter": False,
10     'is_widget': True,
11     "line_numbers": False,
12     "margin": 3,
13     "match_brackets": False,
14     "scroll_past_end": False,
15     "tab_size": 4,
16     "translate_tabs_to_spaces": False,
17     "word_wrap": False
18 }
19 
20 
21 def create_output_panel(window: sublime.Window, name: str) -> sublime.View:
22     panel = window.create_output_panel(name)
23     settings = panel.settings()
24     for key, value in OUTPUT_PANEL_SETTINGS.items():
25         settings.set(key, value)
26     return panel
27 
28 
29 def destroy_output_panels(window: sublime.Window):
30     for panel_name in ["references", "diagnostics"]:
31         window.destroy_output_panel(panel_name)
32 
33 
34 class LspClearPanelCommand(sublime_plugin.TextCommand):
35     """
36     A clear_panel command to clear the error panel.
37     """
38 
39     def run(self, edit):
40         self.view.set_read_only(False)
41         self.view.erase(edit, sublime.Region(0, self.view.size()))
42         self.view.set_read_only(True)
43 
44 
45 class LspUpdatePanelCommand(sublime_plugin.TextCommand):
46     """
47     A update_panel command to update the error panel with new text.
48     """
49 
50     def run(self, edit, characters):
51         self.view.replace(edit, sublime.Region(0, self.view.size()), characters)
52 
53         # Move cursor to the end
54         selection = self.view.sel()
55         selection.clear()
56         selection.add(sublime.Region(self.view.size(), self.view.size()))
57
```
--- 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/core/panels.py b/plugin/core/panels.py
--- a/plugin/core/panels.py
+++ b/plugin/core/panels.py
@@ -50,7 +50,6 @@
     def run(self, edit, characters):
         self.view.replace(edit, sublime.Region(0, self.view.size()), characters)
 
-        # Move cursor to the end
+        # Clear the selection
         selection = self.view.sel()
         selection.clear()
-        selection.add(sublime.Region(self.view.size(), self.view.size()))

{"golden_diff": "diff --git a/plugin/core/panels.py b/plugin/core/panels.py\n--- a/plugin/core/panels.py\n+++ b/plugin/core/panels.py\n@@ -50,7 +50,6 @@\n     def run(self, edit, characters):\n         self.view.replace(edit, sublime.Region(0, self.view.size()), characters)\n \n-        # Move cursor to the end\n+        # Clear the selection\n         selection = self.view.sel()\n         selection.clear()\n-        selection.add(sublime.Region(self.view.size(), self.view.size()))\n", "issue": "Don't move cursor at the end when populating the diagnostics panel\nWhen the diagnostics are populated the cursor in the panel is moved to the end. See [here](https://github.com/tomv564/LSP/blob/2869978d8b46d717da27eb0ac7a7e234840b218d/plugin/core/panels.py#L53-L56).\r\n\r\nIs there a reason for this? \r\n\r\nBecause I can't use the `f4` keybinding to goto the next result when it is opened.\r\nInstead I need first to press the `shift + f4`, which is the backward direction.\r\n\r\n\r\nHere is a simple solution.\r\n```diff\r\n     def run(self, edit, characters):\r\n         self.view.replace(edit, sublime.Region(0, self.view.size()), characters)\r\n \r\n-        # Move cursor to the end\r\n+        # Clear the selection\r\n         selection = self.view.sel()\r\n         selection.clear()\r\n-        selection.add(sublime.Region(self.view.size(), self.view.size()))\r\n```\r\n\n", "before_files": [{"content": "import sublime\nimport sublime_plugin\n\n\nOUTPUT_PANEL_SETTINGS = {\n    \"auto_indent\": False,\n    \"draw_indent_guides\": False,\n    \"draw_white_space\": \"None\",\n    \"gutter\": False,\n    'is_widget': True,\n    \"line_numbers\": False,\n    \"margin\": 3,\n    \"match_brackets\": False,\n    \"scroll_past_end\": False,\n    \"tab_size\": 4,\n    \"translate_tabs_to_spaces\": False,\n    \"word_wrap\": False\n}\n\n\ndef create_output_panel(window: sublime.Window, name: str) -> sublime.View:\n    panel = window.create_output_panel(name)\n    settings = panel.settings()\n    for key, value in OUTPUT_PANEL_SETTINGS.items():\n        settings.set(key, value)\n    return panel\n\n\ndef destroy_output_panels(window: sublime.Window):\n    for panel_name in [\"references\", \"diagnostics\"]:\n        window.destroy_output_panel(panel_name)\n\n\nclass LspClearPanelCommand(sublime_plugin.TextCommand):\n    \"\"\"\n    A clear_panel command to clear the error panel.\n    \"\"\"\n\n    def run(self, edit):\n        self.view.set_read_only(False)\n        self.view.erase(edit, sublime.Region(0, self.view.size()))\n        self.view.set_read_only(True)\n\n\nclass LspUpdatePanelCommand(sublime_plugin.TextCommand):\n    \"\"\"\n    A update_panel command to update the error panel with new text.\n    \"\"\"\n\n    def run(self, edit, characters):\n        self.view.replace(edit, sublime.Region(0, self.view.size()), characters)\n\n        # Move cursor to the end\n        selection = self.view.sel()\n        selection.clear()\n        selection.add(sublime.Region(self.view.size(), self.view.size()))\n", "path": "plugin/core/panels.py"}], "after_files": [{"content": "import sublime\nimport sublime_plugin\n\n\nOUTPUT_PANEL_SETTINGS = {\n    \"auto_indent\": False,\n    \"draw_indent_guides\": False,\n    \"draw_white_space\": \"None\",\n    \"gutter\": False,\n    'is_widget': True,\n    \"line_numbers\": False,\n    \"margin\": 3,\n    \"match_brackets\": False,\n    \"scroll_past_end\": False,\n    \"tab_size\": 4,\n    \"translate_tabs_to_spaces\": False,\n    \"word_wrap\": False\n}\n\n\ndef create_output_panel(window: sublime.Window, name: str) -> sublime.View:\n    panel = window.create_output_panel(name)\n    settings = panel.settings()\n    for key, value in OUTPUT_PANEL_SETTINGS.items():\n        settings.set(key, value)\n    return panel\n\n\ndef destroy_output_panels(window: sublime.Window):\n    for panel_name in [\"references\", \"diagnostics\"]:\n        window.destroy_output_panel(panel_name)\n\n\nclass LspClearPanelCommand(sublime_plugin.TextCommand):\n    \"\"\"\n    A clear_panel command to clear the error panel.\n    \"\"\"\n\n    def run(self, edit):\n        self.view.set_read_only(False)\n        self.view.erase(edit, sublime.Region(0, self.view.size()))\n        self.view.set_read_only(True)\n\n\nclass LspUpdatePanelCommand(sublime_plugin.TextCommand):\n    \"\"\"\n    A update_panel command to update the error panel with new text.\n    \"\"\"\n\n    def run(self, edit, characters):\n        self.view.replace(edit, sublime.Region(0, self.view.size()), characters)\n\n        # Clear the selection\n        selection = self.view.sel()\n        selection.clear()\n", "path": "plugin/core/panels.py"}]}