-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce InlineCompletionProvider
#9777
Conversation
Co-Authored-By: Nathan <nathan@zed.dev> Co-Authored-By: Kyle <kylek@zed.dev>
Co-Authored-By: Kyle <kylek@zed.dev>
Co-Authored-By: Kyle <kylek@zed.dev>
This branch is failing for two keymap tests, where it tests modifying the base and retaining the users keympa
The assertion that's failing in both of these tests (near the end of each test): // Test modifying the base, while retaining the users keymap
app_state
.fs
.save(
"/settings.json".as_ref(),
&r#"
{
"base_keymap": "JetBrains"
}
"#
.into(),
Default::default(),
)
.await
.unwrap();
cx.background_executor.run_until_parked();
assert_key_bindings_for(
workspace.into(),
cx,
vec![("cmd-shift-[", &ActivatePrevItem)],
line!(),
) I couldn't figure out how the changes here might have caused this. After looking into it with @mikayla-maki, we did not find the root cause but maybe found something odd. In |
…disabled (#9826) This PR fixes some noisy error logs from the `CopilotCompletionProvider` when Copilot is disabled entirely via the settings. I have the following in my settings file: ```json { "features": { "copilot": false }, } ``` After #9777 I started seeing my Zed logs getting filled up with messages like this: ``` [2024-03-26T14:33:09-04:00 ERROR util] crates/copilot_ui/src/copilot_completion_provider.rs:206: copilot is disabled ``` Release Notes: - N/A
This PR restores the `Global` trait's status as a marker trait. This was the original intent from #7095, when it was added, that had been lost in #9777. The purpose of the `Global` trait is to statically convey what types can and can't be accessed as `Global` state, as well as provide a way of restricting access to said globals. For example, in the case of the `ThemeRegistry` we have a private `GlobalThemeRegistry` that is marked as `Global`: https://github.com/zed-industries/zed/blob/91b3c24ed35d58438ae33970f07d1ff01d3acfc7/crates/theme/src/registry.rs#L25-L34 We're then able to permit reading the `ThemeRegistry` from the `GlobalThemeRegistry` via a custom getter, while still restricting which callers are able to mutate the global: https://github.com/zed-industries/zed/blob/91b3c24ed35d58438ae33970f07d1ff01d3acfc7/crates/theme/src/registry.rs#L46-L61 Release Notes: - N/A
This pull request introduces a new
InlineCompletionProvider
trait, which enables makingEditor
copilot-agnostic and lets us push all the copilot functionality into thecopilot_ui
module. Long-term, I would like to mergecopilot
andcopilot_ui
, but right nowproject
depends oncopilot
, which makes this impossible.The reason for adding this new trait is so that we can experiment with other inline completion providers and swap them at runtime using config settings.
Please, note also that we renamed some of the existing copilot actions to be more agnostic (see release notes below). We still kept the old actions bound for backwards-compatibility, but we should probably remove them at some later version.
Also, as a drive-by, we added new methods to the
Global
trait that let you read or mutate a global directly, e.g.:Release Notes:
copilot::Suggest
action toeditor::ShowInlineCompletion
copilot::NextSuggestion
action toeditor::NextInlineCompletion
copilot::PreviousSuggestion
action toeditor::PreviousInlineCompletion
editor::AcceptPartialCopilotSuggestion
action toeditor::AcceptPartialInlineCompletion