Giter VIP home page Giter VIP logo

vscode-ai-rename's Introduction

icon

ai-rename Visual Studio Code Extension

"There are only two hard things in Computer Science: cache invalidation and naming things." -- Phil Karlton

ai-rename is a Visual Studio Code extension that uses OpenAI's API to rename the symbol under the cursor. It can provide naming suggestions and apply a new name automatically. Currently, it uses the "gpt-3.5-turbo" model, which is the same model used by ChatGPT.

Installation

Install it from the Visual Studio Code Marketplace.

An OpenAI API key is required before using. For more information on how to get a key, visit OpenAI's website.

Set your OpenAI key to "aiRename.openAiApiKey" in your VS Code settings.json or Open Ai Api Key on the UI:

key-config

Usage

Call up the command palette by pressing cmd+shift+p (mac) or ctrl+shift+p (win). Then use the command AI Rename: Rename to generate naming suggestions for the symbol under your cursor. Select an item and it will rename the symbol to the selected name automatically.

You can also bind this command to a shortcut for convenience.

See the demo:

demo

Extension Settings

This extension contributes the following settings:

  • aiRename.openAiApiKey: the API key of OpenAI.
  • aiRename.maxSuggestionsNum: the maximum number of naming suggestions generated by OpenAI; by default it's 3; it can quickly consume your token quota if it's too high.
  • aiRename.maxNameLength: the maximum length of the generated name.
  • aiRename.openAiTemperature: the temperature parameter in OpenAI requests.
  • aiRename.maxCharactersNum: the maximum number of characters in the document.

Known Issues

Sometimes the renaming process may fail. This is because OpenAI's API is not stable. If you encounter this issue, please try again or adjust the temperature parameter in settings.

To-Do List

  • Support a right-click menu item.
  • Only send surrounding text to OpenAI API.
  • Add tests.

Contributing

Feel free to contribute to the ai-rename extension by submitting bug reports, feature requests, or pull requests on the GitHub repository.


Enjoy!

vscode-ai-rename's People

Contributors

paco0x 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.