diff --git a/.all-contributorsrc b/.all-contributorsrc index 49348a58..d7b5e3a7 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1,5 +1,7 @@ { - "files": ["README.md"], + "files": [ + "README.md" + ], "imageSize": 100, "commit": false, "commitType": "docs", @@ -10,112 +12,158 @@ "name": "gptlang", "avatar_url": "https://avatars.githubusercontent.com/u/121417512?v=4", "profile": "https://github.com/gptlang", - "contributions": ["code", "doc"] + "contributions": [ + "code", + "doc" + ] }, { "login": "jellydn", "name": "Dung Duc Huynh (Kaka)", "avatar_url": "https://avatars.githubusercontent.com/u/870029?v=4", "profile": "https://productsway.com/", - "contributions": ["code", "doc"] + "contributions": [ + "code", + "doc" + ] }, { "login": "qoobes", "name": "Ahmed Haracic", "avatar_url": "https://avatars.githubusercontent.com/u/58834655?v=4", "profile": "https://qoobes.dev", - "contributions": ["code"] + "contributions": [ + "code" + ] }, { "login": "ziontee113", "name": "Trí Thiện Nguyễn", "avatar_url": "https://avatars.githubusercontent.com/u/102876811?v=4", "profile": "https://youtube.com/@ziontee113", - "contributions": ["code"] + "contributions": [ + "code" + ] }, { "login": "Cassius0924", "name": "He Zhizhou", "avatar_url": "https://avatars.githubusercontent.com/u/62874592?v=4", "profile": "https://github.com/Cassius0924", - "contributions": ["code"] + "contributions": [ + "code" + ] }, { "login": "rguruprakash", "name": "Guruprakash Rajakkannu", "avatar_url": "https://avatars.githubusercontent.com/u/9963717?v=4", "profile": "https://www.linkedin.com/in/guruprakashrajakkannu/", - "contributions": ["code"] + "contributions": [ + "code" + ] }, { "login": "kristofka", "name": "kristofka", "avatar_url": "https://avatars.githubusercontent.com/u/140354?v=4", "profile": "https://github.com/kristofka", - "contributions": ["code"] + "contributions": [ + "code" + ] }, { "login": "PostCyberPunk", "name": "PostCyberPunk", "avatar_url": "https://avatars.githubusercontent.com/u/134976996?v=4", "profile": "https://github.com/PostCyberPunk", - "contributions": ["doc"] + "contributions": [ + "doc" + ] }, { "login": "ktns", "name": "Katsuhiko Nishimra", "avatar_url": "https://avatars.githubusercontent.com/u/1302759?v=4", "profile": "https://github.com/ktns", - "contributions": ["code"] + "contributions": [ + "code" + ] }, { "login": "errnoh", "name": "Erno Hopearuoho", "avatar_url": "https://avatars.githubusercontent.com/u/373946?v=4", "profile": "https://github.com/errnoh", - "contributions": ["code"] + "contributions": [ + "code" + ] }, { "login": "shaungarwood", "name": "Shaun Garwood", "avatar_url": "https://avatars.githubusercontent.com/u/4156525?v=4", "profile": "https://github.com/shaungarwood", - "contributions": ["code"] + "contributions": [ + "code" + ] }, { "login": "neutrinoA4", "name": "neutrinoA4", "avatar_url": "https://avatars.githubusercontent.com/u/122616073?v=4", "profile": "https://github.com/neutrinoA4", - "contributions": ["code", "doc"] + "contributions": [ + "code", + "doc" + ] }, { "login": "banjocat", "name": "Jack Muratore", "avatar_url": "https://avatars.githubusercontent.com/u/3247309?v=4", "profile": "https://github.com/banjocat", - "contributions": ["code"] + "contributions": [ + "code" + ] }, { "login": "AdrielVelazquez", "name": "Adriel Velazquez", "avatar_url": "https://avatars.githubusercontent.com/u/3443378?v=4", "profile": "https://github.com/AdrielVelazquez", - "contributions": ["code", "doc"] + "contributions": [ + "code", + "doc" + ] }, { "login": "deathbeam", "name": "Tomas Slusny", "avatar_url": "https://avatars.githubusercontent.com/u/5115805?v=4", "profile": "https://github.com/deathbeam", - "contributions": ["code", "doc"] + "contributions": [ + "code", + "doc" + ] }, { "login": "nisalVD", "name": "Nisal", "avatar_url": "https://avatars.githubusercontent.com/u/30633436?v=4", "profile": "http://nisalvd.netlify.com/", - "contributions": ["doc"] + "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..42a9cba1 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,12 @@ [![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) - -[![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 +54,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 +117,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 +134,8 @@ copilot_chat.setup({ event = "VeryLazy", }) +EOF + nnoremap ccb CopilotChatBuffer nnoremap cce CopilotChatExplain nnoremap cct CopilotChatTests @@ -524,6 +528,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..27d61a9d 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 06 ============================================================================== Table of Contents *CopilotChat-table-of-contents* @@ -22,6 +22,10 @@ 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 +75,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 +139,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 +156,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 +560,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,7 +575,7 @@ 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 +4. *All Contributors*: https://img.shields.io/badge/all_contributors-17-orange.svg?style=flat-square 5. *@treyhunner*: 6. *@nekowasabi*: 7. *@jellydn*: 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