Skip to content
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

Razor code formatting is unusable when the end of line is LF #10466

Closed
Eptagone opened this issue Jun 7, 2024 · 1 comment · Fixed by #10802
Closed

Razor code formatting is unusable when the end of line is LF #10466

Eptagone opened this issue Jun 7, 2024 · 1 comment · Fixed by #10802
Assignees
Milestone

Comments

@Eptagone
Copy link

Eptagone commented Jun 7, 2024

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.

@page "/welcome"

<PageTitle>Welcome!</PageTitle>

<h1>Welcome to Blazor!</h1>

@if (true)
{
    <p>@message</p>
}

@code {
    private string message =
        "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

C# LSP Trace Logs

[Trace - 1:42:20 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] [07:42:20.972][End]textDocument/references"
}


[Trace - 1:42:21 PM] Sending request 'textDocument/codeLens - (1102)'.
Params: {
    "textDocument": {
        "uri": "virtualCSharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs"
    }
}


[Trace - 1:42:21 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] Using C# from request text document"
}


[Trace - 1:42:21 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] virtualcsharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs found in workspace Host"
}


[Trace - 1:42:21 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] [07:42:21.258][Start]textDocument/codeLens"
}


[Trace - 1:42:21 PM] Received response 'textDocument/codeLens - (1102)' in 4ms.
Result: [
    {
        "range": {
            "start": {
                "line": 69,
                "character": 25
            },
            "end": {
                "line": 69,
                "character": 32
            }
        },
        "data": {
            "SyntaxVersion": "2024-06-07T19:42:17.3629592Z-10721-0",
            "ListIndex": 0,
            "TextDocument": {
                "uri": "virtualcsharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs"
            }
        }
    },
    {
        "range": {
            "start": {
                "line": 73,
                "character": 21
            },
            "end": {
                "line": 73,
                "character": 51
            }
        },
        "data": {
            "SyntaxVersion": "2024-06-07T19:42:17.3629592Z-10721-0",
            "ListIndex": 1,
            "TextDocument": {
                "uri": "virtualcsharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs"
            }
        }
    },
    {
        "range": {
            "start": {
                "line": 88,
                "character": 30
            },
            "end": {
                "line": 88,
                "character": 33
            }
        },
        "data": {
            "SyntaxVersion": "2024-06-07T19:42:17.3629592Z-10721-0",
            "ListIndex": 2,
            "TextDocument": {
                "uri": "virtualcsharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs"
            }
        }
    },
    {
        "range": {
            "start": {
                "line": 91,
                "character": 32
            },
            "end": {
                "line": 91,
                "character": 47
            }
        },
        "data": {
            "SyntaxVersion": "2024-06-07T19:42:17.3629592Z-10721-0",
            "ListIndex": 3,
            "TextDocument": {
                "uri": "virtualcsharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs"
            }
        }
    },
    {
        "range": {
            "start": {
                "line": 132,
                "character": 19
            },
            "end": {
                "line": 132,
                "character": 26
            }
        },
        "data": {
            "SyntaxVersion": "2024-06-07T19:42:17.3629592Z-10721-0",
            "ListIndex": 4,
            "TextDocument": {
                "uri": "virtualcsharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs"
            }
        }
    }
]


[Trace - 1:42:21 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] [07:42:21.258][End]textDocument/codeLens"
}


[Trace - 1:42:21 PM] Sending request 'textDocument/references - (1103)'.
Params: {
    "textDocument": {
        "uri": "virtualCSharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs"
    },
    "position": {
        "line": 132,
        "character": 19
    },
    "context": {
        "includeDeclaration": true
    }
}


[Trace - 1:42:21 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] Using C# from request text document"
}


[Trace - 1:42:21 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] virtualcsharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs found in workspace Host"
}


[Trace - 1:42:21 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] [07:42:21.552][Start]textDocument/references"
}


[Trace - 1:42:21 PM] Sending notification 'textDocument/didChange'.
Params: {
    "textDocument": {
        "uri": "file:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor",
        "version": 8
    },
    "contentChanges": [
        {
            "range": {
                "start": {
                    "line": 13,
                    "character": 0
                },
                "end": {
                    "line": 13,
                    "character": 4
                }
            },
            "rangeLength": 4,
            "text": ""
        },
        {
            "range": {
                "start": {
                    "line": 12,
                    "character": 28
                },
                "end": {
                    "line": 12,
                    "character": 28
                }
            },
            "rangeLength": 0,
            "text": "\n"
        },
        {
            "range": {
                "start": {
                    "line": 6,
                    "character": 10
                },
                "end": {
                    "line": 6,
                    "character": 10
                }
            },
            "rangeLength": 0,
            "text": "\n"
        }
    ]
}


