broken intellisense in razor views in Orchard CMS - visual-studio

All the views I open on a clean install of Orchard CMS show tons of red squiggly errors under calls to methods that are somewhere defined in Orchard.
Sample methods:
Display
HasText
Style
SetMeta
T
and so forth.
The web.config in this theme (thememachine) does have this defined: add namespace="Orchard.Mvc.Html"
Let me add that it is a huge let-down to have to work entirely with dynamic, not just as an add-on, but as a solid foundation everywhere. Problems like this (no intellisense for most of what you need to do with the models and with Orchard commands in your views!) say it all. Do we thus get no / little intellisense in working in Orchard views?
In any case, the main question is: are such IDE errors (not errors on compilation) what everyone sees, and is there nothing to be done about it?

Although Orchard uses dynamic types a lot what you're seeing is not because of that. From the members you listed actually only Display is dynamic so you should get full IntelliSense and of course no errors for them.
What you experience is most possibly a general issue with Razor IntelliSense on your machine. Try researching "Razor IntelliSense not working" and you'll get some pointers. The possible problems I've encountered are the following ones:
If you're using VS 2010 check that only MVC 3 Tooling is installed. If you have MVC 2 Tooling installed, uninstall it.
If you're using a pre-release version of VS 2012 like the RC upgrade to the released version.

Related

Using Visual Studio Code for Grails development

IntelliJ IDEA is pretty amazing for Grails development work. It is rather demanding on resources (particularly memory), though, and takes a long while to start up, so occasionally I like to use Visual Studio Code instead for light editing. I'm trying to tune it most effectively for Grails development. Any tips would be most welcome. One thing I'd particularly like to know is if there is some way of setting up a beautifier/formatter for .gsp files.
First of all, you'll have to setup VS Code for java. You can follow this page https://code.visualstudio.com/docs/languages/java
Then, you'll have to install of the groovy language extension. Currently there are three such extensions in the library. code-groovy has more active users than the others and it provides good gsp support. I do use VS code for quick editing or just viewing source code occasionally but its still not the replacement of Intellij. I can't use VS Code for hardcore java/grails development yet.

Adding custom JavaScript scripts to intellisense

I am using Visual Studio 2010 with Resharper plugin and my web application is heavy on JavaScript.
By that I mean there is a lot of libraries (knockout.js, jQuery, jQuery UI - to name a few).
While intellisense works alright in C#, I'm having a hard time to start it working for JavaScript. I've tried googling and going through options, preferences and docs all through out the holidays, but seems that I'm searching for something that just isn't there.
So by example there's a class in knockout.js "ko.utils", which has methods like "ko.utils.arrayMap". My question is, how can I make intellisense (of either R# or VS) index this class and offer me methods when I type "ko.utils.", hence speeding up my development in JavaScript?
Note: Possible to get custom javascript files to have intellisense in VS 2010? this is not a duplicate I think, because it is seldom for these libraries to have a special VSDoc script here and if they had one, I still couldn't refere it globally.
You can create a ReSharper plugin to extend the code completion mechanism to provide the features you need. What you'd have to do is analyze the parsed structures yourself, derive the relevant content to be added to completion lists, and inject it when necessary.

Visual Studio 2010/Resharper Plugin development

I am having trouble tracking down information regarding extending Intellisense. It looks like creating a plugin for VS 2010 or Resharper would do the trick. However, I can't find any documentation for adding items to the intellisense dropdown.
This post got pretty close: How to extend IntelliSense items?
But I couldn't find any documentation for the interfaces or classes being used.
What I am trying to do is to read from an XML file, and add those tags as part of the results that show up in intellisense in the C# code (not in XML).
The part of the R# Plugin Development Guide concerning Code Completion (i.e., IntelliSense) is on our todo list but has not yet been written. When done, it should be available here. While we're working on that, feel free to email me dn at jetbrains dot com, and I'll try to help you out with any queries you might have.

Custom theme for Orchard CMS?

