mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-08-03 17:58:17 +00:00
refactor: simplify pin_entry (#320)
* refactor: simplify pin_entry * fix: update self.pinning
This commit is contained in:
parent
257a6bcb86
commit
27fa1beb26
1 changed files with 4 additions and 11 deletions
|
@ -31,17 +31,10 @@ impl TypstLanguageServer {
|
|||
/// Pin the entry to the given path
|
||||
pub fn pin_entry(&mut self, new_entry: Option<ImmutPath>) -> Result<(), Error> {
|
||||
self.pinning = new_entry.is_some();
|
||||
self.primary.do_change_entry(new_entry)?;
|
||||
|
||||
if !self.pinning {
|
||||
let fallback = self.config.compile.determine_default_entry_path();
|
||||
let fallback = fallback.or_else(|| self.focusing.clone());
|
||||
if let Some(e) = fallback {
|
||||
self.primary.do_change_entry(Some(e))?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
let entry = new_entry
|
||||
.or_else(|| self.config.compile.determine_default_entry_path())
|
||||
.or_else(|| self.focusing.clone());
|
||||
self.primary.do_change_entry(entry).map(|_| ())
|
||||
}
|
||||
|
||||
/// Updates the primary (focusing) entry
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue