mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-11-20 03:49:45 +00:00
feat: add PathAt code context query (#2232)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
This is used for custom paste scripts
- by pattern: e.g. `$root`
- by code: e.g. `{ root }`
- on conflict callback: e.g. `{ (dir: root, on-conflict: root + "/" +
random() + ".png") }`
This commit is contained in:
parent
c63162959d
commit
c206933bf5
12 changed files with 645 additions and 13 deletions
|
|
@ -395,6 +395,19 @@ impl<T, E: std::fmt::Display> WithContextUntyped<T> for Result<T, E> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> WithContextUntyped<T> for Option<T> {
|
||||
fn context_ut(self, loc: &'static str) -> Result<T> {
|
||||
self.ok_or_else(|| Error::new(loc, ErrKind::None, None))
|
||||
}
|
||||
|
||||
fn with_context_ut<F>(self, loc: &'static str, f: F) -> Result<T>
|
||||
where
|
||||
F: FnOnce() -> Option<Box<[(&'static str, String)]>>,
|
||||
{
|
||||
self.ok_or_else(|| Error::new(loc, ErrKind::None, f()))
|
||||
}
|
||||
}
|
||||
|
||||
/// The error prelude.
|
||||
pub mod prelude {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue