Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for QML #541

Closed
pierremtb opened this issue Sep 9, 2015 · 14 comments
Closed

Support for QML #541

pierremtb opened this issue Sep 9, 2015 · 14 comments
Assignees

Comments

@pierremtb
Copy link

This would be awesome.

@prettydiff
Copy link
Collaborator

https://github.com/Glavin001/atom-beautify/wiki/Requesting-support-for-a-new-language

Do you know where I could find more information about QML?

@prettydiff
Copy link
Collaborator

https://en.wikipedia.org/wiki/QML

Assuming that is the same language it looks similar to JSON, except new line characters or semicolons separate list items instead of commas. Provided the syntax is as clean and minimal as confined to those code samples and there is not grammar dependent variance an existing JSON beautifier could be modified to support this language. This is not on my agenda though.

@nohe427
Copy link

nohe427 commented Sep 24, 2015

I would like to request this enhancement as well.

The only beautifier I know of is located in QT Creator at:

Tools->QML/JS->Reformat file

@vrince
Copy link

vrince commented Feb 25, 2016

It almost work in fact, I notice that ending each line with ";" give expected result with javascript model.
But ending ; is optional in qml ...

Is there guide lines to implement / contribute a new model into prettydiff ?

@prettydiff
Copy link
Collaborator

@vrince No, I have failed to write contribution documentation. I need to write this and it to the project's documentation page.

I would need to write a new option for the tool so that the application specifically knows the language is QML. This would allow me to write custom extensions without massive regression into everything else.

The key technical qualities to consider

  • The default property separator is line termination
  • Semicolons optionally separate properties without need for line termination
  • I must deliberately not employ the automatic semicolon insertion that I enforce on JavaScript

I do have a question though. Look at the first example at https://en.wikipedia.org/wiki/QML#States Do you see that a block is declared to states: with a colon where the other block declarations do not have a colon. What does this mean? I gather from the text that it is a declaration of states which is probably a sort of dynamic or transitive typing compared to the other declarations.

@vrince
Copy link

vrince commented Feb 26, 2016

@prettydiff qml allow list of children (massively use in qt3d project for example)

see for exemaple : http://doc.qt.io/qt-5/qt3drenderer-scene3d-animatedentity-qml.html

...
Entity {
    id: sphereEntity
    components: [ sphereMesh, material, sphereTransform ]
}

Note: qml allow shader / js code as string do you think this could be complex to handle ?

Exemple : http://doc.qt.io/qt-5/qt3drenderer-deferred-renderer-qml-sceneeffect-qml.html
(See vertexShaderCode: ...)

@prettydiff
Copy link
Collaborator

@vrince Those strings would be something else to account for. They are multiline strings. Normally I would identify such as a parse error, because they are a parse error in JavaScript. I could extend the code to support this though.

@prettydiff
Copy link
Collaborator

@vrince Could you move all further discussion to prettydiff/prettydiff#278 so that I can these technical items when I start working on this.

@marco-piccolino
Copy link

would love to see this

@prettydiff prettydiff self-assigned this Apr 13, 2016
@ldanzinger
Copy link

would also like this

@prettydiff
Copy link
Collaborator

prettydiff commented Jun 28, 2016

QML support is added to the 2.1.0 branch of prettydiff if you guys would like to test it out. Be sure to use the option qml.

Also, if anybody does decide to play with this would you mind providing some code samples for unit tests. I really only looked at the examples on Github, so this could be missing all kinds of support.

@marco-piccolino
Copy link

Awesome thank you, will check it out!
Il 29 giu 2016 1:23 AM, "Austin Cheney" notifications@github.com ha
scritto:

QML support is added to the 2.1.0 branch of prettydiff if you guys would
like to test it out.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#541 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AHyhsdB1at3QJGYgLqNbT4f_ZH-29zzCks5qQa0FgaJpZM4F6Sff
.

@vrince
Copy link

vrince commented Jun 29, 2016

Nice ! testing it today :)

After a couple a runs I already can say that :

  1. [] are not so well handled. There is a confusion between component list (that can be separate by a new line, an option for that could be nice) and item access like vector[i] where new line does not make sens.

example :

camera.upVector = Qt.vector3d(up[0], up[1], up[2]);` 

ends like :

camera.upVector = Qt.vector3d(up[0
], up[1
], up[2
])
  1. Component list first line is remove :
components: [
    RenderSettings {

ends like :

components: [RenderSettings {

There is also a {} issue, it seems that valid code end behind miss indented (and not indented at all) at some point when you run beautifier more than once on the very file attached to this comment ...
SimpleSceneEntry.txt (.qml renamed to .txt to make github happy)

I am running:

node api/node-local.js source:SimpleSceneEntry.qml mode:beautify readmethod:file output:SimpleSceneEntry.qml qml:true vertical:none wrap:-1 quoteConvert:double

@prettydiff
Copy link
Collaborator

I can not reproduce the latest defects as mentioned in #541 (comment) and the latest version of Pretty Diff recently landed in Atom Beautify.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants