AI-powered for monaco editor
npm install monaco-editor-codeium-ai-pluginsh
NPM
npm install @codeium/react-code-editor
Yarn
yarn add @codeium/react-code-editor
PNPM
pnpm install @codeium/react-code-editor
`
Now import the CodeiumEditor and enjoy lightning fast AI autocomplete, directly in your browser, 100% for free!
`tsx
import { CodeiumEditor } from "@codeium/react-code-editor";
export const IdeWithAutocomplete = () => {
return (
Here's an AI-powered Python editor using Codeium.
);
};
`
Here's an advanced example that uses multi-document context to provide more intelligent autocompletion:
`tsx
import { CodeiumEditor, Document, Language } from "@codeium/react-code-editor";
export const JavaScriptEditorWithContext = () => {
const html =
;
return (
This editor has context awareness of a neighboring HTML file and can provide better autocompletion suggestions.
language="javascript"
theme="vs-dark"
otherDocuments={[
new Document({
absolutePath: "/app/index.html",
relativePath: "index.html",
text: html,
editorLanguage: "html",
language: Language.HTML,
}),
]}
/>
);
};
`
Note that the otherDocuments prop has a limit of 10 documents. Within those documents, Codeium will run a reranker behind the scenes to optimize what is included in the token limit.
$3
Here are some examples of Codeium React Editor used in production:
- https://khou22.com/programming/codeium [src]
How it works
This project is a wrapper around Microsoft's Monaco editor which is the editor that powers VS Code with the extended capability of providing code autocompletion.
The autocompletes are provided by analyzing the editor's content and predicting and providing suggestions based on that context. To learn more about how the autocompletion works, visit Codeium's FAQ.
What is Codeium
Codeium is a free, AI-powered developer toolkit that plugs into 70+ IDEs, including: Visual Studio Code, JetBrains IDEs, Google Colab, and Vim. Codeium provides unlimited AI context-aware autocomplete, chat assistant, intelligent search, codebase indexing, and more. Codeium also offers flexible deployments within your VPC or in on-prem, airgapped environments. Learn more at codeium.com.
API
The core API of the editor is the same as that of the wrapped project. You can view the editor API here.
FAQ
#### How can I import the ESM version of this?
To import the ESM version of this, you can use import { CodeiumEditor } from "@codeium/react-code-editor/dist/esm";. If you're using TypeScript, your editor might warn that the types are missing. A current workaround is:
- Create a codeiumeditor.d.ts file,
- Add declare module '@codeium/react-code-editor/dist/esm'; to the file
- Import the types file in the file using the CodeiumEditor` component.