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 151518 - Source formatting produces unexpected result
Summary: Source formatting produces unexpected result
Status: VERIFIED FIXED
Alias: None
Product: javafx
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Anton Chechel
URL:
Keywords:
Depends on:
Blocks: 155841
  Show dependency tree
 
Reported: 2008-10-27 19:17 UTC by rupashka
Modified: 2009-03-20 12:35 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rupashka 2008-10-27 19:17:29 UTC
I took arbitrary class:
package temp;

import javafx.scene.*;
import javafx.stage.*;
import javafx.scene.paint.*;
import javafx.scene.shape.*;

Stage {
    resizable: false // This line prevent Stage to have right size

    scene: Scene {
        fill: Color.RED
        width: 200
        height: 200
        content: Rectangle {
            x: 0, y: 0
            width: 200
            height: 200
            fill: Color.GREEN
        }
    }
}

And below is the formatting result:
package temp;

import javafx.scene.*;
import javafx.stage.*;
import javafx.scene.paint.*;
import javafx.scene.shape.*;

    Stage {
        resizable: false // This line prevent Stage to have right size

        scene: Scene {
            fill: Color.RED
            width: 200
            height: 200
            content: Rectangle {
                x: 0, y: 0
                width: 200
                height: 200
                fill: Color.GREEN
            }
        }
    }

The first problem is indention: why was 4 spaces added before the Stage class?

I'd like to see this functionality too:
1. Put spaces between mathematical operators (like +, - etc). Example:
(a + b) * 2;

2. Put space after ":" in instance variables initialization. Example:
var bounceImage = ImageView {
    translateX: 140
}

3. Put space  between ":" and variable type. Example:
var springDescription: Text = Text {

4. Don't use several complex instance variables initializations in an one line. Example:
    var springDescription:Text = Text {
        content: "Spring\nInterpolator"
        textAlignment: TextAlignment.CENTER
        *font: Font {size: 16} fill: Color.WHITE*
        x: 10 y: 20
    };
Comment 1 Lark Fitzgerald 2008-10-27 21:01:11 UTC

*** This issue has been marked as a duplicate of 151234 ***
Comment 2 Alexandr Scherbatiy 2008-12-22 15:51:06 UTC
I tried the #4:

4. Don't use several complex instance variables initializations in an one line. Example:
    var springDescription:Text = Text {
        content: "Spring\nInterpolator"
        textAlignment: TextAlignment.CENTER
        *font: Font {size: 16} fill: Color.WHITE*
        x: 10 y: 20
    };

The result is:
---------------------------------------------------------------------------
var springDescription:Text = Text {
    content: "Spring\nInterpolator"
    textAlignment: TextAlignment.CENTER
    font: Font {
        size: 16
    } 
    fill: Color.WHITE
    x: 10 
    y: 20
    };
---------------------------------------------------------------------------
Comment 3 Rastislav Komara 2009-01-30 11:52:50 UTC
Moving to future.
Comment 4 Rastislav Komara 2009-03-02 10:19:01 UTC
reassigning to new owner.
Comment 5 Anton Chechel 2009-03-19 18:23:58 UTC
fixed, old reformat has been disabled
Comment 6 Alexandr Scherbatiy 2009-03-20 12:35:59 UTC
verified