ligasgr / intellij-xquery

Plugin to support XQuery in Intellij Idea
Apache License 2.0
35 stars 23 forks source link

FLWOR formatting issues while typing #74

Closed malteseduck closed 10 years ago

malteseduck commented 10 years ago

Some interesting behavior in the formatting while I am typing out FLWOR statements that are nested in indented constructs, but only while typing. If I run "Reformat Code..." then the formatter usually will format the code as I would expect. For example, this (correctly formatted):

(
    xdmp:current-dateTime(),
    for $i in (1 to 10)
    return
        $i
)

comes out like this while I am typing it:

(
    xdmp:current-dateTime(),
    for $i in (1 to 10)
        let $i := $i + 1
        return 
        $i
)

as I type it. Here is a different construct, but very similar. When I type it looks like this:

let $loop :=
for $i in (1 to 10)
let $i := $i + 1
return $i
return ()

After running the formatter it looks like this:

let $loop :=
    for $i in (1 to 10)
    let $i := $i + 1
    return
        $i
return ()

Another:

<element>
    <numbers>
        <number>{
            for $i in (1 to 10)
let $i := $i + 1
return
                $i            
        }</number>
    </numbers>
</element>

After running formatter:

<element>
    <numbers>
        <number>{
            for $i in (1 to 10)
            let $i := $i + 1
            return
                $i
        }</number>
    </numbers>
</element>

So it is nice that it formats correctly when explicitly running the formatter. It is disruptive when working on deeply nested structures to have my cursor jump all the way to the left when I hit the enter key while editing a FLWOR statement, though.

Anyway, thanks for writing this wonderful plugin. This kind of stuff is just the nit-picky stuff, but thank you for always resolving these issues.

ligasgr commented 10 years ago

Hi,

Thanks for raising the issue. Maybe it's not very serious issue but I know it can be very annoying. I'll try fixing it in the nearest release. Thanks for very good test cases!

ligasgr commented 10 years ago

I believe I was able to fix these issues + some other ones. Please reopen if anything doesn't work as expected or if there are very similar cases which I've missed. It's going to take some time before the release is ready so in the meanwhile you should be able to download and install (install plugin from disk) current version from master. It's available under this link: https://ligasgr.ci.cloudbees.com/job/intellij-xquery-master-prepare-distribution/ws/build/distributions/intellij-xquery.zip

malteseduck commented 10 years ago

That is wonderful, thank you. I will give it a try.

From: ligasgr [mailto:notifications@github.com] Sent: Friday, November 22, 2013 6:23 PM To: ligasgr/intellij-xquery Cc: Chris Cieslinski Subject: Re: [intellij-xquery] FLWOR formatting issues while typing (#74)

I believe I was able to fix these issues + some other ones. Please reopen if anything doesn't work as expected or if there are very similar cases which I've missed. It's going to take some time before the release is ready so in the meanwhile you should be able to download and install (install plugin from disk) current version from master. It's available under this link: https://ligasgr.ci.cloudbees.com/job/intellij-xquery-master-prepare-distribution/ws/build/distributions/intellij-xquery.zip

— Reply to this email directly or view it on GitHub https://github.com/ligasgr/intellij-xquery/issues/74#issuecomment-29122226 .

malteseduck commented 10 years ago

It works wonderfully. It seems to work like I would expect for all those cases. I will continue to use it and let you know if any other cases pop up.

Thanks again.