Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript Intellisense in Razor View Engine child pages

I'm after a way of getting my referenced .js files in my 'master' cshtml files to come through to the 'child' cshtml files.

I have something like this in the master file, so the .js files always get referenced (and indeed I get js intellisense in the master file):

if (false)
{
     <script type="text/javascript" src="../scripts/jquery.js"></script>
}

However when I reference the master.cshtml file in a 'child' page like this:

@{
    Layout = "~/Views/Shared/master.cshtml";
}

I get no javascript intellisense. I really don't want to have to put the script tags at the top of each child page, there are a lot of script tags, and a lot of child pages!

like image 464
benpage Avatar asked Jan 27 '11 22:01

benpage


1 Answers

The Razor editor right now cannot infer which script files are in use (this is because Razor layout pages are set via code and the editor does not execute a view page). Unfortunately you will have to include those script tags if you want JavaScript IntelliSense to work in your view pages.

like image 73
marcind Avatar answered Sep 30 '22 14:09

marcind