Exafunction / codeium-chrome

Free, ultrafast code autocomplete for Chrome
https://www.codeium.com/
MIT License
114 stars 19 forks source link

[WIP] Feat: show tab-specific icon status and turn on/off completion on each page manually #51

Open li-xin-yi opened 7 months ago

li-xin-yi commented 7 months ago

Add a contextMenu option to control the behavior on the current tab: image

Three status:

  1. image idle: The extension is enabled, but the URL is not in white list or no editor can be injected
  2. image off: the extension is disabled by the user
  3. image active: the completion is working on this page.

Implementation issues:

contentScript.ts and the injected script.ts are running independently, so we have to construct so many messages to communicate between different environments. Temporarily, the "disabled" feature is hacked by passing the global variable codeium_disabled and let the completion provider in Monaco/CodeMirror be dummy when observing codeium_disabled become false, instead of implementing a real clean up script to unregister all completion handlers. It may be problematic, for example, Colab supports inline completion for some eligible users. If we turn off the Codeium extension, the built-in colab completion is also disabled.

For issue #49 (for now, only 1 and 3 are done)

CLAassistant commented 7 months ago

CLA assistant check
All committers have signed the CLA.

pqn commented 7 months ago

Adding @kevinzlu to take a look if he has time, since I am OOO right now.

kevinzlu commented 7 months ago

@li-xin-yi is this PR still a WIP or is it ready for review? I was not able to get the contextMenu item when I tested it + failed to get completions in Colab.

li-xin-yi commented 7 months ago

Hi @kevinzlu , Thanks for testing.

  1. When creating this PR, I just waited for the review to make sure if I understand @pqn 's suggestion correctly. This PR is not finished, I'll implement the popup window to finish the feature 2 in #49
  2. Can you provide more details about the failure? If on Colab, I think the colab itself overwrote the contextmenu on cell areas, but the default contextmenu does show up when clicking on other regions, such as the header.
image
li-xin-yi commented 7 months ago
image

Update: generate a regex to match the current primary domain.

This PR is still in process, I just posted it to know if it understand the requirement correctly.