You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the end of the line is LF, formatDocument breaks the code and also creates new lines indefinitely.
Steps to Reproduce
Try to format files with LF like the following examples.
@page "/welcome"
<PageTitle>Welcome!</PageTitle>
<h1>Welcome to Blazor!</h1>
@if (true)
{
<p>@message</p>
}@code{privatestringmessage="Hello from a Razor component and welcome to Blazor!";
}
Expected Behavior
Correct formatting
Actual Behavior
Unusable code formatting.
After formatting many times...
Recording.2024-06-07.133116.mp4
Logs
C# log
[LanguageServerHost] [07:42:20.972][End]textDocument/references
[LanguageServerHost] Using C# from request text document
[LanguageServerHost] virtualcsharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs found in workspace Host
[LanguageServerHost] [07:42:21.258][Start]textDocument/codeLens
[LanguageServerHost] [07:42:21.258][End]textDocument/codeLens
[LanguageServerHost] Using C# from request text document
[LanguageServerHost] virtualcsharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs found in workspace Host
[LanguageServerHost] [07:42:21.552][Start]textDocument/references
[LanguageServerHost] [07:42:21.801][Start]textDocument/didChange
[LanguageServerHost] [07:42:21.801][End]textDocument/didChange
[LanguageServerHost] Closing workspace/diagnostics request
[LanguageServerHost] Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.Public.PublicWorkspacePullDiagnosticsHandler finished getting diagnostics
[LanguageServerHost] [07:42:21.823][End]workspace/diagnostic
[LanguageServerHost] [07:42:21.830][Start]textDocument/didChange
[LanguageServerHost] Using C# from request text document
[LanguageServerHost] [07:42:21.830][End]textDocument/didChange
[RazorWorkspaceListener] (ProjectId, #d912f22d-9b3d-4ffc-8107-6cbfb6194622 - Constance.Auth) scheduling task due to workspace event
[RazorWorkspaceListener] (ProjectId, #d912f22d-9b3d-4ffc-8107-6cbfb6194622 - Constance.Auth) scheduling task due to workspace event
[LanguageServerHost] virtualcsharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs found in workspace Host
[LanguageServerHost] [07:42:21.830][Start]textDocument/inlayHint
[LanguageServerHost] [07:42:21.830][End]textDocument/inlayHint
[LanguageServerHost] Closing workspace/diagnostics request
[LanguageServerHost] Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.Public.PublicWorkspacePullDiagnosticsHandler finished getting diagnostics
[LanguageServerHost] [07:42:21.895][End]workspace/diagnostic
[LanguageServerHost] Using C# from request text document
[LanguageServerHost] virtualcsharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs found in workspace Host
[LanguageServerHost] [07:42:21.923][Start]textDocument/semanticTokens/range
[LanguageServerHost] [07:42:21.932][End]textDocument/semanticTokens/range
[LanguageServerHost] Using C# from request text document
[LanguageServerHost] virtualcsharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs found in workspace Host
[LanguageServerHost] [07:42:22.005][Start]textDocument/foldingRange
[LanguageServerHost] [07:42:22.005][End]textDocument/foldingRange
[LanguageServerHost] [07:42:22.053][End]textDocument/references
[LanguageServerHost] Using C# from request text document
[LanguageServerHost] virtualcsharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs found in workspace Host
[LanguageServerHost] [07:42:22.165][Start]textDocument/foldingRange
[LanguageServerHost] [07:42:22.166][End]textDocument/foldingRange
[RazorWorkspaceListener] (ProjectId, #d912f22d-9b3d-4ffc-8107-6cbfb6194622 - Constance.Auth) writing json file
Type: Bug
Issue Description
If the end of the line is LF,
formatDocument
breaks the code and also creates new lines indefinitely.Steps to Reproduce
Try to format files with LF like the following examples.
Expected Behavior
Correct formatting
Actual Behavior
Unusable code formatting.
After formatting many times...
Recording.2024-06-07.133116.mp4
Logs
C# log
C# LSP Trace Logs
Environment information
VSCode version: 1.90.0
C# Extension: 2.31.19
Using OmniSharp: false
Dotnet Information
.NET SDK: Version: 8.0.301 Commit: 1a0e9c0300 Workload version: 8.0.300-manifests.9e3391ed MSBuild version: 17.10.4+10fbfbf2eRuntime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.301\
.NET workloads installed:
There are no installed workloads to display.
Host:
Version: 8.0.6
Architecture: x64
Commit: 3b8b000a0e
.NET SDKs installed:
8.0.106 [C:\Program Files\dotnet\sdk]
8.0.206 [C:\Program Files\dotnet\sdk]
8.0.300 [C:\Program Files\dotnet\sdk]
8.0.301 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.31 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.31 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
Visual Studio Code Extensions
Extension version: 2.31.19
VS Code version: Code 1.90.0 (89de5a8d4d6205e5b11647eb6a74844ca23d2573, 2024-06-04T19:33:54.889Z)
OS version: Windows_NT x64 10.0.22631
Modes:
System Info
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
A/B Experiments
The text was updated successfully, but these errors were encountered: