mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-12 21:32:40 +00:00
Send copilot events even if file_extension is not known at the time
This commit is contained in:
parent
6976d60bfe
commit
afe75e8cbd
1 changed files with 21 additions and 18 deletions
|
@ -6888,25 +6888,28 @@ impl Editor {
|
||||||
suggestion_accepted: bool,
|
suggestion_accepted: bool,
|
||||||
cx: &AppContext,
|
cx: &AppContext,
|
||||||
) {
|
) {
|
||||||
if let Some((project, file)) = self.project.as_ref().zip(
|
let Some(project) = &self.project else {
|
||||||
self.buffer
|
return
|
||||||
.read(cx)
|
};
|
||||||
.as_singleton()
|
|
||||||
.and_then(|b| b.read(cx).file()),
|
|
||||||
) {
|
|
||||||
let telemetry_settings = cx.global::<Settings>().telemetry();
|
|
||||||
let extension = Path::new(file.file_name(cx))
|
|
||||||
.extension()
|
|
||||||
.and_then(|e| e.to_str());
|
|
||||||
let telemetry = project.read(cx).client().telemetry().clone();
|
|
||||||
|
|
||||||
let event = ClickhouseEvent::Copilot {
|
// If None, we are either getting suggestions in a new, unsaved file, or in a file without an extension
|
||||||
suggestion_id,
|
let file_extension = self
|
||||||
suggestion_accepted,
|
.buffer
|
||||||
file_extension: extension.map(ToString::to_string),
|
.read(cx)
|
||||||
};
|
.as_singleton()
|
||||||
telemetry.report_clickhouse_event(event, telemetry_settings);
|
.and_then(|b| b.read(cx).file())
|
||||||
}
|
.and_then(|file| Path::new(file.file_name(cx)).extension())
|
||||||
|
.and_then(|e| e.to_str());
|
||||||
|
|
||||||
|
let telemetry = project.read(cx).client().telemetry().clone();
|
||||||
|
let telemetry_settings = cx.global::<Settings>().telemetry();
|
||||||
|
|
||||||
|
let event = ClickhouseEvent::Copilot {
|
||||||
|
suggestion_id,
|
||||||
|
suggestion_accepted,
|
||||||
|
file_extension: file_extension.map(ToString::to_string),
|
||||||
|
};
|
||||||
|
telemetry.report_clickhouse_event(event, telemetry_settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn report_editor_event(&self, name: &'static str, cx: &AppContext) {
|
fn report_editor_event(&self, name: &'static str, cx: &AppContext) {
|
||||||
|
|
Loading…
Reference in a new issue