![](/style/images/good.png)
![](/style/images/bad.png)
GitHub - hieunc229/copilot-clone: VSCode extension for code suggestion
source link: https://github.com/hieunc229/copilot-clone
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Captain Stack — Code suggestion for VSCode
This feature is somewhat similar to Github Copilot's code suggestion. But instead of using AI, it sends your search query to Google, then retrieves StackOverflow answers and autocompletes them for you.
Captain Stack is launched on Product Hunt and would appricate your support
Table of contents:
Note: This extension uses a proposed API (inline-completion) and can only be used for extension development in VSCode Insider release. It's not yet available on VSCode
1. Installation
Check out the installation video: https://youtu.be/MD-kzsF0Scg
Before installation, make sure you have VSCode Insider. You'll be using this version. To install and starting Captain Stack:
- Download this repository to your local machine. Unzip and open it on VSCode Insider (make sure the root directory is the same as
package.json
file) - (optional) Run
npm install
in the terminal to install dependencies. Apostinstall
script would download the latest version ofvscode.proposed.d.ts
- Run the
Run Extension
target in the Debug View. Or from the top menu, chooseRun > Start Debugging
.
This will:
- Start a task
npm: watch
to compile the code and watch for changes - Open a new VSCode windows (you should play the extension here)
Note: when you make changes, you should refresh that windows to apply changes. To refersh, open Command Palette (Command+Shift+P on MacOS, or Ctrl+Shift+P on Windows), then choose "Developer: Reload window"
2. Play with Captain Stack
To trigger inline completion, you'll need to type //find {your keyword}.
(start with //find
, end with a dot .
)
For example
//find binary search in javascript.
Make sure that showInlineCompletions
is enabled in your settings!
"editor.inlineSuggest.enabled": true
3. Notes
- The extension use fetch-node to get page content, and I don't know if there is any fetching limit
- The extension uses querySelector to extract code and other info. There is a risk when either StackOverflow or Google changing its querySelector
- There are more code sources that should be considered besides StackOverflow
If those factor became problems, the extension could be using their official APIs instead.
4. Changelog
- Jul 01, 2021 - Added snippet source (thanks for mechero's suggestion)
- Jun 30, 2021 — Publish the initial version
Feel free to open a thread for feedback or discussion. And have fun!
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK