This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 240695 - Shifts javascript code after the automatic formatting
Summary: Shifts javascript code after the automatic formatting
Status: RESOLVED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 7.4
Hardware: All All
: P3 normal (vote)
Assignee: Petr Hejl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-20 11:43 UTC by pipaslot
Modified: 2014-07-18 11:43 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Javascript formatting example (3.37 KB, application/octet-stream)
2014-01-20 12:17 UTC, pipaslot
Details
Sample file (998 bytes, application/octet-stream)
2014-01-20 12:19 UTC, Ondrej Brejla
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pipaslot 2014-01-20 11:43:34 UTC
When i used code formatting in latte file, then HTLM and CSS was been formatted correctly but javascript was been shifted, as you may seen on example.
Exist one solution, what i know. Remove the initial javascript tag, run automatic formating (javascript code will be moved to left), insert back initial javascript tag and run automatic formating. At the moment, the code will be formatted correctly. But when we will use formating again, the code will be shifted.
When i previously was using Netbeans version 6.2, the code formatting worked correctly
Example:

{literal}
--HTML over javacript--
<script type="text/javascript">
                $(function() {
        $(".ajaxPermission").off("click").on("click", function()
        {
            var id = $(this).attr("data-id");
                        var status = $(this).attr("data-status");
                        //Do somethings
                    });
                    $(".resourceName").off("click").on("click", function() {
                        var bullet = $(this).find(".toggle");
                                    var data = $(this).parent().children(".resourceData");
                                    if (bullet.hasClass("icon-bullet_toggle_plus"))
                                                {
                                                                        bullet.removeClass("icon-bullet_toggle_plus").addClass("icon-bullet_toggle_minus");
                                                                                        data.show();
                                                                                    } else {
                                                                            bullet.removeClass("icon-bullet_toggle_minus").addClass("icon-bullet_toggle_plus");
                                                                                            data.hide();
                                                                                        }
                                                                                    });
                                                                                });
</script>
--HTML below the javascript--


Product Version: NetBeans IDE 7.4 (Build 201310111528)
Updates: NetBeans IDE is updated to version NetBeans 7.4 Patch 2
Java: 1.7.0_45; Java HotSpot(TM) Client VM 24.45-b08
Runtime: Java(TM) SE Runtime Environment 1.7.0_45-b18
System: Windows 8 version 6.2 running on x86; Cp1250; cs_CZ (nb)
Comment 1 Ondrej Brejla 2014-01-20 12:00:08 UTC
Attach a whole sample file (not just snippet from the middle of the file), where one can invoke formatting and the result will be wrong and reopen. Thanks.
Comment 2 pipaslot 2014-01-20 12:17:41 UTC
Created attachment 144148 [details]
Javascript formatting example
Comment 3 Ondrej Brejla 2014-01-20 12:19:55 UTC
Created attachment 144149 [details]
Sample file

Another sample file without latte
Comment 4 Ondrej Brejla 2014-01-20 12:20:24 UTC
I also tried this file (no latte inside - just html and js) and JS formatting (indenting) doesn't work. Same source works well in HTML file. Petre, can you look at it? LatteIndenter is not invoked on that source.
Comment 5 pipaslot 2014-01-20 12:44:26 UTC
I tried your example file and JS formatting (indenting) doesn't work(output was the same as the my first example). When i moved code to HTML file and launched formatting, then the output was correct. Have you any explanation for this problem?
Comment 6 Petr Hejl 2014-07-18 11:43:39 UTC
I tried formatting of both examples by reporter (with latte) and by Ondra (without it) and both seems to be formatted correctly in daily build. Can you please verify?