1.0.7 • Published 1 month ago

@shubhamrasal/autocomplete v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

@shubhamrasal/autocomplete

A React-based AI-powered code editor component with intelligent code suggestions.

This component is heavily inspired by codeium-react-code-editor but with option to use openai as provider.

Installation

npm install @shubhamrasal/autocomplete

or

yarn add @shubhamrasal/autocomplete

Features

  • AI-powered code suggestions using OpenAI
  • Monaco editor integration
  • TypeScript support
  • Customizable styling
  • React 18+ compatible

Usage

import { AICodeEditor } from '@shubhamrasal/autocomplete';

function App() {
  return (
    <AICodeEditor
      language="javascript"
      value={initialCode}
      onChange={(value) => console.log(value)}
      openAIKey="your-openai-api-key"
      options={{
        fontSize: 16,
        lineHeight: 1.6,
        padding: { top: 16, bottom: 16 },
      }}
    />
  );
}

Configuration

The AICodeEditor component accepts the following props:

PropTypeDescription
languagestringThe programming language for syntax highlighting (e.g. 'javascript', 'typescript', 'python')
valuestringThe initial value of the editor
onChange(value: string | undefined) => voidCallback function called when the editor content changes
openAIKeystringYour OpenAI API key for AI-powered suggestions
optionsobjectMonaco editor options (see Monaco Editor documentation)
classNamestringAdditional CSS classes to apply to the editor

Development

  1. Clone the repository
  2. Install dependencies:
    npm install
  3. Start the development server (runs the demo):
    npm run dev

The demo app in the demo directory shows a complete example of how to use the component.

Building

To build the library:

npm run build

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

1.0.7

1 month ago

1.0.6

1 month ago

1.0.5

1 month ago

1.0.4

1 month ago

1.0.3

1 month ago

1.0.1

1 month ago

1.0.0

1 month ago