diff --git a/.all-contributorsrc b/.all-contributorsrc index 49348a58..c45688d4 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -116,6 +116,13 @@ "avatar_url": "https://avatars.githubusercontent.com/u/30633436?v=4", "profile": "http://nisalvd.netlify.com/", "contributions": ["doc"] + }, + { + "login": "alex-slynko", + "name": "Oleksandr Slynko", + "avatar_url": "https://avatars.githubusercontent.com/u/4385389?v=4", + "profile": "https://medium.com/@slynko", + "contributions": ["doc"] } ], "contributorsPerLine": 7, diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5ed69576..0cdce9f7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,10 +3,6 @@ on: push: branches: - release - pull_request: - branches: - - main - - release permissions: contents: write @@ -21,9 +17,10 @@ jobs: id: release with: release-type: simple - package-name: CopilotChat.nvim token: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} - name: tag stable versions if: ${{ steps.release.outputs.release_created }} run: | diff --git a/README.md b/README.md index cc8beaeb..af71fb48 100644 --- a/README.md +++ b/README.md @@ -3,13 +3,17 @@ ![Prerequisite](https://img.shields.io/badge/python-%3E%3D3.10-blue.svg) [![Documentation](https://img.shields.io/badge/documentation-yes-brightgreen.svg)](https://copilotc-nvim.github.io/CopilotChat.nvim/) [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/CopilotC-Nvim/CopilotChat.nvim/main.svg)](https://results.pre-commit.ci/latest/github/CopilotC-Nvim/CopilotChat.nvim/main) +[![Discord](https://img.shields.io/discord/1200633211236122665.svg)](https://discord.gg/vy6hJsTWaZ) -[![All Contributors](https://img.shields.io/badge/all_contributors-16-orange.svg?style=flat-square)](#contributors-) +[![All Contributors](https://img.shields.io/badge/all_contributors-17-orange.svg?style=flat-square)](#contributors-) +> [!IMPORTANT] +> We are excited to announce that we are currently migrating the plugin to fully Lua in the [canary](https://github.com/CopilotC-Nvim/CopilotChat.nvim/tree/canary) branch. + > [!NOTE] > A new command, `CopilotChatBuffer` has been added. It allows you to chat with Copilot using the entire content of the buffer. @@ -53,7 +57,7 @@ return { end, event = "VeryLazy", keys = { - { "ccb", "CopilotChatBuffer ", desc = "CopilotChat - Chat with current buffer" }, + { "ccb", ":CopilotChatBuffer ", desc = "CopilotChat - Chat with current buffer" }, { "cce", "CopilotChatExplain", desc = "CopilotChat - Explain code" }, { "cct", "CopilotChatTests", desc = "CopilotChat - Generate tests" }, { @@ -116,6 +120,7 @@ Similar to the lazy setup, you can use the following configuration: Plug 'CopilotC-Nvim/CopilotChat.nvim' call plug#end() +lua << EOF local copilot_chat = require("CopilotChat") copilot_chat.setup({ debug = true, @@ -132,6 +137,8 @@ copilot_chat.setup({ event = "VeryLazy", }) +EOF + nnoremap ccb CopilotChatBuffer nnoremap cce CopilotChatExplain nnoremap cct CopilotChatTests @@ -524,6 +531,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d Tomas Slusny
Tomas Slusny

💻 📖 Nisal
Nisal

📖 + Oleksandr Slynko
Oleksandr Slynko

📖 diff --git a/doc/CopilotChat.txt b/doc/CopilotChat.txt index a48110c5..98e44902 100644 --- a/doc/CopilotChat.txt +++ b/doc/CopilotChat.txt @@ -1,4 +1,4 @@ -*CopilotChat.txt* For NVIM v0.8.0 Last change: 2024 February 27 +*CopilotChat.txt* For NVIM v0.8.0 Last change: 2024 March 08 ============================================================================== Table of Contents *CopilotChat-table-of-contents* @@ -18,10 +18,15 @@ Table of Contents *CopilotChat-table-of-contents* + |CopilotChat-| + [!IMPORTANT] We are excited to announce that we are currently migrating the + plugin to fully Lua in the canary + branch. + [!NOTE] A new command, `CopilotChatBuffer` has been added. It allows you to chat with Copilot using the entire content of the buffer. @@ -71,7 +76,7 @@ LAZY.NVIM ~ end, event = "VeryLazy", keys = { - { "ccb", "CopilotChatBuffer ", desc = "CopilotChat - Chat with current buffer" }, + { "ccb", ":CopilotChatBuffer ", desc = "CopilotChat - Chat with current buffer" }, { "cce", "CopilotChatExplain", desc = "CopilotChat - Explain code" }, { "cct", "CopilotChatTests", desc = "CopilotChat - Generate tests" }, { @@ -135,6 +140,7 @@ Similar to the lazy setup, you can use the following configuration: Plug 'CopilotC-Nvim/CopilotChat.nvim' call plug#end() + lua << EOF local copilot_chat = require("CopilotChat") copilot_chat.setup({ debug = true, @@ -151,6 +157,8 @@ Similar to the lazy setup, you can use the following configuration: event = "VeryLazy", }) + EOF + nnoremap ccb CopilotChatBuffer nnoremap cce CopilotChatExplain nnoremap cct CopilotChatTests @@ -553,7 +561,7 @@ CONTRIBUTORS ✨ *CopilotChat-copilot-chat-for-neovim-contributors-✨* Thanks goes to these wonderful people (emoji key ): -gptlang💻 📖Dung Duc Huynh (Kaka)💻 📖Ahmed Haracic💻Trí Thiện Nguyễn💻He Zhizhou💻Guruprakash Rajakkannu💻kristofka💻PostCyberPunk📖Katsuhiko Nishimra💻Erno Hopearuoho💻Shaun Garwood💻neutrinoA4💻 📖Jack Muratore💻Adriel Velazquez💻 📖Tomas Slusny💻 📖Nisal📖This project follows the all-contributors +gptlang💻 📖Dung Duc Huynh (Kaka)💻 📖Ahmed Haracic💻Trí Thiện Nguyễn💻He Zhizhou💻Guruprakash Rajakkannu💻kristofka💻PostCyberPunk📖Katsuhiko Nishimra💻Erno Hopearuoho💻Shaun Garwood💻neutrinoA4💻 📖Jack Muratore💻Adriel Velazquez💻 📖Tomas Slusny💻 📖Nisal📖Oleksandr Slynko📖This project follows the all-contributors specification. Contributions of any kind are welcome! @@ -568,24 +576,25 @@ STARGAZERS OVER TIME ~ 1. *Prerequisite*: https://img.shields.io/badge/python-%3E%3D3.10-blue.svg 2. *Documentation*: https://img.shields.io/badge/documentation-yes-brightgreen.svg 3. *pre-commit.ci status*: https://results.pre-commit.ci/badge/github/CopilotC-Nvim/CopilotChat.nvim/main.svg -4. *All Contributors*: https://img.shields.io/badge/all_contributors-16-orange.svg?style=flat-square -5. *@treyhunner*: -6. *@nekowasabi*: -7. *@jellydn*: -8. *Chat Demo*: https://i.gyazo.com/10fbd1543380d15551791c1a6dcbcd46.gif -9. *Explain Code Demo*: https://i.gyazo.com/e5031f402536a1a9d6c82b2c38d469e3.gif -10. *Generate tests*: https://i.gyazo.com/f285467d4b8d8f8fd36aa777305312ae.gif -11. *Fix diagnostic*: https://i.gyazo.com/4aff3fdbc5c3eee59cb68939546fa2be.gif -12. *Fold Demo*: https://i.gyazo.com/766fb3b6ffeb697e650fc839882822a8.gif -13. *In-place Demo*: https://i.gyazo.com/4a5badaa109cd483c1fc23d296325cb0.gif -14. *Toggle*: https://i.gyazo.com/db5af9e5d88cd2fd09f58968914fa521.gif -15. *Chat with buffer*: https://i.gyazo.com/9b8cbf1d78a19f326282a6520bc9aab0.gif -16. *Help action with Copilot Chat*: https://i.gyazo.com/146dc35368592ba9f5de047ddc4728ad.gif -17. *Select action base on user prompts*: https://i.gyazo.com/a9c41e6398591c2f1d1d872fd58a2c63.gif -18. *Layout*: https://i.gyazo.com/550daf6cbb729027ca9bd703c21af53e.png -19. *Debug Info*: https://i.gyazo.com/bf00e700bcee1b77bcbf7b516b552521.gif -20. *@ecosse3*: -21. *Stargazers over time*: https://starchart.cc/CopilotC-Nvim/CopilotChat.nvim.svg +4. *Discord*: https://img.shields.io/discord/1200633211236122665.svg +5. *All Contributors*: https://img.shields.io/badge/all_contributors-17-orange.svg?style=flat-square +6. *@treyhunner*: +7. *@nekowasabi*: +8. *@jellydn*: +9. *Chat Demo*: https://i.gyazo.com/10fbd1543380d15551791c1a6dcbcd46.gif +10. *Explain Code Demo*: https://i.gyazo.com/e5031f402536a1a9d6c82b2c38d469e3.gif +11. *Generate tests*: https://i.gyazo.com/f285467d4b8d8f8fd36aa777305312ae.gif +12. *Fix diagnostic*: https://i.gyazo.com/4aff3fdbc5c3eee59cb68939546fa2be.gif +13. *Fold Demo*: https://i.gyazo.com/766fb3b6ffeb697e650fc839882822a8.gif +14. *In-place Demo*: https://i.gyazo.com/4a5badaa109cd483c1fc23d296325cb0.gif +15. *Toggle*: https://i.gyazo.com/db5af9e5d88cd2fd09f58968914fa521.gif +16. *Chat with buffer*: https://i.gyazo.com/9b8cbf1d78a19f326282a6520bc9aab0.gif +17. *Help action with Copilot Chat*: https://i.gyazo.com/146dc35368592ba9f5de047ddc4728ad.gif +18. *Select action base on user prompts*: https://i.gyazo.com/a9c41e6398591c2f1d1d872fd58a2c63.gif +19. *Layout*: https://i.gyazo.com/550daf6cbb729027ca9bd703c21af53e.png +20. *Debug Info*: https://i.gyazo.com/bf00e700bcee1b77bcbf7b516b552521.gif +21. *@ecosse3*: +22. *Stargazers over time*: https://starchart.cc/CopilotC-Nvim/CopilotChat.nvim.svg Generated by panvimdoc diff --git a/lua/CopilotChat/health.lua b/lua/CopilotChat/health.lua index 5893f812..227d76f9 100644 --- a/lua/CopilotChat/health.lua +++ b/lua/CopilotChat/health.lua @@ -31,6 +31,11 @@ end -- Add health check for python3 and pynvim function M.check() start('CopilotChat.nvim health check') + if vim.g.loaded_python3_provider == 0 then + warn('Python 3 provider is disabled. Please enable it to use CopilotChat.nvim') + return + end + local python_version = run_python_command('--version') if python_version == false then diff --git a/rplugin/python3/CopilotChat/copilot.py b/rplugin/python3/CopilotChat/copilot.py index 2723c5dd..3ee4ee54 100644 --- a/rplugin/python3/CopilotChat/copilot.py +++ b/rplugin/python3/CopilotChat/copilot.py @@ -140,8 +140,11 @@ def ask( f.write(f"Error: {response.status_code}\n") f.write(f"Request: {data}\n") f.write(f"Response: {response.text}\n") - - error_code = response.json().get("error", {}).get("code") + try: + error_code = response.json().get("error", {}).get("code") + except requests.exceptions.JSONDecodeError: + error_code = 0 + error_messages[error_code] = response.text if error_code and error_messages.get(response.status_code): error_messages[response.status_code] = ( f"{error_messages[response.status_code]}: {error_code}" diff --git a/version.txt b/version.txt index f8e233b2..9ab8337f 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.9.0 +1.9.1