Directly copy selected code or files from vscode to a chatgpt tab in browser

Latest Version

Version
0.0.1
Update
March 14, 2024
Size
14.67KiB
Developer
Category
Users
14
Rating
1 ★
Manifest Version
3
Web Store Status
Languages Support
English
See more
Permissions
Scripting
See more

VSCode Chatgpt Easy Copy Extension

VSCode Chatgpt Easy Copy is a simple utility to make it slightly convenient to copy code/text and files from vscode into chatgpt's textarea using commands. There are two components in the utility - this chrome extension and a vscode extension. Both must be installed and running for it to work. The vscode counterpart can be installed from the extension marketplace or manually following the instructions at https://github.com/nikhils98/vscode-chatgpt-easy-copy/tree/main

- How it works?
The vscode extension initializes a websocket server at port 8765 on startup which the chrome extension connects to. On execution of a command, the selected text or contents of file(s) are sent to the chrome extension, via websocket, which manipulates chatgpt's DOM to input in the prompt textarea and send.

More information about the vscode extension can be found at https://github.com/nikhils98/vscode-chatgpt-easy-copy/tree/main/vscode

-- Service Worker
This is where the crux of the logic resides for the chrome extension. It's a background script managing the websocket connection to the vscode extension and responsible for injecting a function to manipulate chatgpt's DOM when a command is received.

It uses chrome's scripting api (https://developer.chrome.com/docs/extensions/reference/api/scripting#description) to inject the function in runtime and requires host permissions for chatgpt to do so. A service worker can become inactive after 30s of idle time so to prevent that a keepalive message is sent to the websocket server every 20s.

In most circumstances, the service worker should be active as long as chatgpt or vscode is running but if it gets inactive at some point, you can try one of the following:

1. Refresh chatgpt tab.
2. Reload the extension from Extensions page. After reload, chatgpt tab must be refreshed as well.

-- Content Script: Ping Server Worker
This runs only when chatgpt is open. It sends a ping message to the service worker every 20s to keep it active when vscode isn't open. Essentially if you open vscode after the service worker had become inactive, opening a tab of chatgpt will make it active again.

- Note:
1. At least one tab of chatgpt must be open. If multiple tabs are open, command is sent to only one.
2. You may see an error related to Websocket connection failure in extension console especially if installed manually. This will be the case when vscode is not running. It can be ignored as the service worker retries connection every second so when you run vscode it should connect.
Read more

Source Manifest.json

{"update_url": "https://clients2.google.com/service/update2/crx", "manifest_version": 3, "name": "VSCode Chatgpt Easy Copy", "description": "Directly copy selected code or files from vscode to a chatgpt tab in browser", "version": "0.0.1", "icons": { "16": "icons/arrow-16.png", "32": "icons/arrow-32.png", "64": "icons/arrow-64.png", "128": "icons/arrow-128.png" }, "content_scripts": [ { "js": ["scripts/ping-service-worker.js"], "matches": ["https://chat.openai.com/*"] } ], "host_permissions": ["https://chat.openai.com/*"], "background": { "service_worker": "workers/index.js" }, "minimum_chrome_version": "116", "permissions": ["scripting"]}
Read more

How to download and manually install VSCode Chatgpt Easy Copy extension for Chrome

Looking for a way to install VSCode Chatgpt Easy Copy extensions for Chrome, you can search for them in the Chrome Web Store, clicking the "Add to Chrome" button, and following the straightforward process.

However, you may need to install VSCode Chatgpt Easy Copy extensions manually, this article outlines two simple methods to effortlessly install VSCode Chatgpt Easy Copy extensions, whether they come as unpacked folders in compressed formats like .zip or as .crx files.

Method 1: Download VSCode Chatgpt Easy Copy extension and manually install through Drag &Drop

If you ever need to manually install a VSCode Chatgpt Easy Copy extension for Chrome, don't worry, it's a simple process. Just follow these easy steps, and you will have your extension ready to use in no time.

Step 1: Download the VSCode Chatgpt Easy Copy Extension by clicking the "Download CRX" button on the website.

Look for the VSCode Chatgpt Easy Copy extension you wish to install. Go to the website and download the VSCode Chatgpt Easy Copy extension package, which is usually a .CRX file and comes in a zipped file. Here ".crx" file is the format for VSCode Chatgpt Easy Copy extension that contains all the data.

Step 2: Extract &Arrange Files

Once the file is downloaded, extract that file into its own folder. Similarly, give that extension files a permanent home. In other words, keep it in a folder that you don't accidentally delete it because these files will be needed to make that extension work.

Step 3: Go to the Chrome Extensions Page

Open Google Chrome and in the address bar, type chrome://extensions; it will open the Google Chrome extensions page. Make sure that "My extensions" is selected in the sidebar.

Step 4: Drag and Drop the Extension