[Trace - 1:42:21 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] [07:42:21.801][Start]textDocument/didChange"
}


[Trace - 1:42:21 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] [07:42:21.801][End]textDocument/didChange"
}


[Trace - 1:42:21 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] Closing workspace/diagnostics request"
}


[Trace - 1:42:21 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.Public.PublicWorkspacePullDiagnosticsHandler finished getting diagnostics"
}


[Trace - 1:42:21 PM] Received response 'workspace/diagnostic - (1094)' in 2498ms.
Result: {
    "items": []
}


[Trace - 1:42:21 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] [07:42:21.823][End]workspace/diagnostic"
}


[Trace - 1:42:21 PM] Sending notification 'textDocument/didChange'.
Params: {
    "textDocument": {
        "uri": "virtualCSharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs",
        "version": 4
    },
    "contentChanges": [
        {
            "range": {
                "start": {
                    "line": 142,
                    "character": 3
                },
                "end": {
                    "line": 142,
                    "character": 4
                }
            },
            "rangeLength": 1,
            "text": "8"
        },
        {
            "range": {
                "start": {
                    "line": 133,
                    "character": 0
                },
                "end": {
                    "line": 133,
                    "character": 4
                }
            },
            "rangeLength": 4,
            "text": ""
        },
        {
            "range": {
                "start": {
                    "line": 132,
                    "character": 28
                },
                "end": {
                    "line": 132,
                    "character": 28
                }
            },
            "rangeLength": 0,
            "text": "\r\n"
        },
        {
            "range": {
                "start": {
                    "line": 130,
                    "character": 7
                },
                "end": {
                    "line": 130,
                    "character": 8
                }
            },
            "rangeLength": 1,
            "text": "3"
        },
        {
            "range": {
                "start": {
                    "line": 120,
                    "character": 6
                },
                "end": {
                    "line": 120,
                    "character": 7
                }
            },
            "rangeLength": 1,
            "text": "10"
        },
        {
            "range": {
                "start": {
                    "line": 113,
                    "character": 6
                },
                "end": {
                    "line": 113,
                    "character": 7
                }
            },
            "rangeLength": 1,
            "text": "10"
        },
        {
            "range": {
                "start": {
                    "line": 106,
                    "character": 0
                },
                "end": {
                    "line": 106,
                    "character": 0
                }
            },
            "rangeLength": 0,
            "text": "\r\n"
        }
    ]
}


[Trace - 1:42:21 PM] Sending request 'textDocument/inlayHint - (1104)'.
Params: {
    "textDocument": {
        "uri": "virtualCSharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs"
    },
    "range": {
        "start": {
            "line": 78,
            "character": 37
        },
        "end": {
            "line": 136,
            "character": 0
        }
    }
}


[Trace - 1:42:21 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] [07:42:21.830][Start]textDocument/didChange"
}


[Trace - 1:42:21 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] Using C# from request text document"
}


[Trace - 1:42:21 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] [07:42:21.830][End]textDocument/didChange"
}


[Trace - 1:42:21 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[RazorWorkspaceListener] (ProjectId, #d912f22d-9b3d-4ffc-8107-6cbfb6194622 - Constance.Auth) scheduling task due to workspace event"
}


[Trace - 1:42:21 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[RazorWorkspaceListener] (ProjectId, #d912f22d-9b3d-4ffc-8107-6cbfb6194622 - Constance.Auth) scheduling task due to workspace event"
}


[Trace - 1:42:21 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] virtualcsharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs found in workspace Host"
}


[Trace - 1:42:21 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] [07:42:21.830][Start]textDocument/inlayHint"
}


[Trace - 1:42:21 PM] Received response 'textDocument/inlayHint - (1104)' in 3ms.
Result: []


[Trace - 1:42:21 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] [07:42:21.830][End]textDocument/inlayHint"
}


[Trace - 1:42:21 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] Closing workspace/diagnostics request"
}


