简体   繁体   中英

Visual Studio 2019 Razor Syntax Highlighting When Using Local Functions

The VS2019 syntax highlighting seems to be going berzerk when confronted with a local function in an ASP.NET Core 3.1 Razor view. A function like this:

@{
  void Buttons()
  {
      <div class="col-md-12">
          <button type="submit" name="Command" value="close">Save & Close</button>
          <button type="submit" name="Command" value="save">Save & Stay</button>
          <button type="submit" name="Command" value="cancel">Cancel</button>
      </div>
  }
}

shows up highlighted as full of errors, when in fact it compiles and works just fine. Hovering the mouse pointer over the <div> pops up Cannot resolve symbol <div>. message.

Has anybody found a workaround, or do we need to wait for VS highlighting to catch up with the new syntax?

Unfortunately, the answer is "there is no answer."

There is a JetBrains issue for this problem at https://youtrack.jetbrains.com/issue/RIDER-34875

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM