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 occur on separate lines #134

Closed rhdunn closed 8 years ago

rhdunn commented 8 years ago

Given:

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

Deleting bar, resulting in:

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

causes the highlighting after the expression to get confused. This also happens when pasting the $foo expression into a new location, or making any other changes to cause the highlighting to update (e.g. adding a space before {$bar}).

NOTE: Loading the XQuery initially (or closing and opening it again after changes have been made) causes the file to be highlighted correctly.

ligasgr commented 8 years ago

Can you please let me know which version of IDE and plugin are you using as I can't seem to be able to reproduce it on the latest code? Also some screenshots and/or video might be helpful.

rhdunn commented 8 years ago

IntelliJ community edition 14.1.5 with intellij-xquery 2.2.1 using Java 1.8 on Windows 7. I'll look at seeing if I can track down what is triggering this issue and the other related highlighting issue.

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>
};

Alter the first XML fragment to:

        <message value="{$value}">
            {$message}</message>

This causes the green attribute value highlighting to extend beyond the closing " character:

xquery-highlight-error-1

This state remains until the file is closed and reopened. Even when:

  1. Deleting the space to restore it to the original formatting.
  2. Deleting the closing " of the value attribute (which shows the expected highlighting for when the attribute is closed).
ligasgr commented 8 years ago

Hi,

Thanks for these examples, they were very helpful. 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 ( #137 ) 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.