Also record repo relative file path
This commit is contained in:
parent
b9cd8f5d2a
commit
aaaba05ef7
2 changed files with 11 additions and 3 deletions
|
@ -156,6 +156,9 @@ pub struct PredictEditsBody {
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct PredictEditsGitInfo {
|
pub struct PredictEditsGitInfo {
|
||||||
|
/// Repo-relative path to the file that contains the input excerpt.
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none", default)]
|
||||||
|
pub input_file_path: Option<String>,
|
||||||
/// SHA of git HEAD commit at time of prediction.
|
/// SHA of git HEAD commit at time of prediction.
|
||||||
#[serde(skip_serializing_if = "Option::is_none", default)]
|
#[serde(skip_serializing_if = "Option::is_none", default)]
|
||||||
pub head_sha: Option<String>,
|
pub head_sha: Option<String>,
|
||||||
|
@ -165,13 +168,16 @@ pub struct PredictEditsGitInfo {
|
||||||
/// URL of the remote called `upstream`.
|
/// URL of the remote called `upstream`.
|
||||||
#[serde(skip_serializing_if = "Option::is_none", default)]
|
#[serde(skip_serializing_if = "Option::is_none", default)]
|
||||||
pub remote_upstream_url: Option<String>,
|
pub remote_upstream_url: Option<String>,
|
||||||
|
/// Recently active files that may be within this repository.
|
||||||
#[serde(skip_serializing_if = "Option::is_none", default)]
|
#[serde(skip_serializing_if = "Option::is_none", default)]
|
||||||
pub recent_files: Option<Vec<PredictEditsRecentFile>>,
|
pub recent_files: Option<Vec<PredictEditsRecentFile>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct PredictEditsRecentFile {
|
pub struct PredictEditsRecentFile {
|
||||||
pub repo_path: String,
|
/// Path to a file within the repository.
|
||||||
|
pub path: String,
|
||||||
|
/// Milliseconds between the editor for this file being active and the request time.
|
||||||
pub active_to_now_ms: u32,
|
pub active_to_now_ms: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1146,8 +1146,9 @@ and then another
|
||||||
}
|
}
|
||||||
|
|
||||||
let git_store = project.git_store().read(cx);
|
let git_store = project.git_store().read(cx);
|
||||||
let (repository, _repo_path) =
|
let (repository, repo_path) =
|
||||||
git_store.repository_and_path_for_project_path(&project_path, cx)?;
|
git_store.repository_and_path_for_project_path(&project_path, cx)?;
|
||||||
|
let repo_path_str = repo_path.to_str()?;
|
||||||
|
|
||||||
let repository = repository.read(cx);
|
let repository = repository.read(cx);
|
||||||
let head_sha = repository
|
let head_sha = repository
|
||||||
|
@ -1163,6 +1164,7 @@ and then another
|
||||||
let recent_files = self.recent_files(&buffer_snapshotted_at, repository, cx);
|
let recent_files = self.recent_files(&buffer_snapshotted_at, repository, cx);
|
||||||
|
|
||||||
Some(PredictEditsGitInfo {
|
Some(PredictEditsGitInfo {
|
||||||
|
input_file_path: Some(repo_path_str.to_string()),
|
||||||
head_sha,
|
head_sha,
|
||||||
remote_origin_url,
|
remote_origin_url,
|
||||||
remote_upstream_url,
|
remote_upstream_url,
|
||||||
|
@ -1231,7 +1233,7 @@ and then another
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
results.push(PredictEditsRecentFile {
|
results.push(PredictEditsRecentFile {
|
||||||
repo_path: repo_path_str.to_string(),
|
path: repo_path_str.to_string(),
|
||||||
active_to_now_ms,
|
active_to_now_ms,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue