Closed egamma closed 1 week ago
Unfortunately, there is no way to get IntelliSense for Razor in VS Code through OmniSharp today. The Razor parser does not run as it does in Visual Studio. We will look at this in the future though.
Thanks!
Is there anyway to help out with this? Personally this is my number 1 issue with using VS Code for aspnet core development -- since refactoring/usage/etc is no longer safe because usages within cshtml aren't seen -- and cshtml views aren't even compiled on build (not sure if there is a way to make that happen with the new core stuff like there used to be).
@david-driscoll was looking at it awhile back over in https://github.com/OmniSharp/omnisharp-roslyn. Maybe drop by Slack and chat about it?
@DustinCampbell Thanks -- I'll hop over there an find out.
Have the same Issues (but from Ubuntu) really missing that Razor Intellisense, it'd really make all the difference in the world.
Will i be able to spot progress on this feature here?
Agree. Now that we have tabs, razor-intellisense is the "one big thing" missing from VS Code for asp.net core devs.
We'll be adding support to OmniSharp eventually to support Razor, sadly I don't have a specific timeline. This is mainly because it's not a very easy problem to solve, but it is something we want to get working.
Some updates? I also really miss it.
I need it also
To be clear, this is a fairly big work item. It is currently in our "future" milestone because we don't yet have a good sense of when it will happen..
@DustinCampbell is there a design/approach in mind for this? It would be great if there was a rough outline of the work that needed to be done and some general guidelines for an approach. This is something I would love to see happen and would also help make it so, but I'm honestly not sure where to even get started (I've only barely started touching OmniSharp and I haven't found any real documentation/overview docs for it). If this was something that could be put together, I would hope others in the community would try to step up and help (I would with whatever time I could find).
I have a branch that was the bare minimum to wire in the "basic" Razor runtime. It's available https://github.com/OmniSharp/omnisharp-roslyn/tree/razorhost.
When I say bare minimum, basically I was able to get diagnostics returned from the Razor host, and there were a lot of them because we I hadn't wired in any of the references (including things like mscorelib, lol).
We have yet to be determined if that is the best way to do it, but we're working on it.
The work that needs to be done is basically
Microsoft.AspNetCore.Mvc.Razor
which they would then get a new "sister"/"sibling" project that understands the Razor syntax. There are other challenges on the VSCode / Atom side, with properly merging the C# / HTML syntax, so that they show the correct context at all times. This, I believe, is where a lot of the big work comes in because it involves work into VSCode itself.
My hope is this week to triage some bugs with the Atom plugin (I've not had much time lately!), and then dig into Razor support, and try to tie it into the DotNet Project System, which while is on it's way out, will be a valid proof of concept.
@david-driscoll
I believe, is where a lot of the big work comes in because it involves work into VSCode itself.
This is correct and now that we have extracted the HTML support into its own language server, we will start in October with the nested languages support. We will start with CSS Intellisense, which comes from the CSS language server, inside HTML.
What is the status of this?:)
Once again, any status update?
There is no movement on this at the moment. To be honest, this isn't at the top of the priority list as I'm mostly working on getting support for .NET Core .csproj projects finalized.
Okay, just the only thing that is stopping me using vscode only atm. As For .net core 1.0 apps no razor compilation so I can't get intellisense and cannot get and view errors until runtime. So I'm falling back to vs2015 all the time just for razor. If I get free time I might play with the branch list above^. Thanks
Any help would be welcome! :smile:
In the meantime, there is an extension for vscode that implements intellisense for the Model object at least :)
https://marketplace.visualstudio.com/items?itemName=schneiderpat.aspnet-helper
any plans for this?
I'm waiting for this feature too. It should also be possible to debug and refactor razor template files like we can do in visual studio.
I think even being able to format markup properly will be a huge bonus. Since now markup formatting isn't working and it's really annoying to format html tags by hands.
please, I want this.
I'm going to jump on this bandwagon. As a front end developer, Visual Studio is gross. It's a horror to write JS/CSS/HTML in, but I'm have little choice but to use it for templating. I want to stop juggling between VS for C#/Razor and Atom for everything else.
Sometimes I need 4 separate solutions open at the same time. VS cries when I try to do this. As such, being able to fully use Razor inside VS Code would be phenomenal.
leave razor we gonna use some js framework< no I wont
+1 I need this...
almost one year and half past... I am doubting this feature was buried deeply in vscode backlog tomb.
To my point of view it's an important feature. Good cshtml support is the only reason why I still use visual studio 2017 instead of vscode.
Yes this is very helpfull
Press CTRL+SHIFT+P enter ext install aspnet-helper
@erashishmodi I have tried it. But not powerful enough.
This is the one essential thing that VS Code lacks. With Razor syntax and formatting, I'll use VS Code exclusively. Hoping this happens soon so I can stop running Windows in a VM for this purpose.
Would be nice to get an status update on this. What is the big problem to solve this? Is the Atom-base not able to perform something like this?
From the C# side, the difficulty is not having a Razor parser and infrastructure for doing this work. In Visual Studio, the system that handles Razor and .aspx pages is very complex and has deep ties to the Visual Studio editor.
Hi all, I'm throwing together a very simple extension that to start with will just do razor parsing and give back errors using Microsoft.AspNetCore.Razor.Language.
Then I'll slowly try and get intellisense etc working.
This is not really vscode-version specific. Can someone adjust the title of this issue to remove the version.
Title could read
No intellisense available for razor
bump this up on the queue - a critically needed feature
An update to this would be appreciated! Is implementation of this feature even considered at this point?
This is deal breaker for me, until razor intellisense is not supported vscode and your extension are basically useless for anyone working with MVC. I'm really looking forward to use vscode as my primary IDE.
We take pull requests. 🥇
There are various challenges that are involved with making razor work, so we don't have anything on the timeline for it today. The main reason being enough time to sit down and figure out a good way to integrate all the bits together. I have a rough idea how to make it work, and I've had a proof of concept in the past but the razor repository has shifted since then.
It's a bit strange that this issue has been rolling over since April 2016. It's Feb 2018 now. Seems to me it's more of an issue of slipping priorities than something being "hard" to do...
Please push this priority up - it's the one thing that is missing for a nice asp.net development experience. A lot of time can be spent in views and having no help from the editor makes it very frustrating.
Visual Studio Code has no IntelliSense for Razor. Please prioritize this!
I think, It's a bit strange that there is not a tool for razor Intellisense still while a lot of developers need it.
All ASP.NET Core developers who use Code require this.
@shanselman bemoaning lack of razor support in vscode in Feb 27th Community Standup
+1
I've been wondering where the support was for Razor in VSCode since I started using it last year. I understand it's hard to do since it is so tightly coupled to VS right now, but I'd love to see this prioritized. Heck, I'd even throw a few bucks into an OmniSharp OpenCollective or Patreon etc to see it happen. :P
A "workaround" I could suggest here is getting familiar with an SPA JS framework and TypeScript. Then you'll have Intellisense as you build each of the MVC layers. TypeScript isn't that hard to learn if you have experience with both C# and JS, and the SPA frameworks have stabilized a lot recently. We can pretty much count on React, Vue, and Angular to stick around for a while with good support. If you use the CLI to make a "with React" app, using dotnet new react
, you'll see how they officially recommend you lay out your project to do this.
Another idea I had, if my aim was to just have a view layer instead of a full blown SPA, would be to make individual React apps for each page/route. The apps would be used in a mostly functional way, referencing Header and Footer components in a common directory. Instead of passing data with view models using model binding from a controller action to a Razor view, I'd fetch the view model in the route's React app from the controller action, using it as JSON API only. Then I've got Intellisense for the entire view.
Yeah it’s pretty disappointing not to have support for something that is, in my opinion, fundamental to asp.net. And they continue to roll out all sorts of great things for Node, React and other stuff.
I’ve thought about going your route of the SPA and API calls myself to get away from razor. But then again, razor makes it easy to do a lot of great thing.
On Mar 6, 2018, at 2:31 PM, Matt Welke notifications@github.com wrote:
I've been wondering where the support was for Razor in VSCode since I started using it last year. I understand it's hard to do since it is so tightly coupled to VS right now, but I'd love to see this prioritized. Heck, I'd even throw a few bucks into an OmniSharp OpenCollective or Patreon etc to see it happen. :P
A "workaround" I could suggest here is getting familiar with an SPA JS framework and TypeScript. Then you'll have Intellisense as you build each of the MVC layers. TypeScript isn't that hard to learn if you have experience with both C# and JS, and the SPA frameworks have stabilized a lot recently. We can pretty much count on React, Vue, and Angular to stick around for a while with good support. If you use the CLI to make a "with React" app, using dotnet new react, you'll see how they officially recommend you lay out your project to do this.
Another idea I had, if my aim was to just have a view layer instead of a full blown SPA, would be to make individual React apps for each page/route. Instead of passing data with view model using model binding from a controller action to a Razor view, I'd fetch the view model in the route's React app from the controller action, using it as JSON API only.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
From @Felsig on April 8, 2016 23:51
Specifically when writing code like @Model.Id or the similar I get no sort of intellisense. I assumed that would be a feature as the website states support for Razor. Is this just not a feature?
Copied from original issue: Microsoft/vscode#5113