Captain Stack is a Visual Studio Code extension searching the web for answers to any questions you might have about coding.
How does it get the completions?
By searching the web! Just like you do when you are searching for what the bugs in your code might be caused by, with the only difference that you just have to type what you are looking for and click through the results.
But how does it really get the completions?
There is of course some code magic going on in the backends of the extension, but worry not, it can easily be watered down to a few essential components.
Captain Stack is using several so called “Extractors” which extract code from web-pages. If you for example visit a site like StackOverflow, you look for code fields, or any code that might be trivial to the solution of the question. That is what these extractors are for.
Captain stack has multiple of these extractors for different websites each. It uses extractors to extract content from StackOverflow and GitHub Gist. Extractors can be easily added from anyone by contributing one to the repository effectively adding it to Captain Stack itself. Writing one of those extractors is surprisingly easy. You will get the website informations sent into your extractor and just have to find the fields that are important returning them back to Captain Stack.
How does it know it has struck gold?
The previously talked about extractors do most of the work. They filter out things like code blocks from the websites using HTML tags, CSS IDs and classes. The extractors then run an AI Code Validator over the results.
How can I get it?
Captain Stack can be downloaded and installed using the provided installation instructions on GitHub.
You can also find Captain Stack on ProductHunt