Skip to content

Commit

Permalink
normalize win paths for telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
reymondzzzz committed Dec 27, 2024
1 parent 2298602 commit 643d3aa
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/telemetry/snippets_collection.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
use serde::{Deserialize, Serialize};
use std::sync::Arc;
use std::sync::RwLock as StdRwLock;
use serde::{Serialize, Deserialize};

use tokio::sync::RwLock as ARwLock;
use tracing::debug;

use crate::global_context;
use crate::completion_cache;
use crate::call_validation::CodeCompletionPost;
use crate::telemetry::telemetry_structs;
use crate::telemetry::basic_robot_human;
use crate::completion_cache;
use crate::files_correction::to_pathbuf_normalize;
use crate::global_context;
use crate::telemetry::basic_comp_counters;
use crate::telemetry::basic_robot_human;
use crate::telemetry::telemetry_structs;
use crate::telemetry::telemetry_structs::SnippetTracker;
use crate::telemetry::utils;


// How it works:
// 1. Rust returns {"snippet_telemetry_id":101,"choices":[{"code_completion":"\n return \"Hello World!\"\n"}] ...}
// 2. IDE detects accept, sends /v1/completion-accepted with {"snippet_telemetry_id":101}
Expand Down Expand Up @@ -115,7 +115,9 @@ pub async fn sources_changed(

let mut accepted_snippets = vec![];
for snip in storage_locked.tele_snippets.iter_mut() {
if snip.accepted_ts == 0 || !uri.ends_with(&snip.inputs.cursor.file) {
let uri_path = to_pathbuf_normalize(uri).to_string_lossy().to_string();
let cursor_file_path = to_pathbuf_normalize(&snip.inputs.cursor.file).to_string_lossy().to_string();
if snip.accepted_ts == 0 || !uri_path.ends_with(&cursor_file_path) {
continue;
}
if snip.finished_ts > 0 {
Expand Down

0 comments on commit 643d3aa

Please sign in to comment.