mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-11-24 21:19:37 +00:00
feat: resolve projects by lockDatabase (#1142)
* feat: implement lock-based project resolution * feat: first working example
This commit is contained in:
parent
89c178295a
commit
6d1e40d3a9
12 changed files with 460 additions and 65 deletions
|
|
@ -24,6 +24,7 @@ pub mod signature;
|
|||
pub use signature::*;
|
||||
pub mod semantic_tokens;
|
||||
pub use semantic_tokens::*;
|
||||
use tinymist_std::ImmutPath;
|
||||
use tinymist_world::vfs::WorkspaceResolver;
|
||||
use tinymist_world::WorldDeps;
|
||||
use typst::syntax::Source;
|
||||
|
|
@ -76,6 +77,10 @@ pub trait LspWorldExt {
|
|||
/// Get all depended file ids of a compilation, inclusively.
|
||||
/// Note: must be called after compilation.
|
||||
fn depended_files(&self) -> EcoVec<FileId>;
|
||||
|
||||
/// Get all depended paths in file system of a compilation, inclusively.
|
||||
/// Note: must be called after compilation.
|
||||
fn depended_fs_paths(&self) -> EcoVec<ImmutPath>;
|
||||
}
|
||||
|
||||
impl LspWorldExt for tinymist_project::LspWorld {
|
||||
|
|
@ -109,6 +114,16 @@ impl LspWorldExt for tinymist_project::LspWorld {
|
|||
});
|
||||
deps
|
||||
}
|
||||
|
||||
fn depended_fs_paths(&self) -> EcoVec<ImmutPath> {
|
||||
let mut deps = EcoVec::new();
|
||||
self.iter_dependencies(&mut |file_id| {
|
||||
if let Ok(path) = self.path_for_id(file_id) {
|
||||
deps.push(path.as_path().into());
|
||||
}
|
||||
});
|
||||
deps
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue