mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-11-22 20:35:20 +00:00
feat: add path conversion actions for absolute and relative paths (#1696)
* feat: add path conversion actions for absolute and relative paths in special function call * feat: implement matchers * docs: edit comment * fix: path on windows * feat: add a comment * dev: edit a bit * dev: use `resolved` * refactor: simplify path rewriting logic using `diff` * feat: add absolute path import fixture * fix: update path check for absolute paths to use `starts_with` to work with windows * feat: add path expression import fixture --------- Co-authored-by: Myriad-Dreamin <camiyoru@gmail.com>
This commit is contained in:
parent
11cfb08be5
commit
6118b346d6
15 changed files with 287 additions and 1 deletions
|
|
@ -80,3 +80,29 @@ impl SemanticRequest for CodeActionRequest {
|
|||
(!worker.actions.is_empty()).then_some(worker.actions)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::tests::*;
|
||||
|
||||
#[test]
|
||||
fn test() {
|
||||
snapshot_testing("code_action", &|ctx, path| {
|
||||
let source = ctx.source_by_path(&path).unwrap();
|
||||
|
||||
let request = CodeActionRequest {
|
||||
path: path.clone(),
|
||||
range: find_test_range(&source),
|
||||
};
|
||||
|
||||
let result = request.request(ctx);
|
||||
|
||||
insta::with_settings!({
|
||||
description => format!("Code Action on {})", make_range_annoation(&source)),
|
||||
}, {
|
||||
assert_snapshot!(JsonRepr::new_redacted(result, &REDACT_LOC));
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue