Skip to content

Conversation

jjonescz
Copy link
Member

@jjonescz jjonescz commented Sep 22, 2025

dotnet add app.cs package will now insert #:package directives:

  • After #! directives (first commit)
  • Sorted (second commit)

@jjonescz jjonescz added the Area-run-file Items related to the "dotnet run <file>" effort label Sep 22, 2025
@jjonescz jjonescz requested review from a team and Copilot September 22, 2025 13:58
@jjonescz jjonescz marked this pull request as ready for review September 22, 2025 13:58
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves the placement and ordering of file-level directives in C# script files by handling shebang directives and implementing sorted insertion of named directives.

  • Directives are now placed after shebang (#!) directives to respect script file structure
  • Named directives (like packages) are inserted in alphabetical order for better organization

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Cli/dotnet/Commands/Run/FileBasedAppSourceEditor.cs Implements sorting logic for named directives and shebang handling in directive placement
test/dotnet.Tests/CommandTests/Run/FileBasedAppSourceEditorTests.cs Adds test cases for sorted directive insertion and shebang directive handling

@jjonescz
Copy link
Member Author

@RikkiGibson for a review, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-run-file Items related to the "dotnet run <file>" effort
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants