Add repl events (#15259)
Release Notes: - N/A --------- Co-authored-by: Kyle Kelley <rgbkrk@gmail.com>
This commit is contained in:
parent
745d2e4d3b
commit
856d9632e4
11 changed files with 190 additions and 37 deletions
|
@ -1,6 +1,7 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use anyhow::Result;
|
||||
use client::telemetry::Telemetry;
|
||||
use collections::HashMap;
|
||||
use command_palette_hooks::CommandPaletteFilter;
|
||||
use gpui::{
|
||||
|
@ -22,14 +23,15 @@ pub struct ReplStore {
|
|||
enabled: bool,
|
||||
sessions: HashMap<EntityId, View<Session>>,
|
||||
kernel_specifications: Vec<KernelSpecification>,
|
||||
telemetry: Arc<Telemetry>,
|
||||
_subscriptions: Vec<Subscription>,
|
||||
}
|
||||
|
||||
impl ReplStore {
|
||||
const NAMESPACE: &'static str = "repl";
|
||||
|
||||
pub(crate) fn init(fs: Arc<dyn Fs>, cx: &mut AppContext) {
|
||||
let store = cx.new_model(move |cx| Self::new(fs, cx));
|
||||
pub(crate) fn init(fs: Arc<dyn Fs>, telemetry: Arc<Telemetry>, cx: &mut AppContext) {
|
||||
let store = cx.new_model(move |cx| Self::new(fs, telemetry, cx));
|
||||
|
||||
store
|
||||
.update(cx, |store, cx| store.refresh_kernelspecs(cx))
|
||||
|
@ -42,13 +44,14 @@ impl ReplStore {
|
|||
cx.global::<GlobalReplStore>().0.clone()
|
||||
}
|
||||
|
||||
pub fn new(fs: Arc<dyn Fs>, cx: &mut ModelContext<Self>) -> Self {
|
||||
pub fn new(fs: Arc<dyn Fs>, telemetry: Arc<Telemetry>, cx: &mut ModelContext<Self>) -> Self {
|
||||
let subscriptions = vec![cx.observe_global::<SettingsStore>(move |this, cx| {
|
||||
this.set_enabled(JupyterSettings::enabled(cx), cx);
|
||||
})];
|
||||
|
||||
let this = Self {
|
||||
fs,
|
||||
telemetry,
|
||||
enabled: JupyterSettings::enabled(cx),
|
||||
sessions: HashMap::default(),
|
||||
kernel_specifications: Vec::new(),
|
||||
|
@ -62,6 +65,10 @@ impl ReplStore {
|
|||
&self.fs
|
||||
}
|
||||
|
||||
pub fn telemetry(&self) -> &Arc<Telemetry> {
|
||||
&self.telemetry
|
||||
}
|
||||
|
||||
pub fn is_enabled(&self) -> bool {
|
||||
self.enabled
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue