Extract to Component refactoring and the new Roslyn-based C# tokenizer are now available

This new tokenizer is not on by default until .NET 10 but is available in both Visual Studio (17.13) and Visual Studio Code for .NET 9.

To enable the C# tokenizer today, check the Use the C# tokenizer for Razor files in the IDE option under Tools > Options > Preview Features and add <Features>use-roslyn-tokenizer;$(Features)</Features> to a property group in your .csproj or directory.props file

This new lexer does currently come with some breaking changes, particularly around preprocessor directives

  • KissakiOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    7 days ago

    So glad this is landing and stuff like interpolated and raw strings can be used in .razor files going forward.