-
Notifications
You must be signed in to change notification settings - Fork 831
Xml comment generation for generated signature files #11201
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5f8b33a
first pass of xml doc generation for generated signature files
baronfel 1ed584e
also layout events, props, etc
baronfel 29553b9
toggle debug flag off
baronfel bef2ca6
emit comments behind a displayEnv flag, and do not emit namespace com…
baronfel d7fb98e
initial test
baronfel 85fbea6
update surface area
baronfel 8d25a1c
do not show documentation comments on tooltip signatures
baronfel 5d45c80
default documentation in sigs to false and document callsites that ac…
baronfel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
tests/fsharp/Compiler/Service/SignatureGenerationTests.fs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. | ||
|
|
||
| namespace FSharp.Compiler.UnitTests | ||
|
|
||
| open FSharp.Compiler.Diagnostics | ||
| open NUnit.Framework | ||
| open FSharp.Test.Utilities | ||
| open FSharp.Test.Utilities.Utilities | ||
| open FSharp.Test.Utilities.Compiler | ||
| open FSharp.Tests | ||
|
|
||
| [<TestFixture>] | ||
| module SignatureGenerationTests = | ||
|
|
||
| let sigText (checkResults: FSharp.Compiler.CodeAnalysis.FSharpCheckFileResults) = | ||
| match checkResults.GenerateSignatureForFile() with | ||
| | None -> failwith "Unable to generate signature text." | ||
| | Some text -> text | ||
|
|
||
| let sigShouldBe (expected: string) src = | ||
| let text = | ||
| FSharp src | ||
| |> withLangVersion50 | ||
| |> typecheckResults | ||
| |> sigText | ||
|
|
||
| let actual = text.ToString() | ||
| let expected2 = expected.Replace("\r\n", "\n") | ||
| Assert.shouldBeEquivalentTo expected2 actual | ||
|
|
||
| [<Test>] | ||
| let ``can generate sigs with comments`` () = | ||
| """ | ||
| /// namespace comments | ||
| namespace Sample | ||
|
|
||
| /// exception comments | ||
| exception MyEx of reason: string | ||
|
|
||
| /// module-level docs | ||
| module Inner = | ||
| /// type-level docs | ||
| type Farts | ||
| /// primary ctor docs | ||
| (name: string) = | ||
| /// constructor-level docs | ||
| new() = Farts("default name") | ||
| /// member-level docs | ||
| member x.blah() = [1;2;3] | ||
| /// auto-property-level docs | ||
| member val Name = name with get, set | ||
|
|
||
| /// module-level binding docs | ||
| let module_member = () | ||
|
|
||
| /// record docs | ||
| type TestRecord = | ||
| { | ||
| /// record field docs | ||
| RecordField: int | ||
| } | ||
| /// record member docs | ||
| member x.Data = 1 | ||
| /// static record member docs | ||
| static member Foo = true | ||
|
|
||
| /// union docs | ||
| type TestUnion = | ||
| /// docs for first case | ||
| | FirstCase of thing: int | ||
| /// union member | ||
| member x.Thing = match x with | FirstCase thing -> thing | ||
| """ | ||
| |> sigShouldBe """namespace Sample | ||
| /// exception comments | ||
| exception MyEx of reason: string | ||
| /// module-level docs | ||
| module Inner = begin | ||
| /// type-level docs | ||
| type Farts = | ||
| /// constructor-level docs | ||
| new : unit -> Farts + 1 overload | ||
| /// member-level docs | ||
| member blah : unit -> int list | ||
| /// auto-property-level docs | ||
| member Name : string | ||
| /// module-level binding docs | ||
| val module_member : unit | ||
| /// record docs | ||
| type TestRecord = | ||
| { /// record field docs | ||
| RecordField: int } | ||
| with | ||
| /// record member docs | ||
| member Data : int | ||
| /// static record member docs | ||
| static member Foo : bool | ||
| end | ||
| /// union docs | ||
| type TestUnion = | ||
| /// docs for first case | ||
| | FirstCase of thing: int | ||
| with | ||
| /// union member | ||
| member Thing : int | ||
| end | ||
| end""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, by default it should be false.