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
Note:
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
- 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"
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
- 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.
- 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!