Exafunction / codeium-react-code-editor

AI-enabled code editor for React. Unlimited AI autocomplete capabilities with full Typescript support.
MIT License
162 stars 10 forks source link

Refactored code to make use of interface generics from `monaco-editor` #2

Open bkataru opened 6 months ago

bkataru commented 6 months ago

Refactored MonacoInlineCompletion into its own file to reuse the class to redefine some interfaces as interface generics in accordance with the monaco-editor API because MonacoInlineCompletion is after all an implementation of the monaco.languages.InlineCompletion interface.

Also added the following type-guard for inlineCompletionItems to remove the type assertion as monaco.languages.InlineCompletion[]

      .filter(
        (item?: MonacoInlineCompletion): item is MonacoInlineCompletion =>
          !!item
      );