-
-
Notifications
You must be signed in to change notification settings - Fork 190
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
Shebang directives get removed from scripts #2367
Comments
Hello, thank you for raising this. The shebang is currently captured as a code comment but is not restored correctly. This is due to an assumption that all non-block code comments start with fantomas/src/Fantomas.Core/Trivia.fs Lines 80 to 93 in 452064c
would need to be something like | CommentTrivia.LineComment r ->
let content = source.GetContentAt r
let line = source.GetLineString(r.StartLine - 1)
let item =
let trimmedLine = line.TrimStart(' ', ';')
Comment(
if trimmedLine.StartsWith("//") || trimmedLine.StartsWith("#!") then
CommentOnSingleLine content
else
LineCommentAfterSourceCode content
)
{ Item = item; Range = r }) Are you interested in submitting a PR for this one? |
Sure; in fact I was writing a comment asking where to start, as I'd imagine starting with modifying hash regex wouldn't cut it. |
We probably even no longer need that hash regex. |
Issue created from fantomas-online
Code
Result
Problem description
See fsharp/fslang-design#683.
Extra information
Options
Fantomas master branch at 2022-07-15T14:30:45Z - 87cd212
Did you know that you can ignore files when formatting from fantomas-tool or the FAKE targets by using a .fantomasignore file?
The text was updated successfully, but these errors were encountered: