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

[omit] vs <exclude/> #786

Closed
davedawkins opened this issue Jan 8, 2023 · 12 comments
Closed

[omit] vs <exclude/> #786

davedawkins opened this issue Jan 8, 2023 · 12 comments

Comments

@davedawkins
Copy link
Contributor

% dotnet fsdocs --version
fsdocs 16.1.1
% dotnet --version
6.0.404

Both [omit] and <exclude> are mentioned in the documentation.

However:

  • <exclude> doesn't appear to work (neither does <exclude/>)
  • [omit] does work, but:
    • it produces a warning
    • sometimes it doesn't and becomes the summary for the item being excluded.

The warning (which gives a good example of how to use <exclude/>:

The use of `[omit]` and other commands in XML comments is deprecated, please use XML extensions, see https://github.com/fsharp/fslang-design/blob/master/tooling/FST-1031-xmldoc-extensions.md

When [omit] doesn't work:
image

@davedawkins
Copy link
Contributor Author

For reference, BindHelpers is an internal module. Eg

[<AutoOpen>]
module Sutil.Bindings

///[omit]
[<AutoOpen>]
module BindHelpers =
    // ..

@nojaf
Copy link
Collaborator

nojaf commented Jan 9, 2023

Hello, I can't say I know anything about this. I found both exclude and omit in https://github.com/fsprojects/FSharp.Formatting/blob/94e833aa3d741e70b75f7d3d8f52da44d364f59c/src/FSharp.Formatting.ApiDocs/GenerateModel.fs so there definitely is something about it.
I'm afraid you would have to debug that code to really know what is up.

@davedawkins
Copy link
Contributor Author

Verified that it doesn't work in 17.2 either

% dotnet --version
7.0.101
% dotnet fsdocs --version
fsdocs 17.2.0

I have tried:

///<exclude>
/// <exclude>
///<exclude/>
/// <exclude/>
/// <exclude> </exclude>
/// <exclude value="true">true</exclude>

From your link:

        for e in doc.Elements(XName.Get "exclude") do
            cmds.["exclude"] <- e.Value

        for e in doc.Elements(XName.Get "omit") do
            cmds.["omit"] <- e.Value

My guess is that either:

  • exclude isn't being parsed into doc.Elements or
  • e.Value isn't set correctly for <exclude/> or
  • cmds ["exclude"] is being ignored somewhere

If you're a maintainer, could you point me at the code that assigns/parses/builds doc.Elements please?

@davedawkins
Copy link
Contributor Author

I'm writing a test for <exclude/> and [omit]

@nojaf
Copy link
Collaborator

nojaf commented Jan 9, 2023

I can't really say I know anything more than you do at this point.
I found a let doc = XDocument.Load(xmlFile) call in that same file, so interestingly enough it is grabbing the XML from a separate file and something embedded in the assembly, I guess.
Or not, I honestly don't know and won't be of much use here.
Good luck!

@davedawkins
Copy link
Contributor Author

OK :-) Well, I'm down the rabbit hole now - I'll keep at it. I don't have a lot of success with fsdocs.

@nojaf
Copy link
Collaborator

nojaf commented Jan 9, 2023

Thank you!

@davedawkins
Copy link
Contributor Author

OK, so part of the problem is that

/// A comment
/// <exclude/>

is parsed as

<summary>A comment&lt;exclude/&gt</summary>

This means a workaround is to explicitly tag the comment

/// <summary>
/// A comment
/// </summary>
/// <exclude/>

@davedawkins
Copy link
Contributor Author

Nested modules are still included though.

@davedawkins
Copy link
Contributor Author

Fixed it. PR incoming

davedawkins added a commit to davedawkins/FSharp.Formatting that referenced this issue Jan 10, 2023
@davedawkins
Copy link
Contributor Author

davedawkins commented Jan 10, 2023

PR submitted and passed checks

davedawkins added a commit to davedawkins/FSharp.Formatting that referenced this issue Jan 11, 2023
@nhirschey
Copy link
Collaborator

Closed by #787

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