Skip to content

saminzadeh/codemirror-extension-inline-suggestion

Repository files navigation

codemirror-extension-inline-suggestion

This package implements inline suggestions for the CodeMirror code editor.

Screenshot

Install

npm install codemirror-extension-inline-suggestion --save

Usage

Edit codemirror-extension-inline-suggestion

import CodeMirror from '@uiw/react-codemirror';
import { inlineSuggestion } from 'codemirror-extension-inline-suggestion';

const fetchSuggestion = async (state) => {
  // or make an async API call here based on editor state
  return 'hello';
};

function App() {
  return (
    <CodeMirror
      value=""
      height="200px"
      extensions={[
        inlineSuggestion({
          fetchFn: fetchSuggestion,
          delay: 1000,
        }),
      ]}
    />
  );
}

export default App;

License

MIT

About

A CodeMirror extension to display inline suggestions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published