dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.84k stars 666 forks source link

No intellisense available for razor #168

Closed egamma closed 1 week ago

egamma commented 8 years ago

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

DustinCampbell commented 8 years 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.

adamhilton commented 8 years ago

Thanks!

eamodio commented 8 years ago

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).

DustinCampbell commented 8 years ago

@david-driscoll was looking at it awhile back over in https://github.com/OmniSharp/omnisharp-roslyn. Maybe drop by Slack and chat about it?

eamodio commented 8 years ago

@DustinCampbell Thanks -- I'll hop over there an find out.

rasmus91 commented 8 years ago

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?

eimik commented 8 years ago

Agree. Now that we have tabs, razor-intellisense is the "one big thing" missing from VS Code for asp.net core devs.

david-driscoll commented 8 years ago

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.

mchomer commented 8 years ago

Some updates? I also really miss it.

winuxue commented 7 years ago

I need it also

DustinCampbell commented 7 years ago

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..

eamodio commented 7 years ago

@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).

david-driscoll commented 7 years ago

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

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.

egamma commented 7 years ago

@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.

uxsoft commented 7 years ago

What is the status of this?:)

eByte23 commented 7 years ago

Once again, any status update?

DustinCampbell commented 7 years ago

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.

eByte23 commented 7 years ago

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

DustinCampbell commented 7 years ago

Any help would be welcome! :smile:

karabaja4 commented 7 years ago

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

mrtristan commented 7 years ago

any plans for this?

idarous commented 7 years ago

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.

ivankarpey commented 7 years ago

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.

xsoheilalizadeh commented 7 years ago

please, I want this.

SudoCat commented 7 years ago

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.

MichaelTontchev commented 7 years ago

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.

raimonomiar commented 7 years ago

leave razor we gonna use some js framework< no I wont

arruw commented 7 years ago

+1 I need this...

Calx-Takeno commented 7 years ago

almost one year and half past... I am doubting this feature was buried deeply in vscode backlog tomb.

idarous commented 7 years ago

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.

SeriaWei commented 7 years ago

Yes this is very helpfull

erashishmodi commented 7 years ago

Press CTRL+SHIFT+P enter ext install aspnet-helper

SeriaWei commented 7 years ago

@erashishmodi I have tried it. But not powerful enough.

donniefitz2 commented 6 years ago

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.

mchomer commented 6 years ago

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?

DustinCampbell commented 6 years ago

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.

eByte23 commented 6 years ago

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.

mikes-gh commented 6 years ago

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

tsaltd commented 6 years ago

bump this up on the queue - a critically needed feature

sstamoulis commented 6 years ago

An update to this would be appreciated! Is implementation of this feature even considered at this point?

arruw commented 6 years ago

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.

david-driscoll commented 6 years ago

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.

mika76 commented 6 years ago

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.

redonwhite commented 6 years ago

Visual Studio Code has no IntelliSense for Razor. Please prioritize this!

ZakroKhitalishvili commented 6 years ago

I think, It's a bit strange that there is not a tool for razor Intellisense still while a lot of developers need it.

jonathanperis commented 6 years ago

All ASP.NET Core developers who use Code require this.

mikes-gh commented 6 years ago

@shanselman bemoaning lack of razor support in vscode in Feb 27th Community Standup

glat commented 6 years ago

+1

mattwelke commented 6 years ago

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.

jtlowe commented 6 years ago

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.