Exafunction / codeium-react-code-editor

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

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

Closed bkataru closed 9 months ago

bkataru commented 9 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
      );