mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
nit: renaming (#20998)
This commit is contained in:
committed by
GitHub
Unverified
parent
0269a46ab1
commit
5512b23c95
@@ -96,8 +96,8 @@ pub enum MemoryEntryType {
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
|
||||
pub struct MemorySearchMatch {
|
||||
pub path: String,
|
||||
pub line_number: usize,
|
||||
pub start_line_number: usize,
|
||||
pub match_line_number: usize,
|
||||
pub content_start_line_number: usize,
|
||||
pub content: String,
|
||||
}
|
||||
|
||||
|
||||
@@ -223,7 +223,7 @@ impl MemoriesBackend for LocalMemoriesBackend {
|
||||
matches.sort_by(|left, right| {
|
||||
left.path
|
||||
.cmp(&right.path)
|
||||
.then(left.line_number.cmp(&right.line_number))
|
||||
.then(left.match_line_number.cmp(&right.match_line_number))
|
||||
});
|
||||
if start_index > matches.len() {
|
||||
return Err(MemoriesBackendError::invalid_cursor(
|
||||
@@ -309,8 +309,8 @@ async fn search_file(
|
||||
.min(lines.len());
|
||||
matches.push(MemorySearchMatch {
|
||||
path: display_relative_path(root, path),
|
||||
line_number: idx + 1,
|
||||
start_line_number: start_index + 1,
|
||||
match_line_number: idx + 1,
|
||||
content_start_line_number: start_index + 1,
|
||||
content: lines[start_index..end_index].join("\n"),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -396,14 +396,14 @@ async fn search_supports_directory_and_file_scopes() {
|
||||
vec![
|
||||
MemorySearchMatch {
|
||||
path: "MEMORY.md".to_string(),
|
||||
line_number: 2,
|
||||
start_line_number: 2,
|
||||
match_line_number: 2,
|
||||
content_start_line_number: 2,
|
||||
content: "needle".to_string(),
|
||||
},
|
||||
MemorySearchMatch {
|
||||
path: "rollout_summaries/a.jsonl".to_string(),
|
||||
line_number: 1,
|
||||
start_line_number: 1,
|
||||
match_line_number: 1,
|
||||
content_start_line_number: 1,
|
||||
content: "needle again".to_string(),
|
||||
},
|
||||
]
|
||||
@@ -426,8 +426,8 @@ async fn search_supports_directory_and_file_scopes() {
|
||||
file_response.matches,
|
||||
vec![MemorySearchMatch {
|
||||
path: "MEMORY.md".to_string(),
|
||||
line_number: 2,
|
||||
start_line_number: 2,
|
||||
match_line_number: 2,
|
||||
content_start_line_number: 2,
|
||||
content: "needle".to_string(),
|
||||
}]
|
||||
);
|
||||
@@ -467,14 +467,14 @@ async fn search_supports_pagination() {
|
||||
vec![
|
||||
MemorySearchMatch {
|
||||
path: "MEMORY.md".to_string(),
|
||||
line_number: 1,
|
||||
start_line_number: 1,
|
||||
match_line_number: 1,
|
||||
content_start_line_number: 1,
|
||||
content: "needle one".to_string(),
|
||||
},
|
||||
MemorySearchMatch {
|
||||
path: "MEMORY.md".to_string(),
|
||||
line_number: 2,
|
||||
start_line_number: 2,
|
||||
match_line_number: 2,
|
||||
content_start_line_number: 2,
|
||||
content: "needle two".to_string(),
|
||||
},
|
||||
]
|
||||
@@ -497,8 +497,8 @@ async fn search_supports_pagination() {
|
||||
page2.matches,
|
||||
vec![MemorySearchMatch {
|
||||
path: "rollout_summaries/a.jsonl".to_string(),
|
||||
line_number: 1,
|
||||
start_line_number: 1,
|
||||
match_line_number: 1,
|
||||
content_start_line_number: 1,
|
||||
content: "needle three".to_string(),
|
||||
}]
|
||||
);
|
||||
@@ -533,14 +533,14 @@ async fn search_supports_context_lines() {
|
||||
vec![
|
||||
MemorySearchMatch {
|
||||
path: "MEMORY.md".to_string(),
|
||||
line_number: 2,
|
||||
start_line_number: 1,
|
||||
match_line_number: 2,
|
||||
content_start_line_number: 1,
|
||||
content: "alpha\nneedle\nomega".to_string(),
|
||||
},
|
||||
MemorySearchMatch {
|
||||
path: "MEMORY.md".to_string(),
|
||||
line_number: 4,
|
||||
start_line_number: 3,
|
||||
match_line_number: 4,
|
||||
content_start_line_number: 3,
|
||||
content: "omega\nneedle again".to_string(),
|
||||
},
|
||||
]
|
||||
@@ -569,8 +569,8 @@ async fn search_supports_case_insensitive_matching() {
|
||||
sensitive_response.matches,
|
||||
vec![MemorySearchMatch {
|
||||
path: "MEMORY.md".to_string(),
|
||||
line_number: 2,
|
||||
start_line_number: 2,
|
||||
match_line_number: 2,
|
||||
content_start_line_number: 2,
|
||||
content: "needle".to_string(),
|
||||
}]
|
||||
);
|
||||
@@ -591,20 +591,20 @@ async fn search_supports_case_insensitive_matching() {
|
||||
vec![
|
||||
MemorySearchMatch {
|
||||
path: "MEMORY.md".to_string(),
|
||||
line_number: 1,
|
||||
start_line_number: 1,
|
||||
match_line_number: 1,
|
||||
content_start_line_number: 1,
|
||||
content: "Needle".to_string(),
|
||||
},
|
||||
MemorySearchMatch {
|
||||
path: "MEMORY.md".to_string(),
|
||||
line_number: 2,
|
||||
start_line_number: 2,
|
||||
match_line_number: 2,
|
||||
content_start_line_number: 2,
|
||||
content: "needle".to_string(),
|
||||
},
|
||||
MemorySearchMatch {
|
||||
path: "MEMORY.md".to_string(),
|
||||
line_number: 3,
|
||||
start_line_number: 3,
|
||||
match_line_number: 3,
|
||||
content_start_line_number: 3,
|
||||
content: "NEEDLE".to_string(),
|
||||
},
|
||||
]
|
||||
|
||||
@@ -102,11 +102,11 @@ pub(crate) fn search_output_schema() -> JsonObject {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"path": { "type": "string" },
|
||||
"line_number": { "type": "integer" },
|
||||
"start_line_number": { "type": "integer" },
|
||||
"match_line_number": { "type": "integer" },
|
||||
"content_start_line_number": { "type": "integer" },
|
||||
"content": { "type": "string" }
|
||||
},
|
||||
"required": ["path", "line_number", "start_line_number", "content"],
|
||||
"required": ["path", "match_line_number", "content_start_line_number", "content"],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user