Docs: Links and desciptions for number types (#6752)
Links and desciptions for number types Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
@ -664,7 +664,9 @@ fn cleanup_type_string(input: &str, fmt_for_text: bool) -> String {
|
||||
// If we can handle signatures more manually we could get highlighting and links and
|
||||
// we might want to restore the links by not checking `fmt_for_text` here.
|
||||
|
||||
if fmt_for_text && SPECIAL_TYPES.contains(&ty) {
|
||||
if fmt_for_text && ty.starts_with("number") {
|
||||
format!("[{prefix}{ty}{suffix}](/docs/kcl-std/types/std-types-number)")
|
||||
} else if fmt_for_text && SPECIAL_TYPES.contains(&ty) {
|
||||
format!("[{prefix}{ty}{suffix}](/docs/kcl-lang/types#{ty})")
|
||||
} else if fmt_for_text && DECLARED_TYPES.contains(&ty) {
|
||||
format!("[{prefix}{ty}{suffix}](/docs/kcl-std/types/std-types-{ty})")
|
||||
|
@ -398,8 +398,10 @@ impl From<StdLibFnArg> for ParameterInformation {
|
||||
}
|
||||
|
||||
fn docs_for_type(ty: &str, kcl_std: &ModData) -> Option<String> {
|
||||
if DECLARED_TYPES.contains(&ty) {
|
||||
if let Some(data) = kcl_std.find_by_name(ty) {
|
||||
let key = if ty.starts_with("number") { "number" } else { ty };
|
||||
|
||||
if DECLARED_TYPES.contains(&key) {
|
||||
if let Some(data) = kcl_std.find_by_name(key) {
|
||||
return data.summary().cloned();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user