Skip to main content

Here's a new another option for better programming (CAPTAIN STACK)

 Captain Stack

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.

Have questions? Join our Discord server Discord Chat

Demo Video

Table of contents:

  1. Installation
  2. Play with Captain Stack
  3. Notes
  4. Changelog
  5. Troubleshooting
  6. Contributors

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:

  1. 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)
  2. (optional) Run npm install in the terminal to install dependencies. postinstall script would download the latest version of vscode.proposed.d.ts
  3. Run the Run Extension target in the Debug View. Or from the top menu, choose Run > Start Debugging.

This will:

  • Start a task npm: watch to compile the code and watch for changes
  • Open a new VSCode window (you should use the extension here)

Note: When you make changes, you should refresh that window to apply changes. To refresh, 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. Captain Stack configurations

There are a few configurations available for Captain Stack. To open the configurationview:

  1. Click on the Cog icon at bottom left
  2. Choose Settings
  3. In the Search settings search box, enter "Captain Stack"

Available settings

  • sites allows to enable or disable a source site. By the default, only Stackoverflow is enabled.

  • maxResults is the maximum number of results. It's 12 by default. Note: Since Captain Stack will fetch all the results from a page, the final number of results could be more than maxResults


4. Notes

  • There are more code sources that should be considered besides StackOverflow
  • If you see unsupported error message, ignore it

Limits:

  • The extension uses 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 of either StackOverflow or Google changing its querySelector

If those factor became problems, the extension could be using their official APIs instead.


5. Changelog

  • Aug 15, 2021 - Added sites and maxResults configurations
  • Jul 31, 2021 — Create code extracting abstracting to add more code sources
  • Jul 14, 2021 - Adapted to VS Code Insiders Release Version 1.59
  • Jul 01, 2021 - Added snippet source (thanks for mechero's suggestion)
  • Jun 30, 2021 - Publish the initial version

6. Troubleshooting

Common reasons why you can't run Captain Stack:

  • You're not using VSCode Insider. It can be downloaded here
  • When Run debugger, it shows different target options (nodejs, edge, etc.). Your VSCode root directly might be incorrect. Make sure your root directory is the same with the package.json file.
  • Error message module "node-fetch" not found.... You need to run npm install
  • canvas.node was compiled against a different Node.js. Try to remove canvas (npm uninstall canvas)

Still not running?

  • You haven't enabled the inline completion feature. To enable, set VSCode config "editor.inlineSuggest.enabled": true
  • It might conflict with some other plugins. You might need to disable plugins to check

If none of the above works, open a thread or join our Discord channel and have a chat.


7. Contributors

The plugins is available, thanks to:

Feel free to open a thread for feedback or discussion. And have fun!

for more information https://github.com/hieunc229/copilot-clone

Comments

Popular posts from this blog

5 Ways to Save Money as a Student

  5 Ways to Save Money as a Student Loading... This article is for those students who are currently studying and wants to save some money; I have gathered these methods by using which students can save up some money. Savings on Shopping If you are a student who shops online and wants to save some money, you should consider the great Indian sale and Flipkart Big Billion Days. You can get products at a huge discount which will help you to save some money. Amazon Great Indian Festival Sale. Flipkart Big Billion Day Sale. Developer Now, If you are a student who loves to code and you are a developer or want to be a developer, this will help you. Github Student Developer Pack:  You can opt for the Github Education pack and get a ton of paid software for free. Like You can get Bootstrap Studio for free, You can get three free domains from big domain providers like Namecheap, .tech, and name.com. The Github education pack has around 200k$+ amount of services, and everything is free fo...

Github has launched a new AI named GITHUB COPILOT which can steal the job of programmers

Join this program with the following link https://github.com/features/copilot/signup Github is  launching a technical preview of   GitHub Copilot , a new AI pair programmer that helps you write better code. GitHub Copilot draws context from the code you’re working on, suggesting whole lines or entire functions. It helps you quickly discover alternative ways to solve problems, write tests, and explore new APIs without having to tediously tailor a search for answers on the internet. As you type, it adapts to the way you write code—to help you complete your work faster. Developed in collaboration with OpenAI, GitHub Copilot is powered by OpenAI Codex, a new AI system created by OpenAI. OpenAI Codex has broad knowledge of how people use code and is significantly more capable than GPT-3 in code generation, in part, because it was trained on a data set that includes a much larger concentration of public source code. GitHub Copilot works with a broad set of frameworks and languages, ...

BGMI tips and tricks to enhance your game experience

  BEST BGMI SETTINGS: GRAPHICS, FOOTSTEPS, SMOOTH GAME 1 month ago   by  Alex David As you all know that Battlegrounds Mobile India has been publicly made available . Many of you might have even started playing the game on your smartphones. The good thing is that we can transfer all our old PUBG data to BGMI. So even after having the new game, we can enjoy our old outfits and actions. However, as we mentioned in our earlier article, there are some drawbacks. We don’t get some of the things back. This article will revolve around the best graphics settings for BGMI, also, we will mention the best settings for footsteps in BGMI. Even best BGMI settings for smooth gameplay if you are having less specs device. We will discuss the best BGMI settings. It might vary upon each smartphone, yet you need not worry as we have covered it all for you. So without any further ado, let’s head into the article. Table of Content  [ hide ] 1  Best BGMI Settings 1.1  Best Graphi...