What I should do except writing owner Site.css? It is possible to give writing Site.css to designer without any worry about merger functionallity and design?
I wrote an intro blog post on theming Orchard.
On my latest project the designer in our team read it so he could turn his designs into an Orchard Template.
The key thing we found was that the designer needed to have his own local version of Orchard running that he could make changes to and see the affects. We had him running it through Visual Studio, but Web Matrix or IIS running locally with him using his own editor of choice would have been just as good.
A combination of the Developer module and visual studio helped him work out what was what.
My article is not pitched at designers though, so I did pair him with a developer at first to get him started. This worked really well and the designer now feels confident and can make new templates from scratch by himself.
It depends on what you are trying to do. In some cases, CSS is enough. In some cases, not, and you also need to change layout and a number of other templates. CSS should be no problem for your designer. For templates, they just have to understand what the #{}, #() and # are doing and learn not to touch these parts and work around them. Good web designers should be used to that sort of thing.

Resharper Compared with Visual Studio 2010

I've heard that Visual Studio 2010 = Visual Studio 2008 + Resharper. I'd like to know how true that is. I don't want to start using Resharper to accomplish superficial things, nor to accomplish things that VS 2010 now already handles. I'm sure Resharper 5.1.X offers features that VS 2010 does not have, but which of those - in your opinion - represent the true value-adds? Which of those "truly-valuable" features are available only in the licensed copy?
This is a 'joke' based on the fact that Microsoft supposedly released a screenshot of 2010 with ReSharper UI visible.
VS.Net 2010 definitely does not go any way towards making ReSharper redundant!
Resharper adds alot to VS2010. Just check out this comparison matrix.
I'm sure Resharper 5.1.X offers features that VS 2010 does not have, but which of those - in your opinion - represent the true value-adds? Which of those "truly-valuable" features are available only in the licensed copy?
All features are available in a non-licensed (demo) copy. Check out this post of what single feature people like about Resharper.
I know this is slightly off topic. However, as a response to whether VS2010 is making Resharper redundant;
I've upgraded ReSharper from 5.1 to 6 roughly 1 month after release. It got slower. To the point when I have to Suspend it occasionally - particularly when doing lots of work on JavaScript, CSS or larger template files (Razor). Sad thing is it just gets slower.
At home, I'm using just a plain VS2010 Professional without any add-ons. And it just feels like a breeze - everything is responsive and there are no hiccups when copy pasting (during manual re factoring). Admittedly at work I have T4MVC and Chirpy installed along Resharper.
Feature wise, what I'm using in ReSharper:
Auto usings (alt + Enter)
Cannot use auto include references as it gets it wrong 80% of the time
Refactor: initialize member variable from constructor parameter
Refactor: replace with LinQ expression
Sadly that's about it. In light of this, because of the slowdowns I'm considering dropping ReSharper altogether. This is my grievances:
Delay every time I copy a piece of code in order to move it - anything from half a second to 2 seconds. Please note the delay increases with project / solution size
Auto completion in JavaScript and CSS: 95% of the time it inserts code I don't want - in particular () after selecting an object property. Getting fed up having to delete the brackets each time
class name and id suggestion. This happens in CSS as well as Razor template. It will try to insert an existing class name / html id when you are in fact creating a new one. It will do this whenever you press space. Instead you have to press escape.
Pasting code. Again when refactoring manually and code is moved from one class to another it will keep pestering you with all missing usings. First you have to press Escape for "Insert all missing usings" and then once for every occurrence of a class without a reference. Usually you want to change something upon pasting code but this feature makes code unreadable with all the popups.
I could go on abut the things I find annoying with ReSharper. Not trying to offend any die-hard productivity tool enthusiasts, bottom line is VS2010 is on it's own a very decent IDE and a lot of ReSharper features can be found within it - though not always intuitively.
If you are just learning C# ReSharper is a great tool that helps you organize your code better. But if you've been working with .NET for a while you will most likely find it intrusive and hampering productivity on some occasions.
Re#er still got much stronger code check and refactoring options.

Resources