[Trace - 1:42:21 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics.Public.PublicWorkspacePullDiagnosticsHandler finished getting diagnostics"
}


[Trace - 1:42:21 PM] Received response 'workspace/diagnostic - (1092)' in 2597ms.
Result: {
    "items": []
}


[Trace - 1:42:21 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] [07:42:21.895][End]workspace/diagnostic"
}


[Trace - 1:42:21 PM] Sending request 'textDocument/semanticTokens/range - (1105)'.
Params: {
    "textDocument": {
        "uri": "virtualCSharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs"
    },
    "range": {
        "start": {
            "line": 78,
            "character": 37
        },
        "end": {
            "line": 136,
            "character": 0
        }
    }
}


[Trace - 1:42:21 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] Using C# from request text document"
}


[Trace - 1:42:21 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] virtualcsharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs found in workspace Host"
}


[Trace - 1:42:21 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] [07:42:21.923][Start]textDocument/semanticTokens/range"
}


[Trace - 1:42:21 PM] Received response 'textDocument/semanticTokens/range - (1105)' in 18ms.
Result: {
    "data": [
        78,
        37,
        10,
        18,
        0,
        0,
        10,
        1,
        43,
        0,
        2,
        0,
        1,
        14,
        0,
        0,
        1,
        4,
        14,
        0,
        0,
        5,
        7,
        14,
        0,
        1,
        0,
        1,
        14,
        0,
        0,
        1,
        4,
        14,
        0,
        0,
        5,
        6,
        14,
        0,
        1,
        0,
        1,
        14,
        0,
        0,
        1,
        8,
        14,
        0,
        0,
        9,
        7,
        14,
        0,
        1,
        8,
        1,
        43,
        0,
        1,
        8,
        1,
        43,
        0,
        0,
        1,
        1,
        43,
        0,
        0,
        1,
        1,
        43,
        0,
        0,
        1,
        1,
        43,
        0,
        0,
        1,
        1,
        43,
        0,
        1,
        8,
        1,
        43,
        0,
        1,
        8,
        1,
        14,
        0,
        0,
        1,
        6,
        14,
        0,
        0,
        7,
        7,
        14,
        0,
        0,
        8,
        7,
        14,
        0,
        0,
        8,
        3,
        19,
        0,
        1,
        8,
        1,
        14,
        0,
        0,
        1,
        6,
        14,
        0,
        0,
        7,
        7,
        14,
        0,
        0,
        8,
        7,
        14,
        0,
        0,
        8,
        4,
        19,
        0,
        1,
        8,
        7,
        15,
        0,
        0,
        8,
        6,
        15,
        0,
        0,
        7,
        6,
        15,
        0,
        0,
        7,
        3,
        27,
        1,
        0,
        4,
        1,
        21,
        0,
        0,
        2,
        4,
        15,
        0,
        0,
        4,
        1,
        43,
        0,
        1,
        8,
        1,
        14,
        0,
        0,
        1,
        6,
        14,
        0,
        0,
        7,
        7,
        14,
        0,
        0,
        8,
        7,
        14,
        0,
        0,
        8,
        4,
        19,
        0,
        1,
        8,
        1,
        14,
        0,
        0,
        1,
        6,
        14,
        0,
        0,
        7,
        7,
        14,
        0,
        0,
        8,
        7,
        14,
        0,
        0,
        8,
        4,
        19,
        0,
        1,
        8,
        9,
        15,
        0,
        0,
        10,
        8,
        15,
        0,
        0,
        9,
        4,
        15,
        0,
        0,
        5,
        15,
        13,
        0,
        0,
        15,
        1,
        43,
        0,
        0,
        1,
        6,
        15,
        0,
        0,
        6,
        2,
        21,
        0,
        0,
        2,
        9,
        0,
        0,
        0,
        9,
        1,
        21,
        0,
        0,
        1,
        10,
        0,
        0,
        0,
        10,
        1,
        21,
        0,
        0,
        1,
        10,
        0,
        0,
        0,
        10,
        1,
        21,
        0,
        0,
        1,
        9,
        0,
        0,
        0,
        9,
        1,
        21,
        0,
        0,
        1,
        17,
        2,
        0,
        0,
        18,
        9,
        7,
        0,
        0,
        9,
        1,
        43,
        0,
        1,
        8,
        1,
        43,
        0,
        1,
        12,
        9,
        7,
        0,
        0,
        9,
        1,
        21,
        0,
        0,
        1,
        12,
        13,
        0,
        0,
        12,
        1,
        43,
        0,
        0,
        1,
        1,
        21,
        0,
        0,
        1,
        1,
        19,
        0,
        0,
        1,
        1,
        43,
        0,
        0,
        2,
        14,
        18,
        0,
        0,
        14,
        1,
        43,
        0,
        0,
        2,
        1,
        43,
        0,
        0,
        1,
        6,
        15,
        0,
        0,
        6,
        2,
        21,
        0,
        0,
        2,
        9,
        0,
        0,
        0,
        9,
        1,
        21,
        0,
        0,
        1,
        10,
        0,
        0,
        0,
        10,
        1,
        21,
        0,
        0,
        1,
        10,
        0,
        0,
        0,
        10,
        1,
        21,
        0,
        0,
        1,
        14,
        24,
        0,
        0,
        14,
        1,
        43,
        0,
        0,
        1,
        1,
        43,
        0,
        0,
        1,
        1,
        43,
        0,
        0,
        1,
        10,
        7,
        0,
        0,
        10,
        1,
        43,
        0,
        0,
        2,
        2,
        21,
        0,
        0,
        3,
        1,
        43,
        0,
        1,
        12,
        1,
        43,
        0,
        1,
        12,
        1,
        43,
        0,
        0,
        1,
        1,
        43,
        0,
        0,
        1,
        1,
        43,
        0,
        1,
        0,
        1,
        14,
        0,
        0,
        1,
        8,
        14,
        0,
        0,
        9,
        7,
        14,
        0,
        1,
        0,
        1,
        14,
        0,
        0,
        1,
        4,
        14,
        0,
        0,
        5,
        1,
        19,
        0,
        0,
        2,
        89,
        18,
        0,
        1,
        0,
        3,
        27,
        1,
        0,
        4,
        1,
        21,
        0,
        0,
        2,
        6,
        15,
        0,
        0,
        6,
        1,
        43,
        0,
        0,
        1,
        6,
        15,
        0,
        0,
        6,
        2,
        21,
        0,
        0,
        2,
        9,
        0,
        0,
        0,
        9,
        1,
        21,
        0,
        0,
        1,
        10,
        0,
        0,
        0,
        10,
        1,
        21,
        0,
        0,
        1,
        10,
        0,
        0,
        0,
        10,
        1,
        21,
        0,
        0,
        1,
        3,
        0,
        0,
        0,
        3,
        1,
        21,
        0,
        0,
        1,
        9,
        2,
        0,
        0,
        9,
        1,
        43,
        0,
        0,
        1,
        1,
        43,
        0,
        2,
        0,
        1,
        14,
        0,
        0,
        1,
        4,
        14,
        0,
        0,
        5,
        7,
        14,
        0,
        1,
        0,
        1,
        14,
        0,
        0,
        1,
        4,
        14,
        0,
        0,
        5,
        6,
        14,
        0,
        1,
        0,
        1,
        14,
        0,
        0,
        1,
        8,
        14,
        0,
        0,
        9,
        7,
        14,
        0,
        1,
        0,
        1,
        14,
        0,
        0,
        1,
        8,
        14,
        0,
        0,
        9,
        7,
        14,
        0,
        1,
        0,
        1,
        14,
        0,
        0,
        1,
        4,
        14,
        0,
        0,
        5,
        1,
        19,
        0,
        0,
        2,
        89,
        18,
        0,
        1,
        1,
        2,
        23,
        0,
        0,
        3,
        1,
        43,
        0,
        0,
        1,
        4,
        15,
        0,
        0,
        4,
        1,
        43,
        0,
        2,
        0,
        1,
        43,
        0,
        3,
        0,
        1,
        14,
        0,
        0,
        1,
        4,
        14,
        0,
        0,
        5,
        7,
        14,
        0,
        1,
        0,
        1,
        14,
        0,
        0,
        1,
        4,
        14,
        0,
        0,
        5,
        6,
        14,
        0,
        1,
        0,
        1,
        14,
        0,
        0,
        1,
        8,
        14,
        0,
        0,
        9,
        7,
        14,
        0,
        1,
        0,
        1,
        14,
        0,
        0,
        1,
        8,
        14,
        0,
        0,
        9,
        7,
        14,
        0,
        1,
        0,
        1,
        14,
        0,
        0,
        1,
        4,
        14,
        0,
        0,
        5,
        2,
        19,
        0,
        0,
        3,
        89,
        18,
        0,
        1,
        2,
        3,
        27,
        1,
        0,
        4,
        1,
        21,
        0,
        0,
        2,
        7,
        27,
        0,
        0,
        7,
        1,
        43,
        0,
        2,
        0,
        1,
        14,
        0,
        0,
        1,
        4,
        14,
        0,
        0,
        5,
        7,
        14,
        0,
        1,
        0,
        1,
        14,
        0,
        0,
        1,
        4,
        14,
        0,
        0,
        5,
        6,
        14,
        0,
        1,
        0,
        1,
        14,
        0,
        0,
        1,
        8,
        14,
        0,
        0,
        9,
        7,
        14,
        0,
        1,
        0,
        1,
        14,
        0,
        0,
        1,
        8,
        14,
        0,
        0,
        9,
        7,
        14,
        0,
        1,
        0,
        1,
        14,
        0,
        0,
        1,
        4,
        14,
        0,
        0,
        5,
        2,
        19,
        0,
        0,
        3,
        89,
        18,
        0,
        2,
        0,
        1,
        43,
        0,
        2,
        0,
        1,
        14,
        0,
        0,
        1,
        4,
        14,
        0,
        0,
        5,
        7,
        14,
        0,
        1,
        0,
        1,
        14,
        0,
        0,
        1,
        4,
        14,
        0,
        0,
        5,
        6,
        14,
        0,
        1,
        0,
        1,
        14,
        0,
        0,
        1,
        8,
        14,
        0,
        0,
        9,
        7,
        14,
        0,
        1,
        8,
        1,
        43,
        0,
        1,
        8,
        1,
        14,
        0,
        0,
        1,
        6,
        14,
        0,
        0,
        7,
        7,
        14,
        0,
        0,
        8,
        7,
        14,
        0,
        0,
        8,
        4,
        19,
        0,
        1,
        0,
        1,
        14,
        0,
        0,
        1,
        8,
        14,
        0,
        0,
        9,
        7,
        14,
        0,
        1,
        0,
        1,
        14,
        0,
        0,
        1,
        4,
        14,
        0,
        0,
        5,
        2,
        19,
        0,
        0,
        3,
        89,
        18,
        0,
        2,
        4,
        7,
        15,
        0,
        0,
        8,
        6,
        15,
        0,
        0,
        7,
        7,
        27,
        0,
        0,
        8,
        1,
        21,
        0,
        2,
        4,
        53,
        18,
        0,
        0,
        53,
        1,
        43,
        0
    ]
}


