Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/proc-macro-api/src/lib.rs')
-rw-r--r--crates/proc-macro-api/src/lib.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/crates/proc-macro-api/src/lib.rs b/crates/proc-macro-api/src/lib.rs
index 7b9b5b39ab..0ee0c3afb5 100644
--- a/crates/proc-macro-api/src/lib.rs
+++ b/crates/proc-macro-api/src/lib.rs
@@ -21,14 +21,13 @@ pub mod legacy_protocol;
mod process;
pub mod transport;
-use base_db::SourceDatabase;
use paths::{AbsPath, AbsPathBuf};
use semver::Version;
use span::{ErasedFileAstId, FIXUP_ERASED_FILE_AST_ID_MARKER, Span};
use std::{fmt, io, sync::Arc, time::SystemTime};
-use crate::process::ProcMacroServerProcess;
pub use crate::transport::codec::Codec;
+use crate::{bidirectional_protocol::SubCallback, process::ProcMacroServerProcess};
/// The versions of the server protocol
pub mod version {
@@ -143,9 +142,13 @@ impl ProcMacroClient {
}
/// Loads a proc-macro dylib into the server process returning a list of `ProcMacro`s loaded.
- pub fn load_dylib(&self, dylib: MacroDylib) -> Result<Vec<ProcMacro>, ServerError> {
+ pub fn load_dylib(
+ &self,
+ dylib: MacroDylib,
+ callback: Option<SubCallback<'_>>,
+ ) -> Result<Vec<ProcMacro>, ServerError> {
let _p = tracing::info_span!("ProcMacroServer::load_dylib").entered();
- let macros = self.process.find_proc_macros(&dylib.path)?;
+ let macros = self.process.find_proc_macros(&dylib.path, callback)?;
let dylib_path = Arc::new(dylib.path);
let dylib_last_modified = std::fs::metadata(dylib_path.as_path())
@@ -219,7 +222,6 @@ impl ProcMacro {
/// This includes span information and environmental context.
pub fn expand(
&self,
- db: &dyn SourceDatabase,
subtree: tt::SubtreeView<'_, Span>,
attr: Option<tt::SubtreeView<'_, Span>>,
env: Vec<(String, String)>,
@@ -227,6 +229,7 @@ impl ProcMacro {
call_site: Span,
mixed_site: Span,
current_dir: String,
+ callback: Option<SubCallback<'_>>,
) -> Result<Result<tt::TopSubtree<Span>, String>, ServerError> {
let (mut subtree, mut attr) = (subtree, attr);
let (mut subtree_changed, mut attr_changed);
@@ -243,7 +246,6 @@ impl ProcMacro {
}
self.process.expand(
- db,
self,
subtree,
attr,
@@ -252,6 +254,7 @@ impl ProcMacro {
call_site,
mixed_site,
current_dir,
+ callback,
)
}
}