Skip to content

Handling of match statement comments #21

@Sven65

Description

@Sven65

Please Describe The Problem To Be Solved

Comments for keys in a match statement covered by the index attribute should be parsed as descriptions of the return value.

For example, the following should be parsed so the description of the id index is The ID of the channel category, and be passed to the markdown file.

impl UserData for TBChannelCategory {
	#[lua_document("TBChannelCategory", index)]
	fn add_methods<'lua, T: rlua::UserDataMethods<'lua, Self>>(methods: &mut T) {
		methods.add_meta_method(MetaMethod::Index, |ctx, this, value: String| {
			Ok(match value.as_str() {
				/// The ID of the channel category
				"id" => convert_constructable2::<TBChannelId, _, SerenityContext>(this.0.id, this.1.clone(), ctx)?,
				...,
				&_ => Value::Nil,
			})
		})
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions