Omnisharp-vscode: 1.17.0 "Emmet: Expand Abbreviation" no longer working in cshtml files

Created on 1 Nov 2018  路  10Comments  路  Source: OmniSharp/omnisharp-vscode

Environment data

dotnet --info output:
.NET Core SDK (reflecting any global.json):
Version: 2.1.403
Commit: 04e15494b6

Runtime Environment:
OS Name: Windows
OS Version: 10.0.17134
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.403\

Host (useful for support):
Version: 2.1.5
Commit: 290303f510

.NET Core SDKs installed:
1.1.10 [C:\Program Files\dotnet\sdk]
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.302 [C:\Program Files\dotnet\sdk]
2.1.400 [C:\Program Files\dotnet\sdk]
2.1.401 [C:\Program Files\dotnet\sdk]
2.1.402 [C:\Program Files\dotnet\sdk]
2.1.403 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.3-servicing-26724-03 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download

VS Code version: 1.28.2 (user setup)
C# Extension version: 1.17.0

Steps to reproduce

  1. Make sure the following setting is present:
    "emmet.includeLanguages": {
    "razor": "html"
    },
  2. Try typing "div" and hit tab

Expected behavior

div is replaced by <div></div>

Actual behavior

no replacement occurs

Remarks

The setting "razor.disabled": true did not restore functionality, but disabling the extension altogether did restore functionality.

Razor

Most helpful comment

Did you mean to suggest changing
"emmet.includeLanguages": {
"razor": "html"
}
to
"emmet.includeLanguages": {
"aspnetcorerazor": "html"
}
as a fix? Because it kind of worked!
Emmet expansion for tags, such as div and span has its functionality restored. However, emmet espansion for ".alert", which is expected to expand to <div class="alert"></div> does not have its functionality restored. It works in html, but not in cshtml.
Is there some work-around where I can continue to have 1.17 installed and just give up its new cshtml functionality in favor of the previous emmet functionality?
In any case, I will file this in the place you suggested.

It is very annoying because I am using . for classes a lot. Any idea, how to make it work?

This works for me as a workaround using version 1.32.0-insider:

"emmet.includeLanguages": {
        "razor": "html",
        "aspnetcorerazor": "html"
    }

This issue still exists in this nightly build.

All 10 comments

That's unfortunate @cda-1. For now, we've replaced the default Razor language identifier with aspnetcorerazor (from razor) which disables the built-in behavior of VSCode. This is something we can definitely look into though. Would you mind filing this issue over at https://github.com/aspnet/Razor.VSCode?

Did you mean to suggest changing

"emmet.includeLanguages": {
"razor": "html"
}

to

"emmet.includeLanguages": {
"aspnetcorerazor": "html"
}

as a fix? Because it kind of worked!

Emmet expansion for tags, such as div and span has its functionality restored. However, emmet espansion for ".alert", which is expected to expand to <div class="alert"></div> does not have its functionality restored. It works in html, but not in cshtml.

Is there some work-around where I can continue to have 1.17 installed and just give up its new cshtml functionality in favor of the previous emmet functionality?

In any case, I will file this in the place you suggested.

Is there some work-around where I can continue to have 1.17 installed and just give up its new cshtml functionality in favor of the previous emmet functionality?

Sadly not today. We tried to do our best to turn on/off the new Razor functionality but it came with some caveats. If you'd like we'd be open to a PR in the Razor.VSCode repo to re-enable the functionality. At which point you could re-build the Razor.VSCode solution and hot patch bits on disk until a new release is available 馃槈

If you'd like we'd be open to a PR

I hope to be on that level someday!

Did you mean to suggest changing

"emmet.includeLanguages": {
"razor": "html"
}

to

"emmet.includeLanguages": {
"aspnetcorerazor": "html"
}

as a fix? Because it kind of worked!

Emmet expansion for tags, such as div and span has its functionality restored. However, emmet espansion for ".alert", which is expected to expand to <div class="alert"></div> does not have its functionality restored. It works in html, but not in cshtml.

Is there some work-around where I can continue to have 1.17 installed and just give up its new cshtml functionality in favor of the previous emmet functionality?

In any case, I will file this in the place you suggested.

It is very annoying because I am using . for classes a lot. Any idea, how to make it work?

It is very annoying because I am using . for classes a lot. Any idea, how to make it work?

I did not find a good workaround. I reported it as a bug. What I personally am doing now, which I do not assume is acceptable to anyone else:

  1. Disable omnisharp extension in VS Code completely. This restores all emmet functionality.
  2. Use Visual Studio (full version) for my C# and razor
  3. Concurrently use VS Code with the same files and hop over to it when I'm authoring markup.

ok, thanks. I am checking vs code and vs for mac periodically wether I could replace rider, but no luck yet. i never tought i would praise Microsoft for anything, but asp.net getting the best for development imho. They only need to finish their ide g贸for mac

Did you mean to suggest changing
"emmet.includeLanguages": {
"razor": "html"
}
to
"emmet.includeLanguages": {
"aspnetcorerazor": "html"
}
as a fix? Because it kind of worked!
Emmet expansion for tags, such as div and span has its functionality restored. However, emmet espansion for ".alert", which is expected to expand to <div class="alert"></div> does not have its functionality restored. It works in html, but not in cshtml.
Is there some work-around where I can continue to have 1.17 installed and just give up its new cshtml functionality in favor of the previous emmet functionality?
In any case, I will file this in the place you suggested.

It is very annoying because I am using . for classes a lot. Any idea, how to make it work?

This works for me as a workaround using version 1.32.0-insider:

"emmet.includeLanguages": {
        "razor": "html",
        "aspnetcorerazor": "html"
    }

This issue still exists in this nightly build.

Did you mean to suggest changing
"emmet.includeLanguages": {
"razor": "html"
}
to
"emmet.includeLanguages": {
"aspnetcorerazor": "html"
}
as a fix? Because it kind of worked!
Emmet expansion for tags, such as div and span has its functionality restored. However, emmet espansion for ".alert", which is expected to expand to <div class="alert"></div> does not have its functionality restored. It works in html, but not in cshtml.
Is there some work-around where I can continue to have 1.17 installed and just give up its new cshtml functionality in favor of the previous emmet functionality?
In any case, I will file this in the place you suggested.

It is very annoying because I am using . for classes a lot. Any idea, how to make it work?

This works for me as a workaround using version 1.32.0-insider:

"emmet.includeLanguages": {
        "razor": "html",
        "aspnetcorerazor": "html"
    }

This issue still exists in this nightly build.

@nicknguyen your comment works for me on omnisharp extension version 1.21.1 and VSCode version 1.35.1 on Windows 10.

Was this page helpful?
0 / 5 - 0 ratings