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 formatting fails #74

Open
ArnoudK opened this issue Jun 19, 2024 · 1 comment
Open

Razor formatting fails #74

ArnoudK opened this issue Jun 19, 2024 · 1 comment

Comments

@ArnoudK
Copy link

ArnoudK commented Jun 19, 2024

When trying to format a .cshtml file the formatting fails with a pop-up that says: "Request to textDocument/formatting failed."
This is the output in 'Razor Log':

[Info  - 4:00:06 PM] Returned 34 semantic tokens for range Microsoft.VisualStudio.LanguageServer.Protocol.Range in file:///home/USER/Code/SOLUTION_NAME/PROJECT_NAME/Areas/Dashboard/Pages/matcher/Creator.cshtml.

Entering method textDocument/foldingRange.

Entering method textDocument/codeAction.

Entering method razor/mapToDocumentRanges.

Entering method razor/mapToDocumentRanges.

Entering method razor/mapToDocumentRanges.

Entering method razor/mapToDocumentRanges.

Entering method razor/mapToDocumentRanges.

Entering method razor/mapToDocumentRanges.

Entering method razor/mapToDocumentRanges.

Entering method razor/mapToDocumentRanges.

Entering method razor/mapToDocumentRanges.

Entering method razor/mapToDocumentRanges.

Entering method razor/mapToDocumentRanges.

Entering method razor/mapToDocumentRanges.

Entering method razor/mapToDocumentRanges.

Entering method razor/mapToDocumentRanges.

Entering method razor/mapToDocumentRanges.

Entering method textDocument/foldingRange.

Entering method textDocument/codeAction.

Entering method textDocument/formatting.

[Error - 4:00:08 PM] [null]

[Error - 4:00:08 PM] Request textDocument/formatting failed.

  Message: Specified argument was out of the range of valid values. (Parameter 'Range end line 23 matches or exceeds SourceText boundary 23.')

  Code: -32000 

[object Object]

When I tried formatting a different cshtml file it also fails. With 140 instead of 23 (the file had 140 lines). So I assume somewhere a check for lines has a off by 1 bug.
Other razor language features seem to work fine.
Dotnet: 8.0.301
Node: v22.2.0
Code OSS: 1.90.1 611f9bfce64f25108829dd295f54a6894e87339d x64
free-vscode-csharp: Last released 2024-06-01

@blipk
Copy link

blipk commented Aug 30, 2024

You could try my version here: https://github.com/blipk/vscodium-csharp/releases/latest

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

No branches or pull requests

2 participants