Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat ExperimentalAttribute similar to ObsoleteAttribute (feature request) #1093

Open
nightroman opened this issue Jan 3, 2025 · 5 comments

Comments

@nightroman
Copy link

The C# 12 ExperimentalAttribute is conceptually similar to ObsoleteAttribute. SHFB respects ObsoleteAttribute and, for example, displays a type with it as

[ObsoleteAttribute("Exprerimental, subject to change.", DiagnosticId = "FarNet250101")]
public readonly ref struct CommandParameters

But the ExperimentalAttribute seems to be ignored and not shown / present in the result help.
It looks natural and useful to treat it the same way as ObsoleteAttribute, if possible.

@EWSoftware
Copy link
Owner

SHFB currently excludes all attributes in the System.Diagnostics.CodeAnalysis namespace. I can add ExperimentalAttribute as an exception that is included.

@timunie
Copy link

timunie commented Jan 31, 2025

We're having some additional attributes that are project specific but a tag would be helpful as well for the users. So we copied and modified the original presentationstyle to loop over these attributes and render them as needed. For example "Unstable" and "NotClientImplementable".

If you are interested in adding such a feature, please let me know and I can file a draft PR for discussion.

@timunie
Copy link

timunie commented Jan 31, 2025

Here is how my draft looks like:

Image

https://timunie.github.io/Ava-ApiTests/html/N_Avalonia_Controls.htm

@EWSoftware
Copy link
Owner

I'd like to see what you did. It's entirely possible I can alter the presentation style a bit to allow overriding or extending the notices so that you don't have to reimplement the whole presentation style. That's the main reason I converted them all from XSL to code. It's much easier to do that now.

@timunie
Copy link

timunie commented Feb 1, 2025

Notices can already be altered and this was my first attempt. However this only applies to the pages, but not to lists of classes or properties. This was the harder part for me. So I intended two dictionaries for long and short messages which I loop over. The key is the attribute name and the value is the XNode to render.

If that idea suits you as well, we may either allow addons to handle it or even TransformArgs which just returns an ItemInclude or string. I guess a plugin would be more flexible when it comes to styling.

Here is my test branch if you want to take a look. Its trail and error, so don't laugh at me with all the forth and back. AvaloniaUI/Avalonia#17953

Will try to clean just the attribute part and file a PR here, so it's probably easier for you to see the changes proposed.

Have a nice weekend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants