From 45cdd3da77da31cb96bb4dd316a5e166ddd4b961 Mon Sep 17 00:00:00 2001 From: Huynh Duc Dung Date: Sun, 18 Feb 2024 14:58:56 +0800 Subject: [PATCH 1/6] chore: add TODO comment for future support of Custom Instructions chore: fix todo issue chore: move TODO to python chore: add syntax for TODO workflow --- .github/workflows/todo.yml | 19 +- .../CopilotChat/handlers/chat_handler.py | 1 + syntax.json | 736 ++++++++++++++++++ 3 files changed, 752 insertions(+), 4 deletions(-) create mode 100644 syntax.json diff --git a/.github/workflows/todo.yml b/.github/workflows/todo.yml index cc131582..d70ff362 100644 --- a/.github/workflows/todo.yml +++ b/.github/workflows/todo.yml @@ -1,10 +1,21 @@ -name: "Run TODO to Issue" - -on: ["push"] +name: "Convert TODO to Issue" +on: + push: + workflow_dispatch: + inputs: + MANUAL_COMMIT_REF: + description: "The SHA of the commit to get the diff for" + required: true + MANUAL_BASE_REF: + description: "By default, the commit entered above is compared to the one directly before it; to go back further, enter an earlier SHA here" + required: false jobs: build: runs-on: "ubuntu-latest" steps: - uses: "actions/checkout@v3" - name: "TODO to Issue" - uses: "alstr/todo-to-issue-action@v4" + uses: "alstr/todo-to-issue-action@master" + env: + MANUAL_COMMIT_REF: ${{ inputs.MANUAL_COMMIT_REF }} + MANUAL_BASE_REF: ${{ inputs.MANUAL_BASE_REF }} diff --git a/rplugin/python3/CopilotChat/handlers/chat_handler.py b/rplugin/python3/CopilotChat/handlers/chat_handler.py index 153497c0..63043fcd 100644 --- a/rplugin/python3/CopilotChat/handlers/chat_handler.py +++ b/rplugin/python3/CopilotChat/handlers/chat_handler.py @@ -17,6 +17,7 @@ def is_module_installed(name): return False +# TODO: Support Custom Instructions when this issue has been resolved https://github.com/microsoft/vscode-copilot-release/issues/563 # TODO: Abort request if the user closes the layout class ChatHandler: has_show_extra_info = False diff --git a/syntax.json b/syntax.json new file mode 100644 index 00000000..978c116b --- /dev/null +++ b/syntax.json @@ -0,0 +1,736 @@ +[ + { + "language": "Python", + "markers": [ + { + "type": "line", + "pattern": "#" + }, + { + "type": "block", + "pattern": { + "start": "'''", + "end": "'''" + } + }, + { + "type": "block", + "pattern": { + "start": "\"\"\"", + "end": "\"\"\"" + } + } + ] + }, + { + "language": "Elixir", + "markers": [ + { + "type": "line", + "pattern": "#" + } + ] + }, + { + "language": "YAML", + "markers": [ + { + "type": "line", + "pattern": "#" + } + ] + }, + { + "language": "Ruby", + "markers": [ + { + "type": "line", + "pattern": "#" + }, + { + "type": "block", + "pattern": { + "start": "=begin", + "end": "=end" + } + } + ] + }, + { + "language": "PHP", + "markers": [ + { + "type": "line", + "pattern": "//" + }, + { + "type": "line", + "pattern": "#" + }, + { + "type": "block", + "pattern": { + "start": "/\\*", + "end": "\\*/" + } + }, + { + "type": "block", + "pattern": { + "start": "" + } + } + ] + }, + { + "language": "C", + "markers": [ + { + "type": "line", + "pattern": "//" + }, + { + "type": "block", + "pattern": { + "start": "/\\*", + "end": "\\*/" + } + } + ] + }, + { + "language": "C++", + "markers": [ + { + "type": "line", + "pattern": "//" + }, + { + "type": "block", + "pattern": { + "start": "/\\*", + "end": "\\*/" + } + } + ] + }, + { + "language": "C#", + "markers": [ + { + "type": "line", + "pattern": "//" + }, + { + "type": "block", + "pattern": { + "start": "/\\*", + "end": "\\*/" + } + } + ] + }, + { + "language": "Java", + "markers": [ + { + "type": "line", + "pattern": "//" + }, + { + "type": "block", + "pattern": { + "start": "/\\*", + "end": "\\*/" + } + } + ] + }, + { + "language": "JavaScript", + "markers": [ + { + "type": "line", + "pattern": "//" + }, + { + "type": "block", + "pattern": { + "start": "/\\*", + "end": "\\*/" + } + } + ] + }, + { + "language": "JSON with Comments", + "markers": [ + { + "type": "line", + "pattern": "//" + }, + { + "type": "block", + "pattern": { + "start": "/\\*", + "end": "\\*/" + } + } + ] + }, + { + "language": "JSON5", + "markers": [ + { + "type": "line", + "pattern": "//" + } + ] + }, + { + "language": "Julia", + "markers": [ + { + "type": "line", + "pattern": "#" + }, + { + "type": "block", + "pattern": { + "start": "#=", + "end": "=#" + } + } + ] + }, + { + "language": "Starlark", + "markers": [ + { + "type": "line", + "pattern": "#" + } + ] + }, + { + "language": "TypeScript", + "markers": [ + { + "type": "line", + "pattern": "//" + }, + { + "type": "block", + "pattern": { + "start": "/\\*", + "end": "\\*/" + } + } + ] + }, + { + "language": "TSX", + "markers": [ + { + "type": "line", + "pattern": "//" + }, + { + "type": "block", + "pattern": { + "start": "/\\*", + "end": "\\*/" + } + } + ] + }, + { + "language": "Dart", + "markers": [ + { + "type": "line", + "pattern": "//" + }, + { + "type": "block", + "pattern": { + "start": "/\\*", + "end": "\\*/" + } + } + ] + }, + { + "language": "Kotlin", + "markers": [ + { + "type": "line", + "pattern": "//" + }, + { + "type": "block", + "pattern": { + "start": "/\\*", + "end": "\\*/" + } + } + ] + }, + { + "language": "Scala", + "markers": [ + { + "type": "line", + "pattern": "//" + }, + { + "type": "block", + "pattern": { + "start": "/\\*", + "end": "\\*/" + } + } + ] + }, + { + "language": "Objective-C", + "markers": [ + { + "type": "line", + "pattern": "//" + }, + { + "type": "block", + "pattern": { + "start": "/\\*", + "end": "\\*/" + } + } + ] + }, + { + "language": "Sass", + "markers": [ + { + "type": "line", + "pattern": "//" + }, + { + "type": "block", + "pattern": { + "start": "/\\*", + "end": "\\*/" + } + } + ] + }, + { + "language": "Less", + "markers": [ + { + "type": "line", + "pattern": "//" + }, + { + "type": "block", + "pattern": { + "start": "/\\*", + "end": "\\*/" + } + } + ] + }, + { + "language": "Swift", + "markers": [ + { + "type": "line", + "pattern": "//" + }, + { + "type": "block", + "pattern": { + "start": "/\\*", + "end": "\\*/" + } + } + ] + }, + { + "language": "Haskell", + "markers": [ + { + "type": "line", + "pattern": "--" + }, + { + "type": "block", + "pattern": { + "start": "{-", + "end": "-}" + } + } + ] + }, + { + "language": "HTML", + "markers": [ + { + "type": "block", + "pattern": { + "start": "" + } + } + ] + }, + { + "language": "CSS", + "markers": [ + { + "type": "block", + "pattern": { + "start": "/\\*", + "end": "\\*/" + } + } + ] + }, + { + "language": "AutoHotkey", + "markers": [ + { + "type": "line", + "pattern": ";" + } + ] + }, + { + "language": "Markdown", + "markers": [ + { + "type": "block", + "pattern": { + "start": "" + } + }, + { + "type": "block", + "pattern": { + "start": "{/\\*", + "end": "\\*/}" + } + }, + { + "type": "line", + "pattern": "- \\[ \\]" + } + ] + }, + { + "language": "RMarkdown", + "markers": [ + { + "type": "block", + "pattern": { + "start": "" + } + } + ] + }, + { + "language": "Shell", + "markers": [ + { + "type": "line", + "pattern": "#" + } + ] + }, + { + "language": "Handlebars", + "markers": [ + { + "type": "block", + "pattern": { + "start": "" + } + }, + { + "type": "block", + "pattern": { + "start": "{{!", + "end": "}}" + } + } + ] + }, + { + "language": "Org", + "markers": [ + { + "type": "line", + "pattern": "#" + }, + { + "type": "block", + "pattern": { + "start": "#\\+begin_comment", + "end": "#\\+end_comment" + } + } + ] + }, + { + "language": "TeX", + "markers": [ + { + "type": "line", + "pattern": "%" + }, + { + "type": "line", + "pattern": "\\\\todo{" + }, + { + "type": "block", + "pattern": { + "start": "\\\\begin{comment}", + "end": "\\\\end{comment}" + } + } + ] + }, + { + "language": "SQL", + "markers": [ + { + "type": "line", + "pattern": "--" + }, + { + "type": "block", + "pattern": { + "start": "/\\*", + "end": "\\*/" + } + } + ] + }, + { + "language": "HTML+Razor", + "markers": [ + { + "type": "block", + "pattern": { + "start": "" + } + }, + { + "type": "line", + "pattern": "//" + }, + { + "type": "block", + "pattern": { + "start": "/\\*", + "end": "\\*/" + } + } + ] + }, + { + "language": "Rust", + "markers": [ + { + "type": "line", + "pattern": "//" + }, + { + "type": "block", + "pattern": { + "start": "/\\*", + "end": "\\*/" + } + } + ] + }, + { + "language": "Vue", + "markers": [ + { + "type": "block", + "pattern": { + "start": "" + } + }, + { + "type": "line", + "pattern": "//" + } + ] + }, + { + "language": "ABAP", + "markers": [ + { + "type": "line", + "pattern": "\"" + }, + { + "type": "line", + "pattern": "\\*" + } + ] + }, + { + "language": "ABAP CDS", + "markers": [ + { + "type": "line", + "pattern": "//" + }, + { + "type": "block", + "pattern": { + "start": "/\\*", + "end": "\\*/" + } + } + ] + }, + { + "language": "GDScript", + "markers": [ + { + "type": "line", + "pattern": "#" + } + ] + }, + { + "language": "Go", + "markers": [ + { + "type": "line", + "pattern": "//" + }, + { + "type": "block", + "pattern": { + "start": "/\\*", + "end": "\\*/" + } + } + ] + }, + { + "language": "HCL", + "markers": [ + { + "type": "line", + "pattern": "#" + }, + { + "type": "line", + "pattern": "//" + }, + { + "type": "block", + "pattern": { + "start": "/\\*", + "end": "\\*/" + } + } + ] + }, + { + "language": "SCSS", + "markers": [ + { + "type": "line", + "pattern": "//" + }, + { + "type": "block", + "pattern": { + "start": "/\\*", + "end": "\\*/" + } + } + ] + }, + { + "language": "Twig", + "markers": [ + { + "type": "block", + "pattern": { + "start": "{#", + "end": "#}" + } + } + ] + }, + { + "language": "Crystal", + "markers": [ + { + "type": "line", + "pattern": "#" + } + ] + }, + { + "language": "R", + "markers": [ + { + "type": "line", + "pattern": "#" + } + ] + }, + { + "language": "Clojure", + "markers": [ + { + "type": "line", + "pattern": ";;" + } + ] + }, + { + "language": "Nix", + "markers": [ + { + "type": "line", + "pattern": "#" + }, + { + "type": "block", + "pattern": { + "start": "/\\*", + "end": "\\*/" + } + } + ] + }, + { + "language": "XML", + "markers": [ + { + "type": "block", + "pattern": { + "start": "" + } + } + ] + } +] From c48fcca5ea9c4191b2a62f7c4e032249ede7966d Mon Sep 17 00:00:00 2001 From: Huynh Duc Dung Date: Sun, 18 Feb 2024 19:15:30 +0800 Subject: [PATCH 2/6] chore: move abort request TODO and add keymaps TODO for InPlace command --- rplugin/python3/CopilotChat/handlers/chat_handler.py | 2 +- rplugin/python3/CopilotChat/handlers/inplace_chat_handler.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/rplugin/python3/CopilotChat/handlers/chat_handler.py b/rplugin/python3/CopilotChat/handlers/chat_handler.py index 63043fcd..8e2745e2 100644 --- a/rplugin/python3/CopilotChat/handlers/chat_handler.py +++ b/rplugin/python3/CopilotChat/handlers/chat_handler.py @@ -18,7 +18,6 @@ def is_module_installed(name): # TODO: Support Custom Instructions when this issue has been resolved https://github.com/microsoft/vscode-copilot-release/issues/563 -# TODO: Abort request if the user closes the layout class ChatHandler: has_show_extra_info = False @@ -267,6 +266,7 @@ def _add_chat_messages( self.nvim.exec_lua( 'require("CopilotChat.utils").log_info(...)', "Asking Copilot" ) + # TODO: Abort request if the user closes the layout for token in self.copilot.ask( system_prompt, prompt, code, language=cast(str, file_type), model=model ): diff --git a/rplugin/python3/CopilotChat/handlers/inplace_chat_handler.py b/rplugin/python3/CopilotChat/handlers/inplace_chat_handler.py index 1f206527..0342d864 100644 --- a/rplugin/python3/CopilotChat/handlers/inplace_chat_handler.py +++ b/rplugin/python3/CopilotChat/handlers/inplace_chat_handler.py @@ -232,6 +232,7 @@ def _toggle_system_model(self): self.copilot_popup.unmount() self.copilot_popup.mount(controlled=True) + # TODO: Add custom keymaps for in-place chat as suggestion here https://discord.com/channels/1200633211236122665/1200633212041449606/1208065809285382164 def _set_keymaps(self): """Set the keymaps for the chat handler.""" self.prompt_popup.map("n", "", lambda: self._chat()) From 1e250ff1d751fc187e220ac596eb745f09e805aa Mon Sep 17 00:00:00 2001 From: Huynh Duc Dung Date: Tue, 20 Feb 2024 18:27:52 +0800 Subject: [PATCH 3/6] fix: set filetype to markdown for toggle vsplit buffer --- rplugin/python3/CopilotChat/handlers/vsplit_chat_handler.py | 1 + 1 file changed, 1 insertion(+) diff --git a/rplugin/python3/CopilotChat/handlers/vsplit_chat_handler.py b/rplugin/python3/CopilotChat/handlers/vsplit_chat_handler.py index 16dce5cd..1608c53a 100644 --- a/rplugin/python3/CopilotChat/handlers/vsplit_chat_handler.py +++ b/rplugin/python3/CopilotChat/handlers/vsplit_chat_handler.py @@ -52,6 +52,7 @@ def toggle_vsplit(self): pass self.vsplit() + self.buffer.option("filetype", "markdown") def chat(self, prompt: str, filetype: str, code: str = ""): self.buffer.option("filetype", "markdown") From 1e796b8a9a43a33a09e034970a2b43a35c782574 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 20 Feb 2024 10:28:13 +0000 Subject: [PATCH 4/6] chore(doc): auto generate docs --- doc/CopilotChat.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/CopilotChat.txt b/doc/CopilotChat.txt index 0b157fa0..2ad03ce2 100644 --- a/doc/CopilotChat.txt +++ b/doc/CopilotChat.txt @@ -1,4 +1,4 @@ -*CopilotChat.txt* For NVIM v0.8.0 Last change: 2024 February 18 +*CopilotChat.txt* For NVIM v0.8.0 Last change: 2024 February 20 ============================================================================== Table of Contents *CopilotChat-table-of-contents* From b5c915ecc54e3bfb64d04d3f545f7cfd2435783c Mon Sep 17 00:00:00 2001 From: Huynh Duc Dung Date: Tue, 20 Feb 2024 18:30:23 +0800 Subject: [PATCH 5/6] chore: add TODO for temperature setting --- rplugin/python3/CopilotChat/utilities.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rplugin/python3/CopilotChat/utilities.py b/rplugin/python3/CopilotChat/utilities.py index fbc418e3..f9a5c618 100644 --- a/rplugin/python3/CopilotChat/utilities.py +++ b/rplugin/python3/CopilotChat/utilities.py @@ -43,7 +43,7 @@ def generate_request( "model": model, "n": 1, "stream": True, - "temperature": 0.1, + "temperature": 0.1, # TODO: add temperature setting, refer the suggestion from user https://discord.com/channels/1200633211236122665/1209114805147926538/1209189717791477870 "top_p": 1, "messages": messages, } From ca6f4dd6512752011c00a8c35f08da1af17ad5af Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 20 Feb 2024 19:26:04 +0800 Subject: [PATCH 6/6] chore(main): release 1.6.2 (#59) --- CHANGELOG.md | 7 +++++++ version.txt | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b9543d5..e9845ffa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.6.2](https://github.com/CopilotC-Nvim/CopilotChat.nvim/compare/v1.6.1...v1.6.2) (2024-02-20) + + +### Bug Fixes + +* set filetype to markdown for toggle vsplit buffer ([1e250ff](https://github.com/CopilotC-Nvim/CopilotChat.nvim/commit/1e250ff1d751fc187e220ac596eb745f09e805aa)) + ## [1.6.1](https://github.com/CopilotC-Nvim/CopilotChat.nvim/compare/v1.6.0...v1.6.1) (2024-02-18) diff --git a/version.txt b/version.txt index 9c6d6293..fdd3be6d 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.6.1 +1.6.2