-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Allow Razor to format a new document it wants to create #69878
Merged
davidwengier
merged 2 commits into
dotnet:main
from
davidwengier:RazorNewDocumentFormat
Sep 14, 2023
Merged
Allow Razor to format a new document it wants to create #69878
davidwengier
merged 2 commits into
dotnet:main
from
davidwengier:RazorNewDocumentFormat
Sep 14, 2023
Conversation
This file contains 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
dotnet-issue-labeler
bot
added
Area-IDE
untriaged
Issues and PRs which have not yet been triaged by a lead
labels
Sep 11, 2023
This was referenced Sep 11, 2023
3 tasks
src/Features/LanguageServer/Protocol/ExternalAccess/Razor/FormatNewFileHandler.cs
Outdated
Show resolved
Hide resolved
src/Features/LanguageServer/Protocol/ExternalAccess/Razor/FormatNewFileHandler.cs
Outdated
Show resolved
Hide resolved
src/Features/LanguageServer/Protocol/ExternalAccess/Razor/FormatNewFileParams.cs
Outdated
Show resolved
Hide resolved
src/Features/LanguageServer/Protocol/ExternalAccess/Razor/FormatNewFileParams.cs
Outdated
Show resolved
Hide resolved
CyrusNajmabadi
approved these changes
Sep 14, 2023
ghost
added this to the Next milestone
Sep 14, 2023
davidwengier
added a commit
to dotnet/razor
that referenced
this pull request
Sep 14, 2023
Fixes #4330 Fixes #8766 Includes #9262 so just review from 8a2b8af onwards Goes with dotnet/roslyn#69878 and dotnet/vscode-csharp#6329 I logged #9264 to follow up with a better test, though strictly speaking the one I've added id exhaustive :) Behaviour of Extract to Code Behind before this change. Note the many using statements and block scoped namespace. ![ExtractToCodeBehindBefore](https://github.com/dotnet/razor/assets/754264/10ac5595-b3b2-44c2-a1a7-66664d3c8f1b) Behaviour after this change. Note the file scoped namespace, and file header. ![ExtractToCodeBehindAfter](https://github.com/dotnet/razor/assets/754264/65160715-bc98-4336-b19d-37f9b14adf94) The squiggle on `NavigationManager` is due to an `.editorconfig` rule I have on in that project, requiring `this.` qualification, so is unrelated.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Part of dotnet/razor#4330
Goes with dotnet/razor#9263 and dotnet/vscode-csharp#6329
Adds a custom endpoint so Razor can get access to the
INewDocumentFormattingService
, as well as remove and sort usings, and format the new document with the current C# format options.