-
Notifications
You must be signed in to change notification settings - Fork 154
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
Use of the now public Range propery of PreXmlDoc #1128
Conversation
…ty of PreXmlDoc to save resources
if Array.isEmpty d.UnprocessedLines then | ||
None | ||
elif d.UnprocessedLines |> Array.exists (fun s -> s.Contains("<summary>")) then | ||
Some(d.UnprocessedLines, d.Range) | ||
Some(d.UnprocessedLines, xd.Range) |
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.
use xd for consistency
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.
isn't xd.Range
a mistake, xd
is not defined.
The above variable is still defined as d
.
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.
See line 17, xd
is the PreXmlDoc
passed to the function.
else | ||
let lines = | ||
match d.UnprocessedLines with | ||
| [||] -> [| " <summary></summary>" |] | ||
| [| c |] -> [| $" <summary>%s{c.Trim()}</summary>" |] | ||
| cs -> [| yield " <summary>"; yield! cs; yield " </summary>" |] | ||
|
||
Some(lines, d.Range) | ||
Some(lines, xd.Range) |
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.
use xd for consistency
WHAT
🤖 Generated by Copilot at e5b624e
The pull request optimizes the code that handles XML documentation for F# symbols in two files:
AddMissingXmlDocumentation.fs
andConvertTripleSlashCommentToXmlTaggedDoc.fs
. It avoids unnecessary computations and simplifies the access to the range of thePreXmlDoc
nodes.🤖 Generated by Copilot at e5b624e
🚀📝🧹
WHY
Some time ago, the Range property of PreXmlDoc was made public. After updating fsc, we can now make use of it to save resources in some range checks.
HOW
🤖 Generated by Copilot at e5b624e
XmlDoc
by moving it inside theif
branch that checks the position range of thePreXmlDoc
(link, link)xd.Range
instead ofd.Range
inAddMissingXmlDocumentation.fs
andConvertTripleSlashCommentToXmlTaggedDoc.fs
(link, link, link)