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 ist not working with any constellation of extensions #9292

Open
Kokujou opened this issue Sep 15, 2023 · 6 comments
Open

Razor ist not working with any constellation of extensions #9292

Kokujou opened this issue Sep 15, 2023 · 6 comments
Labels

Comments

@Kokujou
Copy link

Kokujou commented Sep 15, 2023

I'm sorry this report is going to be messy because i don't even know where to start...

i played around with preview versions and omnisharp on/off and stuff and here are some things i noticed:

  1. global razor-usings are not being considered - (_imports.razor @using directive)
  2. html tags are shown as red but you can navigate
  3. c# properties are shown as strings but can also be navigated with
  4. razor injects are not detected in c# code resulting in a pseudo-error (compiling works)
  5. formatting is broken (Request textDocument/formatting failed.
    Message: Specified argument was out of the range of valid values. (Parameter 'Range end line 43 matches or exceeds SourceText boundary 43.')

i'm using blazor with .razor pages and codebehind, i also have both razor and c# global imports.

so if anyone got this to work like expected, please tell me what configuration you used so i can get it too

@ghost ghost added the untriaged label Sep 15, 2023
@davidwengier
Copy link
Member

davidwengier commented Sep 15, 2023

Thanks for the report @Kokujou. Could you let us know what version of the C# extension you're using, and whehter you have the C# Dev Kit installed too?

The red component tags was fixed in dotnet/vscode-csharp#6304 but I'm not sure if that has been released in a version yet.

If you can include the contents of the Razor Log output it might help us track down what is going on, and should also tell us which Razor server version you have.

@Kokujou
Copy link
Author

Kokujou commented Sep 15, 2023

i used multiple and i also tried the c# dev kit, both in the current release version and the pre-release version
so this would be:
C# 2.1.2 + 2.1.10
C# Dev Kit 0.4.10 + 0.5.47

the only part in the razor logs that seemed relevant to me is the formatting error that i already quoted:
Parameter 'Range end line 43 matches or exceeds SourceText boundary 43.')

@phil-allen-msft phil-allen-msft added this to the 17.8 Planning milestone Sep 20, 2023
@ghost ghost removed the untriaged label Sep 20, 2023
@allisonchou
Copy link
Contributor

@Kokujou does this happen in every Blazor project you work with, or just a particular one? Are there any repro steps you can share to help diagnose issues, and/or a sample project you can provide us?

@Kokujou
Copy link
Author

Kokujou commented Oct 3, 2023

yeah the issue is in every razor project i work on. I think it's quite hard to overlook but of course you need a global _Imports.razor file.
i mean we do use mudblazor in our project but this is probably quite unrelated. i also tried using completely empty files to format and got the same formatting error

take this here for example
grafik
you see this is actually a property. but first of all ScrollBottom is not marked as a property and second of all, the content is also not marked as c#-code.

i mean if you know how to not reproduce it i would be eager to know ^^ i wonder if it's maybe some c# - razor mixture is not properly detected and therefore breaks all following code or so

btw i do have a second project that i could hypothetically share, but it's only half-done and uses blazor in WPF scope, so i don't even know if this is inside your specifications, and in this project formatting doesn't even get applied, no error, no nothing. and OmniSharp complains about some Windows Forms stuff not being found. (works in Visual Studio of course). i mean it's a language formatter and shouldn't have that much to do with what the wrapper is, but you never know.

@ghost ghost added untriaged and removed needs more info labels Oct 3, 2023
@allisonchou
Copy link
Contributor

Thanks for the information @Kokujou! I believe colorization issues you're seeing are another instance of #9336. I'll see if we can get that work scheduled on our roadmap.

in this project formatting doesn't even get applied, no error, no nothing

Regarding broken formatting, do you have this option checked?
image

We were previously seeing issues with formatting not applying properly when this option was disabled.

Sharing the project would be helpful for diagnosing issues. Even if it's not in our scope, we can route the bugs to whichever team owns the specific area.

@ghost ghost removed the untriaged label Oct 3, 2023
@Kokujou
Copy link
Author

Kokujou commented Oct 4, 2023

in this case feel free to have a look on this project, i'm currently playing around with migrating a javascript application to blazor hybrid

https://github.com/Kokujou/ObscuritasMediaManager/tree/master/ObscuritasMediaManager.Client

in the default configuration of vscode, i already see the first issues in the file pages/MusicPlaylistPage.razor
first of all formatting is completely not working, the coloring is mostly not applied (but you already mentioned there is already a ticket so thanks for that :) )

I don't know if i'm missing something that the formatting is not getting applied even when i use F1 -> Format Document (Forced), in the other project that i cannot share at least that works, but i'm getting the error documented above, but as i said that might be related to my current experimental state.

i also see errors like: "Trying to create DocumentContext for razor/mapToDocumentRanges, with no project context," maybe this is saying you something?

@ghost ghost added untriaged and removed needs more info labels Oct 4, 2023
@phil-allen-msft phil-allen-msft modified the milestones: 17.8 Planning, 17.9 P1 Oct 5, 2023
@ghost ghost removed the untriaged label Oct 5, 2023
@phil-allen-msft phil-allen-msft modified the milestones: 17.9 P1, 17.10 P1 Jan 5, 2024
@phil-allen-msft phil-allen-msft modified the milestones: 17.10 P1, 17.10 P2 Feb 13, 2024
@phil-allen-msft phil-allen-msft modified the milestones: 17.10 P2, 17.10 P3 Mar 11, 2024
@phil-allen-msft phil-allen-msft modified the milestones: 17.10 P3, 17.11 P2 May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants