microsoft / microsoft/monaco-editor

Razor syntax highlighting does not recognize @code or @functions

Open
#1,997 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug grammars help wanted
Dominant language
JavaScript
Stars
46.8k
Forks
4.1k
Avg merge
17h 58m
Merged PRs (30d)
1

Description

monaco-editor version: 0.2.0
Browser: Tested on Chromium and Firefox
OS: Ubuntu 19.10

When the language is set to razor, @code or @functions is not recognized and shows up (along with all the C# code inside of it) in the default text color. This can be reproduced by going to the Monaco Editor homepage, setting the language to razor, and entering this code:

@{
    @* This C# code will have syntax highlighting *@
    var test = "testing";
    if (true)
    {
        Console.WriteLine("testing");
    }
}
@code {
    @* This C# code will not have syntax highlighting *@
    var test = "testing";
    if (true)
    {
        Console.WriteLine("testing");
    }
}
@functions {
    @* This C# code will also not have syntax highlighting *@
    var test = "testing";
    if (true)
    {
        Console.WriteLine("testing");
    }
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue on the Monaco Editor homepage with the provided Razor snippet and the language set to razor. Trace the syntax-highlighting entry point for Razor; done means @code and @functions blocks, including their C# contents, receive syntax highlighting like the existing block.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, javascript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.