Page 1 of 1

Problems with XQuery code completion

Posted: Tue Jul 12, 2016 4:06 pm
by Martin Honnen
I am using oXygen 18 and want to create XQuery files, so open a new document selecting type XQuery and start typing, the query I want to write is

Code: Select all

<root>
{
(1 to 5) ! <item>{.}</item>
}
</root>
so I start typing the opening

Code: Select all

<root>
and it is completed to

Code: Select all

<root></root>
which is fine so far, but I would like the caret to be inside of the element and not after the end tag.

Is there any way to configure the XQuery editor to position the caret inside of an element when it has added an end tag?

Then I go on and add the curly braces and start typing the code inside it, only when I want to type the inner start tag of the "item" element i.e. have typed

Code: Select all


<root>
{
(1 to 5) ! <
}
</root>
the editor completes that to

Code: Select all


<root>
{
(1 to 5) ! </root>
}
</root>
and directly underlines the "(1 to 5) ! </root>" as as syntax error "XPST0003: Unmatched XML end tag".

So that really is the wrong approach to code completion, inside the curly braces there should be no attempt to close an element outside of the curly braces.

Is there any way to change the XQuery code editor settings to prevent it from throwing in the unwanted "</root>" start tag?

I want to type the "<item>" start tag there undisturbed and have it completed by an end tag "</item>".

Re: Problems with XQuery code completion

Posted: Tue Jul 12, 2016 7:02 pm
by adrian
Hello,
Is there any way to configure the XQuery editor to position the caret inside of an element when it has added an end tag?
No. But as far as I can tell the current behavior is not as intended. I've logged this bug to our issue tracking tool, to position the caret correctly, between the tags.
So that really is the wrong approach to code completion, inside the curly braces there should be no attempt to close an element outside of the curly braces.
This is yet another bug. I've also logged this one to our issue tracking tool.
Is there any way to change the XQuery code editor settings to prevent it from throwing in the unwanted "</root>" start tag?
Yes, but it is a global option, so it means you are completely disabling the automatic tag closing feature everywhere else (including for XML editing), so I'm not sure if that's useful (Options > Preferences, Editor > Content Completion, "Auto close the last opened tag").

We will notify this thread when the issues are resolved.

Regards,
Adrian