GithubHelp home page GithubHelp logo

mrtpk / jsdoc-openai-powered-generator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tom-a-roberts/jsdoc-openai-powered-generator

0.0 0.0 0.0 2.11 MB

License: MIT License

JavaScript 0.90% TypeScript 99.10%

jsdoc-openai-powered-generator's Introduction

AI Auto Comment · An OpenAI-Powered Documentation Extension

Easily generate JSDoc or regular code comments with this OpenAI-driven extension.

Currently supports TypeScript and Javascript.

Quick Setup

  1. Provide your OpenAI key in the settings.
  2. double-check you're cool with the model being "gpt-4-1106-preview" (it's the default). See OpenAI's Site for other values.

If you don't already have an OpenAI key, you'll have to get one from OpenAI. I'm not paying for your key, sorry.

Usage

Select some code and right-click, choose the option "AI Auto Comment" to generate a comment above your selection.

How it works:
  • The model will be prompted with your selection, and will generate a comment based on that. See settings for how to adjust this prompt, and other settings.
  • It will choose between a JSDoc and a regular comment. If you select a function it'll go with a JSDoc. If you select just some normal code, it'll generate a regular comment.
  • It will auto-indent the comment/JSDoc so that it makes formatters like Prettier happy.

Settings

You can access these by going to your VSCode settings, going to Extensions, and finding "AI Auto Comment". If you're a JSON fan, here's the setting keys:

  • ai-auto-comment.apiKey - Your OpenAI API key.
  • ai-auto-comment.prompt - The prompt given to the model. You must use empty curly braces {} to signify the where your code should be inserted inside the prompt.
  • ai-auto-comment.model - The model to use for your generation. See OpenAI's Site for more options.
  • ai-auto-comment.maxTokens - The maximum number of tokens to generate. Increase this if you want to generate more text. Decrease this if you want to save more money.
  • ai-auto-comment.allowSingleLineSelection - Whether to allow single-line selections for generating docs. Usually it's best to give the AI more than one line but enabling this can be useful for small functions.

jsdoc-openai-powered-generator's People

Contributors

tom-roberts-worldover avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.