diff --git a/README.md b/README.md index d8dc291..ccbce72 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ This Visual Studio Code extension allows you to use the [unofficial ChatGPT API]
-**💥Make sure to follow the installation instructions carefully! Due to changes introduced by OpenAI, this extension may not work for some and only produce 403 errors - version using official GPT-3 API coming soon💥** +**💥Make sure to follow the installation instructions carefully! Due to changes introduced by OpenAI, this extension may not work for some and only produce 403/429 errors - try [version using GPT3](https://github.com/timkmecl/codegpt) via official OpenAI API in this case ([marketplace](https://marketplace.visualstudio.com/items?itemName=timkmecl.codegpt3)) 💥**
@@ -25,6 +25,10 @@ This Visual Studio Code extension allows you to use the [unofficial ChatGPT API] ## Features - 💡 **Ask general questions** or use code snippets from the editor to query ChatGPT via an input box in the sidebar - 🖱️ Right click on a code selection and run one of the context menu **shortcuts** + - automatically write documentation for your code + - explain the selected code + - refactor or optimize it + - find problems with it - 💻 View ChatGPT's responses in a panel next to the editor - 🚀 See the response as it is being generated **in real time** - 💬 Ask **follow-up questions** to the response (conversation context is maintained) diff --git a/package.json b/package.json index 320ffd9..6d2d78a 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,8 @@ "onCommand:chatgpt.explain", "onCommand:chatgpt.refactor", "onCommand:chatgpt.optimize", - "onCommand:chatgpt.problems" + "onCommand:chatgpt.findProblems", + "onCommand:chatgpt.documentation" ], "main": "./dist/extension.js", "contributes": { @@ -57,6 +58,10 @@ "command": "chatgpt.optimize", "title": "ChatGPT: Optimize selection" }, + { + "command": "chatgpt.documentation", + "title": "ChatGPT: Write documentation" + }, { "command": "chatgpt.conversationId", "title": "Set ChatGPT conversation ID" @@ -92,6 +97,11 @@ "command": "chatgpt.optimize", "when": "editorHasSelection", "group": "chatgpt-menu-group@5" + }, + { + "command": "chatgpt.documentation", + "when": "editorHasSelection", + "group": "chatgpt-menu-group@6" } ], "commandPalette": [ @@ -114,6 +124,10 @@ "command": "chatgpt.optimize", "when": "editorHasSelection" }, + { + "command": "chatgpt.documentation", + "when": "editorHasSelection" + }, { "command": "chatgpt.conversationId" }, @@ -179,13 +193,19 @@ }, "chatgpt.promptPrefix.findProblems": { "type": "string", - "default": "Find problems with the following code, fix them and explain what was wrong (Do not change anything else): ", + "default": "Find problems with the following code, fix them and explain what was wrong (Do not change anything else, if there are no problems say so): ", "description": "The prompt prefix used for finding problems in the selected code", "order": 5 }, + "chatgpt.promptPrefix.documentation": { + "type": "string", + "default": "Write documentation for the following code: ", + "description": "The prompt prefix used for writing documentation for the selected code", + "order": 7 + }, "chatgpt.promptPrefix.optimize": { "type": "string", - "default": "Optimize the following code: ", + "default": "Optimize the following code if there is anything to improve, if not say so: ", "description": "The prompt prefix used for optimizing the selected code", "order": 6 }, @@ -193,18 +213,19 @@ "type": "boolean", "default": true, "description": "Keep the conversation going by using the same conversation ID for all requests (allows follow-up questions)", - "order": 7 - },"chatgpt.timeoutLength": { + "order": 8 + }, + "chatgpt.timeoutLength": { "type": "number", "default": "120", "description": "How long should the request wait for a response before timing out (in seconds)", - "order": 8 + "order": 9 }, "chatgpt.selectedInsideCodeblock": { "type": "boolean", "default": true, "description": "Append selected code as a codeblock (```...code...```) instead of plain text", - "order": 9 + "order": 10 } } } diff --git a/src/extension.ts b/src/extension.ts index d13349e..b253ee5 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -70,6 +70,7 @@ export function activate(context: vscode.ExtensionContext) { vscode.commands.registerCommand('chatgpt.refactor', () => commandHandler('promptPrefix.refactor')), vscode.commands.registerCommand('chatgpt.optimize', () => commandHandler('promptPrefix.optimize')), vscode.commands.registerCommand('chatgpt.findProblems', () => commandHandler('promptPrefix.findProblems')), + vscode.commands.registerCommand('chatgpt.documentation', () => commandHandler('promptPrefix.documentation')), vscode.commands.registerCommand('chatgpt.resetConversation', provider.resetConversation), vscode.commands.registerCommand('chatgpt.conversationId', setConversationId) ); @@ -334,8 +335,16 @@ class ChatGPTViewProvider implements vscode.WebviewViewProvider { white-space: pre; } p { - padding-top: 0.25rem; - padding-bottom: 0.25rem; + padding-top: 0.3rem; + padding-bottom: 0.3rem; + } + /* overrides vscodes style reset, displays as if inside web browser */ + ul, ol { + list-style: initial !important; + margin-left: 10px !important; + } + h1, h2, h3, h4, h5, h6 { + font-weight: bold !important; }