mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-11-25 21:37:32 +00:00
dev: use DETACHED_ENTRY if no entry is provided (#647)
* dev: use `DETACHED_ENTRY` if no entry is provided * fix: compile error
This commit is contained in:
parent
2334593ec4
commit
c9846b1d0d
2 changed files with 6 additions and 2 deletions
|
|
@ -551,7 +551,7 @@ impl CompileConfig {
|
|||
}
|
||||
|
||||
/// Determines the root directory for the entry file.
|
||||
fn determine_root(&self, entry: Option<&ImmutPath>) -> Option<ImmutPath> {
|
||||
pub fn determine_root(&self, entry: Option<&ImmutPath>) -> Option<ImmutPath> {
|
||||
if let Some(path) = &self.root_path {
|
||||
return Some(path.as_path().into());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1018,7 +1018,11 @@ impl LanguageState {
|
|||
let handle = client.handle.clone();
|
||||
let entry = query
|
||||
.associated_path()
|
||||
.map(|path| client.config.determine_entry(Some(path.into())));
|
||||
.map(|path| client.config.determine_entry(Some(path.into())))
|
||||
.or_else(|| {
|
||||
let root = client.config.determine_root(None)?;
|
||||
Some(EntryState::new_rooted(root, Some(*DETACHED_ENTRY)))
|
||||
});
|
||||
|
||||
just_future(async move {
|
||||
let mut snap = snap.receive().await?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue