razor: Difficult to type a div in razor that's in a code block in another div

This issue has been moved from a ticket on Developer Community.


[severity:I’m unable to use this version] I’m trying to add a div inside the foreach block below in a Razor file:

<div>
    @foreach (var item in items) 
    {
        // Add a div here
    }
</div>

When I type the opening div tag, the editor matches it with the closing div tag outside of the foreach block instead of generating a new closing div tag.

If I try to type the closing div tag it gets automatically completed as an opening div tag with a closing div tag, which is really frustrating.

! [6UCAcPkig4.gif] (https://aka.ms/dc/image?name=Becc54d8041ca4b51b86fc72adf62ae0d637711474345224136_20211029-163713-6UCAcPkig4.gif&tid=ecc54d8041ca4b51b86fc72adf62ae0d637711474345224136)


Original Comments

Feedback Bot on 10/31/2021, 10:40 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.


Original Solutions

(no solutions)

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 19 (12 by maintainers)

Most upvoted comments

Or are you just clarifying that it will take some time (longer than a sprint)?

I’m saying this one. It’s a significant chunk of work.

Hi @tbasallo,

I appreciate that this is taking a long time, but I can assure you that it’s not a low priority for us. We understand how much it hurts developers and are determined to get it fixed.

The razor compiler is a complicated piece of code that has been added to by various teams over the years. Unfortunately, we’ve gotten to the point where it’s no longer feasible to just ‘add one more thing’ and we need to restructure some of the deep internals to make sure that it works correctly going forward. A lot of this work has just basic infrastructure stuff, and we’re only now getting to the point where we can actually start remaking the foundations.

VS is a large product with a large team, but the number of people working directly on the Razor compiler is comparatively small. We’re workin’ our butts off to get it done, but there’s only so many hours in a day 😃. I know that it would be a lot more satisfying if I could just answer ‘this will ship in preview X’, but hopefully this lets you know that we really do care, and really are in the process of trying to fix it.

@333fred Do we have a better issue or an umbrella issue that can be used to track the error recovery improvements and what needs to be done beforehand?