[Trace - 1:42:21 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] [07:42:21.932][End]textDocument/semanticTokens/range"
}


[Trace - 1:42:22 PM] Sending request 'textDocument/foldingRange - (1106)'.
Params: {
    "textDocument": {
        "uri": "virtualCSharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs"
    }
}


[Trace - 1:42:22 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] Using C# from request text document"
}


[Trace - 1:42:22 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] virtualcsharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs found in workspace Host"
}


[Trace - 1:42:22 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] [07:42:22.005][Start]textDocument/foldingRange"
}


[Trace - 1:42:22 PM] Received response 'textDocument/foldingRange - (1106)' in 2ms.
Result: [
    {
        "startLine": 105,
        "startCharacter": 10,
        "endLine": 123,
        "endCharacter": 1,
        "collapsedText": "..."
    },
    {
        "startLine": 93,
        "startCharacter": 128,
        "endLine": 94,
        "endCharacter": 13,
        "collapsedText": "..."
    },
    {
        "startLine": 91,
        "startCharacter": 126,
        "endLine": 128,
        "endCharacter": 9,
        "collapsedText": "..."
    },
    {
        "startLine": 74,
        "startCharacter": 39,
        "endLine": 83,
        "endCharacter": 9,
        "collapsedText": "..."
    },
    {
        "startLine": 73,
        "startCharacter": 54,
        "endLine": 85,
        "endCharacter": 9,
        "collapsedText": "..."
    },
    {
        "startLine": 69,
        "startCharacter": 33,
        "endLine": 140,
        "endCharacter": 5,
        "collapsedText": "..."
    },
    {
        "startLine": 5,
        "startCharacter": 10,
        "endLine": 62,
        "endCharacter": 22,
        "kind": "imports",
        "collapsedText": "..."
    },
    {
        "startLine": 2,
        "startCharacter": 41,
        "endLine": 141,
        "endCharacter": 1,
        "collapsedText": "..."
    }
]


