Don't suggest assistant code actions if it's disabled (#19553)

Closes #19155

Release Notes:

- Fixed code action for "Fix with assistant" appearing when assistant
was disabled.
This commit is contained in:
Richard Feldman 2024-10-22 12:36:36 -04:00 committed by GitHub
parent edda149d75
commit ce11ca9d49
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3277,6 +3277,10 @@ impl CodeActionProvider for AssistantCodeActionProvider {
range: Range<text::Anchor>,
cx: &mut WindowContext,
) -> Task<Result<Vec<CodeAction>>> {
if !AssistantSettings::get_global(cx).enabled {
return Task::ready(Ok(Vec::new()));
}
let snapshot = buffer.read(cx).snapshot();
let mut range = range.to_point(&snapshot);