Now, go to the folder where you extracted the VSCode Chatgpt Easy Copy extension and drag &drop the extension file from there anywhere onto the extension page within Google Chrome.

Step 5: Complete the Installation

Once you drag and drop the extension file, follow the steps that Google Chrome takes you through. Similarly, if the extension file is of .crx file format, you will be required to review the permissions and then add the extension.

Now, you can manage that added extension as you would like to with any other Chrome extension that you added through Chrome Webstore. Its icon will also appear in the Google Chrome Menu on the right side of the address bar once you activate it.

Method 2: Download VSCode Chatgpt Easy Copy extension for Chrome and install in Developer Mode

This is another method to install VSCode Chatgpt Easy Copy extension manually, but the twist is that here, you install by enabling the developer mode option provided in Google Chrome. This mode is commonly used for testing extensions or running unpublished tools.

Step 1: Download the VSCode Chatgpt Easy Copy extension file

Select and download the VSCode Chatgpt Easy Copy extension by clicking the 'Download CRX' button on the website.

Step 2: Extract the downloaded contents

Convert the file to a ZIP file if it is in CRX format then extract the VSCode Chatgpt Easy Copy extension zip file or folder that you downloaded. Make sure you extract it using the same folder name and keep it safely in another folder, so you don't delete it by mistake. The extracted folder will be needed to keep your VSCode Chatgpt Easy Copy extension running.

Step 3: Open Chrome Extension Setting Page

In the address bar of Google Chrome, type chrome://extensions and open the Chrome Extension Page.

Step 4: Enable Developer Mode

After opening the Chrome Extension page, look at the top right side, and you will find the toggle option of "Developer mode."Simply enable that developer mode option.

Step 5: Load the Unpacked Extension

Once you enable the developer mode option, you will see the menu of Load Unpacked, Pack Extensions and Update. From that, select the option "Load unpacked."

Step 6: Select the Extension Folder

Once the pop-up opens upon clicking Load unpacked, select the VSCode Chatgpt Easy Copy extension directory and click on the "Select Folder "button.

Step 7: Confirm and Install

After you select an extension folder of a Google Chrome extension you're installing manually, confirm its installation for the final time and let the installation complete.

Conclusion

Here we've made a step-by-step guide on How to manually install VSCode Chatgpt Easy Copy extension in 2 ways. We hope this guide proves helpful.

Similar Extensions

icon

WindChat-ChatGPT Tailwind CSS React Previewer Extension · Developer Tools 14 4 ★ 483KiB

icon

Saved Prompts Extension · Developer Tools 14 33 ★ 16.47KiB

icon

ChatGPT Extension Extension · Productivity 14 3 ★ 1.73MiB

icon

Bookmark Folders for ChatGPT Extension · Productivity 14 16 ★ 140KiB

icon

ChatGPT Chat SAVE Extension · Productivity 14 9 ★ 12.5KiB

icon

ExportGPT: Export ChatGPT Conversation Extension · Productivity 14 26 ★ 395KiB

icon

ChatGPT to Markdown Extension · Developer Tools 14 22 ★ 117KiB

icon

ChatGPT Cookies Extension · Developer Tools 14 1 ★ 67.79MiB

icon

Searchable ChatGPT: search GPT conversation history Extension · Productivity 14 72 ★ 423KiB

icon

ChatGPT to MarkDown plus Extension · Productivity 14 21 ★ 37.46KiB

icon

ChatGPT Download For PC, Mac, Windows - Free Extension · Productivity 14 11 ★ 124KiB

icon

Chat GPT Extension · Productivity 14 2247 ★ 500KiB

icon

ChatGPT Print and Save Extension · Productivity 14 4 ★ 4.99MiB

icon

Save ChatGPT to Notion Extension · Productivity 14 16 ★ 415KiB

icon

ChatGPT to Notion Extension · Productivity 14 96 ★ 1.65MiB

icon

ChatGPT Folders Extension · Productivity 14 56 ★ 185KiB

icon

ChatGPT Web Preview Extension · Developer Tools 14 7 ★ 456KiB

icon

GPT Booster - ChatGPT File Uploader & Chats Saver Extension · Productivity 14 22 ★ 3.63MiB

icon

Export ChatGPT - image&Screenshot Extension · Productivity 14 8 ★ 3.41MiB

icon

Umbrella - Copy All URLs V3 Extension · Productivity 14 0 ★ 364KiB

icon

BookmarkGPT - Bookmark Your ChatGPT Prompts Extension · Productivity 14 13 ★ 1.68MiB

icon

Whisper to ChatGPT Extension · Accessibility 14 41 ★ 585KiB

icon

ChatGPT File Extension Extension · Productivity 14 4 ★ 3.91KiB

icon

Save ChatGPT to Obsidian markdown file Extension · Productivity 14 9 ★ 364KiB