[Trace - 1:42:22 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] [07:42:22.005][End]textDocument/foldingRange"
}


[Trace - 1:42:22 PM] Received response 'textDocument/references - (1103)' in 503ms.
Result: [
    {
        "uri": "virtualcsharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs",
        "range": {
            "start": {
                "line": 132,
                "character": 19
            },
            "end": {
                "line": 132,
                "character": 26
            }
        }
    },
    {
        "uri": "virtualcsharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs",
        "range": {
            "start": {
                "line": 114,
                "character": 8
            },
            "end": {
                "line": 114,
                "character": 15
            }
        }
    }
]


[Trace - 1:42:22 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] [07:42:22.053][End]textDocument/references"
}


[Trace - 1:42:22 PM] Sending request 'textDocument/foldingRange - (1107)'.
Params: {
    "textDocument": {
        "uri": "virtualCSharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs"
    }
}


[Trace - 1:42:22 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] Using C# from request text document"
}


[Trace - 1:42:22 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] virtualcsharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs found in workspace Host"
}


[Trace - 1:42:22 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] [07:42:22.165][Start]textDocument/foldingRange"
}


[Trace - 1:42:22 PM] Received response 'textDocument/foldingRange - (1107)' in 3ms.
Result: [
    {
        "startLine": 105,
        "startCharacter": 10,
        "endLine": 123,
        "endCharacter": 1,
        "collapsedText": "..."
    },
    {
        "startLine": 93,
        "startCharacter": 128,
        "endLine": 94,
        "endCharacter": 13,
        "collapsedText": "..."
    },
    {
        "startLine": 91,
        "startCharacter": 126,
        "endLine": 128,
        "endCharacter": 9,
        "collapsedText": "..."
    },
    {
        "startLine": 74,
        "startCharacter": 39,
        "endLine": 83,
        "endCharacter": 9,
        "collapsedText": "..."
    },
    {
        "startLine": 73,
        "startCharacter": 54,
        "endLine": 85,
        "endCharacter": 9,
        "collapsedText": "..."
    },
    {
        "startLine": 69,
        "startCharacter": 33,
        "endLine": 140,
        "endCharacter": 5,
        "collapsedText": "..."
    },
    {
        "startLine": 5,
        "startCharacter": 10,
        "endLine": 62,
        "endCharacter": 22,
        "kind": "imports",
        "collapsedText": "..."
    },
    {
        "startLine": 2,
        "startCharacter": 41,
        "endLine": 141,
        "endCharacter": 1,
        "collapsedText": "..."
    }
]


