mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-07-24 13:13:43 +00:00
* fix: the path to join is shadowed by a local variable * fix: redact target uri
This commit is contained in:
parent
cb51d67e7d
commit
9904189910
7 changed files with 49 additions and 2 deletions
|
@ -37,3 +37,19 @@ impl SemanticRequest for DocumentLinkRequest {
|
|||
Some(links.collect())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::tests::*;
|
||||
|
||||
#[test]
|
||||
fn test() {
|
||||
snapshot_testing("document_link", &|ctx, path| {
|
||||
let request = DocumentLinkRequest { path: path.clone() };
|
||||
|
||||
let result = request.request(ctx);
|
||||
assert_snapshot!(JsonRepr::new_redacted(result, &REDACT_LOC));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
/// path: base.json
|
||||
{}
|
||||
-----
|
||||
#json(/* position after */ "base.json");
|
|
@ -0,0 +1,3 @@
|
|||
/// path: base.typ
|
||||
-----
|
||||
#read(/* position after */ "base.typ");
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
source: crates/tinymist-query/src/document_link.rs
|
||||
expression: "JsonRepr::new_redacted(result, &REDACT_LOC)"
|
||||
input_file: crates/tinymist-query/src/fixtures/document_link/json_path.typ
|
||||
---
|
||||
[
|
||||
{
|
||||
"range": "0:28:0:37",
|
||||
"target": "base.json"
|
||||
}
|
||||
]
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
source: crates/tinymist-query/src/document_link.rs
|
||||
expression: "JsonRepr::new_redacted(result, &REDACT_LOC)"
|
||||
input_file: crates/tinymist-query/src/fixtures/document_link/read_path.typ
|
||||
---
|
||||
[
|
||||
{
|
||||
"range": "0:28:0:36",
|
||||
"target": "base.typ"
|
||||
}
|
||||
]
|
|
@ -344,6 +344,7 @@ pub static REDACT_LOC: Lazy<RedactFields> = Lazy::new(|| {
|
|||
"targetRange",
|
||||
"targetSelectionRange",
|
||||
"originSelectionRange",
|
||||
"target",
|
||||
"targetUri",
|
||||
])
|
||||
});
|
||||
|
@ -416,7 +417,7 @@ impl Redact for RedactFields {
|
|||
),
|
||||
);
|
||||
}
|
||||
"uri" | "oldUri" | "newUri" | "targetUri" => {
|
||||
"uri" | "target" | "oldUri" | "newUri" | "targetUri" => {
|
||||
map.insert(key.to_owned(), file_name(t.as_str().unwrap()).into());
|
||||
}
|
||||
"range"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue