简体   繁体   中英

netbeans 7.4 inline js code formatting and auto completion

When any JS is embedded within HTML or PHP pages, Netbeans doesn't highlight the syntax and doesn't provide auto completion.

The sample code is as below:

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Steps Template</title>
    <script type="text/javascript" src="js/jquery-1.10.1.min.js"></script>
    <script type="text/javascript" src="js/jquery-ui.min.js"></script>

    <script type="text/javascript" src="js/initializer.js"></script>
    <script type="text/javascript" src="js/database.js"></script>
</head>
<body>
    <div id="bg">
        <div id="mediaMini" style="">
            <div id="bgBlock" style="opacity:0;"></div>
        </div>
    </div>
    <script type="text/javascript">
        $(function() {
            var options = {
                'imgPath': 'images',
                'audioPath': 'audio'
            };
            $(document).ready(function() {
                function preloadAllImages() {
                    var imagesLoaded = 0;
                    var images2PreLoad = new Array();
                    for (var i in universalStepsData) {
                        images2PreLoad.push(options.imgPath + '/' + (universalStepsData[i].imageSrc));
                    }
                    var loading = function loadAllImages(callback) {
                        var img = new Image();
                        img.src = images2PreLoad[imagesLoaded];
                        $(img).load(function() {
                            imagesLoaded++;
                            if (imagesLoaded == images2PreLoad.length) {
                                initialise('bgBlock', options);
                            }
                            else
                                loadAllImages(callback);
                        });
                    };
                    loading();
                }
                preloadAllImages();
            });
        });
    </script>
</body> 

My netbeans about page shows the following information.

Product Version: NetBeans IDE 7.4 (Build 201310111528)
Updates: NetBeans IDE is updated to version NetBeans 7.4 Patch 2
Java: 1.7.0_51; Java HotSpot(TM) 64-Bit Server VM 24.51-b03
Runtime: Java(TM) SE Runtime Environment 1.7.0_51-b13
System: Windows 8 version 6.2 running on amd64; Cp1252; en_AU (nb)
User directory: C:\\Users\\Nisarg\\AppData\\Roaming\\NetBeans\\7.4
Cache directory: C:\\Users\\Nisarg\\AppData\\Local\\NetBeans\\Cache\\7.4

As some users suggested I have also checked in Tools -> Options -> Miscellaneous -> Files and checked that fle extension JS has text/javascript associated with it.

I also made sure that netbeans is up to date and all the plugins are up to date as well.

How to solve this issue? How can I get formatting and auto completion back?

Sharing this for those who might be having the same problem. This doesn't provide solution but observations. (This was too big for a comment)

Well turns out no one could come up with a definite solution. I even opened a ticket in Bugzilla but no response from there either.

Well I was sharing the project with other guys and they were using netbeans 7.3 while I upgraded to 7.4. I believe this was a the problem where the conflict was occurring. Once I reverted back to 7.3 all was good.

Once version 8 was released, I upgraded to 8 while the other fellas were still at 7.3. Till now (touch wood) it hasn't caused any issues.

So in a nutshell, it seems like 7.4 and 7.3 might have internal conflict. Or might not but they both don't work together on same project at same time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM