gdnative icon indicating copy to clipboard operation
gdnative copied to clipboard

Outdated links in error message

Open Bogay opened this issue 2 years ago • 3 comments

Copied from discord:

Found outdated links in the error message. Perhaps the version string could be extracted from Cargo.toml at compile time to make it more consistent?

fn generate_error_with_docs(span: proc_macro2::Span, message: &str) -> syn::Error {
    syn::Error::new(
        span,
        format!(
            "{message}\n\texpecting #[variant(...)]. See documentation:\n\thttps://docs.rs/gdnative/0.9.0/gdnative/core_types/trait.ToVariant.html#field-attributes"
        ),
    )
}

https://github.com/godot-rust/gdnative/blob/6dc972190f6cefb15eef6588c81a015983718df5/gdnative-derive/src/variant/attr.rs#L72-L79

another one with similar signature:

https://github.com/godot-rust/gdnative/blob/6dc972190f6cefb15eef6588c81a015983718df5/gdnative-derive/src/variant/attr/field.rs#L36-L43

Bogay avatar Oct 15 '23 11:10 Bogay

Maybe related: https://github.com/godot-rust/gdnative/pull/1039

Should we put latest compatible Godot version in Cargo.toml?

Bogay avatar Oct 15 '23 11:10 Bogay

Oh, the links to godot doc are written in doc comments. So it's harder to generate it 🤔

Bogay avatar Oct 15 '23 17:10 Bogay

Doc comments are just sugar for #[doc] attributes so they can be generated using proc-macros. I guess we can also do text-based search & replace in the build script but that's much more of a risky option.

chitoyuu avatar Oct 16 '23 00:10 chitoyuu