[Trace - 1:42:22 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] [07:42:22.166][End]textDocument/foldingRange"
}


[Trace - 1:42:22 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[RazorWorkspaceListener] (ProjectId, #d912f22d-9b3d-4ffc-8107-6cbfb6194622 - Constance.Auth) writing json file"
}


[Trace - 1:42:22 PM] Sending request 'textDocument/codeLens - (1108)'.
Params: {
    "textDocument": {
        "uri": "virtualCSharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs"
    }
}


[Trace - 1:42:22 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] Using C# from request text document"
}


[Trace - 1:42:22 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "[LanguageServerHost] virtualcsharp-razor:///c:/Users/eptadot/source/repos/Constance/src/Backend/Auth/Components/Pages/Welcome.razor__virtual.cs found in workspace Host"
}

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+10fbfbf2e

Runtime 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 Author Version Folder Name
better-comments aaron-bond 3.0.2 aaron-bond.better-comments-3.0.2
codeium Codeium 1.8.54 codeium.codeium-1.8.54
csdevkit ms-dotnettools 1.6.8 ms-dotnettools.csdevkit-1.6.8-win32-x64
csharp ms-dotnettools 2.31.19 ms-dotnettools.csharp-2.31.19-win32-x64
csharpier-vscode csharpier 1.7.2 csharpier.csharpier-vscode-1.7.2
dotnet-interactive-vscode ms-dotnettools 1.0.5229040 ms-dotnettools.dotnet-interactive-vscode-1.0.5229040
github-vscode-theme GitHub 6.3.4 github.github-vscode-theme-6.3.4
gitlens eamodio 15.0.4 eamodio.gitlens-15.0.4
jupyter ms-toolsai 2024.5.0 ms-toolsai.jupyter-2024.5.0-win32-x64
jupyter-keymap ms-toolsai 1.1.2 ms-toolsai.jupyter-keymap-1.1.2
jupyter-renderers ms-toolsai 1.0.18 ms-toolsai.jupyter-renderers-1.0.18
localstack LocalStack 0.1.1 localstack.localstack-0.1.1
markdown-all-in-one yzhang 3.6.2 yzhang.markdown-all-in-one-3.6.2
minifyall josee9988 2.10.0 josee9988.minifyall-2.10.0
npm-outdated mskelton 2.2.0 mskelton.npm-outdated-2.2.0
powershell ms-vscode 2024.2.2 ms-vscode.powershell-2024.2.2
rainbow-csv mechatroner 3.12.0 mechatroner.rainbow-csv-3.12.0
remote-containers ms-vscode-remote 0.369.0 ms-vscode-remote.remote-containers-0.369.0
remote-explorer ms-vscode 0.4.3 ms-vscode.remote-explorer-0.4.3
remote-server ms-vscode 1.5.1 ms-vscode.remote-server-1.5.1
remote-ssh ms-vscode-remote 0.110.1 ms-vscode-remote.remote-ssh-0.110.1
remote-ssh-edit ms-vscode-remote 0.86.0 ms-vscode-remote.remote-ssh-edit-0.86.0
remote-wsl ms-vscode-remote 0.88.2 ms-vscode-remote.remote-wsl-0.88.2
vscode-docker ms-azuretools 1.29.1 ms-azuretools.vscode-docker-1.29.1
vscode-dotnet-runtime ms-dotnettools 2.0.5 ms-dotnettools.vscode-dotnet-runtime-2.0.5
vscode-eslint dbaeumer 2.4.4 dbaeumer.vscode-eslint-2.4.4
vscode-jupyter-cell-tags ms-toolsai 0.1.9 ms-toolsai.vscode-jupyter-cell-tags-0.1.9
vscode-jupyter-slideshow ms-toolsai 0.1.6 ms-toolsai.vscode-jupyter-slideshow-0.1.6
vscode-native-svg-preview sndst00m 1.72.0 sndst00m.vscode-native-svg-preview-1.72.0
vscode-nginx-conf ahmadalli 0.3.5 ahmadalli.vscode-nginx-conf-0.3.5
vscode-remote-extensionpack ms-vscode-remote 0.25.0 ms-vscode-remote.vscode-remote-extensionpack-0.25.0
vscode-tailwindcss bradlc 0.10.5 bradlc.vscode-tailwindcss-0.10.5
vscode-xml redhat 0.27.1 redhat.vscode-xml-0.27.1-win32-x64

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
Item Value
CPUs Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz (8 x 3592)
GPU Status 2d_canvas: enabled
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
Load (avg) undefined
Memory (System) 15.95GB (3.53GB free)
Process Argv --folder-uri file:///c%3A/Users/eptadot/source/repos/Constance --crash-reporter-id 36806f99-ba1b-47c8-9032-c5d3dd4e6cfc
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscorecescf:30445987
vscod805:30301674
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
vscrp:30673768
a9j8j154:30646983
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pythonmypyd1:30879173
pythoncet0:30885854
h48ei257:31000450
pythontbext0:30879054
accentitlementst:30995554
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
jchc7451:31067544
chatpanelc:31048052
dsvsc021:30996838
9c06g630:31013171
pythoncenvpt:31062603
a69g1124:31058053
dvdeprecation:31068756
pythonprt:31056678
dwnewjupyter:31046869
26j00206:31048877

@dibarbet dibarbet transferred this issue from dotnet/vscode-csharp Jun 10, 2024
@ryzngard ryzngard added this to the Backlog milestone Jun 11, 2024
@fatTony1024
Copy link

Same here, I change form LF to CRLF and the document then formats correctly, otherwise it keeps inserting linefeeds.
This only seem to happen on files I got from an online repository not my code file.
I loaded this Project -
https://github.com/PacktPublishing/Web-Development-with-Blazor-Third-Edition/tree/main/Chapter06/MyBlog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants