ligasgr / intellij-xquery

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

Incorrect highlighting when {} expressions within XML expressions temporarily flag an error #137

Closed rhdunn closed 8 years ago

rhdunn commented 8 years ago

Given:

let $foo := <p>{$bar}</p>

If you start wrapping the $bar expression in a function call, e.g.:

let $foo := <p>{f$bar}</p>

An error is generated at the } as expected, but the formatting gets thrown off (it continues the { expression into </p> and beyond. Finishing the code, e.g.:

let $foo := <p>{foo($bar)}</p>

does not correct the highlighting.

rhdunn commented 8 years ago

NOTE: This is also happening if I reload the page and change:

let $foo := <p>{foo($bar)}</p>

to:

let $foo := <p>{afoo($bar)}</p>
ligasgr commented 8 years ago

Hi Reece,

Thanks for raising all of the issues. It's a great controbution! Without users feeding back I would not be able to improve the plugin! I'll definitely have a look at all of them soon.

Thanks, Grzegorz

ligasgr commented 8 years ago

Hi

I tried to recreate the issue (on latest codebase as I don't know which version you are using) but was unable to. Also I don't fully understand this part of sentence "but the formatting gets thrown off ". Is it formatting or highlighting that you mean? Would you be able to attach some screenshots or a recorded video that shows the error? Also please let me know the version of plugin and Idea/Pycharm/Webstorm/etc... that you are using.

Thanks, Grzegorz

rhdunn commented 8 years ago

The issue is with the highlighting, not formatting, in this issue. For the issue I am seeing, I am using intellij-xquery 2.2.1 with the community edition of IntelliJ 14.1.4 and Java 1.8 on Windows 7. I haven't tested other setups.

The issue I am experiencing (as best I can describe it) is that the green font highlighting used for {...} constructs is flowing past the closing } and into the following XML and XQuery code, causing the code from that point to be incorrectly highlighted.

I'll provide more information on Monday when I have access to the machine I am experiencing this issue on.

rhdunn commented 8 years ago

Given:

declare function createMessage($message, $value) {
    if ($message) then
        <message value="{$value}">{$message}</message>
    else
        <message test="foo">Test</message>
};

Modify {$message} to {f$message}:

xquery-highlight-error-2

This exhibits the same behaviour as the other similar issue (so may be triggering the same underlying bug). I have also noticed that if you modify {$value} to {f$value} first, then delete the inserted f, you don't get the bug when subsequently modifying {$message} to {f$message}.

ligasgr commented 8 years ago

I was able to reproduce the issue on 2.2.1. It was fixes as part of https://github.com/ligasgr/intellij-xquery/issues/117 Can you please check a plugin version from this link which only contains the fix if it solves the issue? Same applies to the other issue ( #134 ) which also should be fixed by this. JetBrains have pretty clear instructions on how to install plugin from disk.

rhdunn commented 8 years ago

117 fixes this issue for me as well.