Formatter "messing up" indention on cut/paste, on newline? #42

Closed
malteseduck opened this Issue Sep 13, 2013 · 4 comments

Comments

Projects
None yet
2 participants
@malteseduck
Contributor

malteseduck commented Sep 13, 2013

I don't know if this is a bug or not, but it seems that many times when I cut and paste XQuery code to various places the format of the XQuery is lost. Here is a simple example:

xquery version "3.0";

let $test as xs:string := "test"
return (
    fn:concat(
        "this ",
        "is ",
        "a ",
        $test
    )
)

If I type a comma after the closing ")" for the fn:concat() function and hit the return key then the cursor moves to beginning of the line on the new line instead of being indented to match the current indentation.

When I cut and paste this over itself (or anywhere else) then the "fn:concat(" and the closing ")" for that function lose their indentation. I had a whole block of XQuery I pasted somewhere and had to re-indent it all (not your fault, that is what I get for using the working version).

There are some cases where I move the the cursor to the new line and it adds another indentation level when you wouldn't think it should. I will try to reproduce it and create another issue if I can.

@malteseduck

This comment has been minimized.

Show comment
Hide comment
@malteseduck

malteseduck Sep 13, 2013

Contributor

Here is the case. Trying to type this:

"test"
,
"case"
,
"for"
,
"you"

Actually results in this:

"test"
,
        "case"
,
        "for"
,
        "you"
Contributor

malteseduck commented Sep 13, 2013

Here is the case. Trying to type this:

"test"
,
"case"
,
"for"
,
"you"

Actually results in this:

"test"
,
        "case"
,
        "for"
,
        "you"

@ghost ghost assigned ligasgr Sep 13, 2013

@ligasgr

This comment has been minimized.

Show comment
Hide comment
@ligasgr

ligasgr Sep 13, 2013

Owner

Hi,

Thanks for raising this issue. I'm still trying to find out a good resource on xquery code style (I'll probably try to make formatter rules to resemble http://xqdoc.org/xquery-style.pdf in the future).
I tried to follow the typical formatting behaviour of IntelliJ for java code to have "the feeling" similar but in case of xquery specific constructs I'll have to fix that.

Have you got any suggestions around formatting style or a good resources?

Thanks

Owner

ligasgr commented Sep 13, 2013

Hi,

Thanks for raising this issue. I'm still trying to find out a good resource on xquery code style (I'll probably try to make formatter rules to resemble http://xqdoc.org/xquery-style.pdf in the future).
I tried to follow the typical formatting behaviour of IntelliJ for java code to have "the feeling" similar but in case of xquery specific constructs I'll have to fix that.

Have you got any suggestions around formatting style or a good resources?

Thanks

@ligasgr ligasgr closed this in 3fefad6 Sep 14, 2013

@ligasgr

This comment has been minimized.

Show comment
Hide comment
@ligasgr

ligasgr Sep 14, 2013

Owner

Please re-open if similar problem happens for similar expressions.
In case of any other formatter issues (there might be plenty), please raise separate issues.
Thanks for using the plugin and for the feedback :) It's invaluable!

Owner

ligasgr commented Sep 14, 2013

Please re-open if similar problem happens for similar expressions.
In case of any other formatter issues (there might be plenty), please raise separate issues.
Thanks for using the plugin and for the feedback :) It's invaluable!

@malteseduck

This comment has been minimized.

Show comment
Hide comment
@malteseduck

malteseduck Sep 15, 2013

Contributor

I have usually used that document you mention for code style. Here is one by Micah Dubinko: http://developer.marklogic.com/blog/xquery-coding-guidelines. Those two are the main ones I have seen.

Contributor

malteseduck commented Sep 15, 2013

I have usually used that document you mention for code style. Here is one by Micah Dubinko: http://developer.marklogic.com/blog/xquery-coding-guidelines. Those two are the main ones I have seen.

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