mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-11-24 05:06:41 +00:00
feat: handle func.with stack during signature analysis (#699)
* fix: some cases of docs checking * feat: check signature with binding stack * feat: handle with stack * dev: update snapshot * dev: update snapshot
This commit is contained in:
parent
39f343d536
commit
e35b9f9c73
22 changed files with 279 additions and 111 deletions
|
|
@ -68,7 +68,7 @@ pub enum SymbolDocsT<T> {
|
|||
Function(Box<SignatureDocsT<T>>),
|
||||
/// Documentation about a variable.
|
||||
#[serde(rename = "var")]
|
||||
Variable(TidyVarDocs),
|
||||
Variable(TidyVarDocsT<T>),
|
||||
/// Documentation about a module.
|
||||
#[serde(rename = "module")]
|
||||
Module(TidyModuleDocs),
|
||||
|
|
@ -139,6 +139,8 @@ pub struct SignatureDocsT<T> {
|
|||
pub ret_ty: T,
|
||||
}
|
||||
|
||||
/// Documentation about a signature.
|
||||
pub type UntypedSignatureDocs = SignatureDocsT<()>;
|
||||
/// Documentation about a signature.
|
||||
pub type SignatureDocs = SignatureDocsT<TypeRepr>;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,10 +18,15 @@ pub struct TidyFuncDocs {
|
|||
pub params: Vec<TidyParamDocs>,
|
||||
}
|
||||
|
||||
/// Documentation about a variable (without type information).
|
||||
pub type UntypedVarDocs = TidyVarDocsT<()>;
|
||||
/// Documentation about a variable.
|
||||
pub type TidyVarDocs = TidyVarDocsT<Option<(String, String)>>;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct TidyVarDocs {
|
||||
pub struct TidyVarDocsT<T> {
|
||||
pub docs: EcoString,
|
||||
pub return_ty: Option<String>,
|
||||
pub return_ty: T,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
|
|
@ -164,7 +169,8 @@ pub fn identify_var_docs(converted: EcoString) -> StrResult<TidyVarDocs> {
|
|||
break;
|
||||
};
|
||||
|
||||
return_ty = Some(w.trim().to_string());
|
||||
// todo: convert me
|
||||
return_ty = Some((w.trim().into(), String::new()));
|
||||
break_line = Some(i);
|
||||
break;
|
||||
}
|
||||
|
|
@ -233,7 +239,7 @@ mod tests {
|
|||
let f = super::identify_var_docs(s.into()).unwrap();
|
||||
let mut res = format!(">> docs:\n{}\n<< docs", f.docs);
|
||||
if let Some(t) = f.return_ty {
|
||||
res.push_str(&format!("\n>>return\n{t}\n<<return"));
|
||||
res.push_str(&format!("\n>>return\n{}\n<<return", t.0));
|
||||
}
|
||||
res
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue