Add event for yarn project identification (#12785)
Report a `open yarn project` `app_event` for each worktree where `yarn.lock` is found and only report it once per session. Release Notes: - N/A
This commit is contained in:
parent
243a0e764d
commit
3eac83eece
1 changed files with 31 additions and 0 deletions
|
@ -229,6 +229,7 @@ pub struct Project {
|
||||||
hosted_project_id: Option<ProjectId>,
|
hosted_project_id: Option<ProjectId>,
|
||||||
dev_server_project_id: Option<client::DevServerProjectId>,
|
dev_server_project_id: Option<client::DevServerProjectId>,
|
||||||
search_history: SearchHistory,
|
search_history: SearchHistory,
|
||||||
|
yarn_worktree_ids_reported: Vec<WorktreeId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum LanguageServerToQuery {
|
pub enum LanguageServerToQuery {
|
||||||
|
@ -787,6 +788,7 @@ impl Project {
|
||||||
hosted_project_id: None,
|
hosted_project_id: None,
|
||||||
dev_server_project_id: None,
|
dev_server_project_id: None,
|
||||||
search_history: Self::new_search_history(),
|
search_history: Self::new_search_history(),
|
||||||
|
yarn_worktree_ids_reported: Vec::new(),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -945,6 +947,7 @@ impl Project {
|
||||||
.dev_server_project_id
|
.dev_server_project_id
|
||||||
.map(|dev_server_project_id| DevServerProjectId(dev_server_project_id)),
|
.map(|dev_server_project_id| DevServerProjectId(dev_server_project_id)),
|
||||||
search_history: Self::new_search_history(),
|
search_history: Self::new_search_history(),
|
||||||
|
yarn_worktree_ids_reported: Vec::new(),
|
||||||
};
|
};
|
||||||
this.set_role(role, cx);
|
this.set_role(role, cx);
|
||||||
for worktree in worktrees {
|
for worktree in worktrees {
|
||||||
|
@ -7897,6 +7900,8 @@ impl Project {
|
||||||
worktree.read(cx).id(),
|
worktree.read(cx).id(),
|
||||||
changes.clone(),
|
changes.clone(),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
this.report_yarn_project(&worktree, changes, cx);
|
||||||
}
|
}
|
||||||
worktree::Event::UpdatedGitRepositories(updated_repos) => {
|
worktree::Event::UpdatedGitRepositories(updated_repos) => {
|
||||||
if is_local {
|
if is_local {
|
||||||
|
@ -7949,6 +7954,32 @@ impl Project {
|
||||||
self.metadata_changed(cx);
|
self.metadata_changed(cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn report_yarn_project(
|
||||||
|
&mut self,
|
||||||
|
worktree: &Model<Worktree>,
|
||||||
|
updated_entries_set: &UpdatedEntriesSet,
|
||||||
|
cx: &mut ModelContext<Self>,
|
||||||
|
) {
|
||||||
|
let worktree_id = worktree.update(cx, |worktree, _| worktree.id());
|
||||||
|
|
||||||
|
if !self.yarn_worktree_ids_reported.contains(&worktree_id) {
|
||||||
|
let is_yarn_project = updated_entries_set.iter().any(|(path, _, _)| {
|
||||||
|
path.as_ref()
|
||||||
|
.file_name()
|
||||||
|
.and_then(|name| name.to_str())
|
||||||
|
.map(|name_str| name_str == "yarn.lock")
|
||||||
|
.unwrap_or(false)
|
||||||
|
});
|
||||||
|
|
||||||
|
if is_yarn_project {
|
||||||
|
self.client()
|
||||||
|
.telemetry()
|
||||||
|
.report_app_event("open yarn project".to_string());
|
||||||
|
self.yarn_worktree_ids_reported.push(worktree_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn update_local_worktree_buffers(
|
fn update_local_worktree_buffers(
|
||||||
&mut self,
|
&mut self,
|
||||||
worktree_handle: &Model<Worktree>,
|
worktree_handle: &Model<Worktree>,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue