Page 1 of 1

additional line breaks with Ctrl+Shift+P

Posted: Thu Jan 24, 2019 6:12 pm
by Oleksii
Which option could lead to the behaviour that more spaces were automatically added?

Code: Select all

<!--
Do not edit this file directly!
This file is generated automatically by processing
styleguide.ditamap







If you want to change the rules, edit the corresponding sections
marked with audience="rules" in the corresponding topic files.
-->

Re: unexpected formattin behaviour

Posted: Fri Jan 25, 2019 10:39 am
by Radu
Hi,

Do you mean that at some point consecutive new lines were added in this specific XML comment?
From what I know Oxygen would sometimes add line breaks and indenting between XML tags and we have the behavior explained here:

https://www.oxygenxml.com/doc/versions/ ... odes2.html

but Oxygen should never insert such consecutive white spaces inside XML comments when editing the document. Can you reproduce the problem consistently on your side using Oxygen? If you are using a remote storage system (like a CMS) it may be possible that the storage system may have added those extra spaces in the XML comment.

Regards,
Radu

Re: unexpected formattin behaviour

Posted: Fri Feb 01, 2019 1:04 pm
by Oleksii
Hi Radu,

as you see I changed the post topic. The problem occurs under the following conditions:
- add the line break (with Enter)
- then every time after Ctrl+Shift+P, an additional line break is being added

The following setting has obviously an effect on this:
Options > Preferences > Editor > XML > Line Break Tab

I set it to:
Element name/XPath: '//*' with both Before/After checked options.

The reason for this was that for some elements no indentation worked. e.g. for

Code: Select all

<supplied xml:id="supplied_3735" ><dynam xml:id="dynam_3735" staff="4" startid="#note_3630" doxml.id="d28e257">f</dynam>
</supplied>
I wanted the

Code: Select all

<dynam/>
to be on a new line. So probably the solution was not the best. Can you recommend something better?
NB: "Indent inline elements" option is checked.

Best Oleksii
Radu wrote:Hi,

Do you mean that at some point consecutive new lines were added in this specific XML comment?
From what I know Oxygen would sometimes add line breaks and indenting between XML tags and we have the behavior explained here:

https://www.oxygenxml.com/doc/versions/ ... odes2.html

but Oxygen should never insert such consecutive white spaces inside XML comments when editing the document. Can you reproduce the problem consistently on your side using Oxygen? If you are using a remote storage system (like a CMS) it may be possible that the storage system may have added those extra spaces in the XML comment.

Regards,
Radu

Re: additional line breaks with Ctrl+Shift+P

Posted: Fri Feb 01, 2019 3:14 pm
by Radu
Hi Oleksii,

I understand, this looks like a small bug in Oxygen as it should never add consecutive lines if the lines are already there. We'll look into it.
Coming back to your original problem, indeed Oxygen avoids adding spaces or new lines in elements (like in your case <supplied>) which also have text content because it considers that adding spaces there would change the semantic of the element. I'm afraid I do not have a good workaround for you right now.

Regards,
Radu

Re: additional line breaks with Ctrl+Shift+P

Posted: Fri Feb 01, 2019 6:46 pm
by Oleksii
Hi Radu,

my intermediate workaround was to define '//*' for line breaks and uncheck 'Preserve empty lines" bcs. in our .xml we don't need emtpy lines at all. The n added two entries in 'Preserve space' for 'xsl:stylesheet' and 'schematron'. So I could work in those.

But, I found out that the problem is obviously in our schema which does not makes indent after/before <supplied/> (which can have also descendants with no text() ). In the meanwhile before checking the Relax NG XML syntax (do you know maybe what is there responsible for indent) I tried the workaround to pass the XPath

Code: Select all

//supplied/descendant::node()
into 'Line break'. But it doesn't work. Only, if just makes the entries for every single element, e.g. ' slur', 'dynam', etc.

Best Oleksii

Re: additional line breaks with Ctrl+Shift+P

Posted: Mon Feb 04, 2019 10:47 am
by Radu
Hi Oleksii,

The XPath-like expressions which you can set up in the configuration lists should be very simple, for example you should try something like this:

Code: Select all

supplied/*
We do not support full XPath 2.0 expressions because evaluating them would take a long time as each node in the XML document would need to be matched against the expression.

Regards,
Radu

Re: additional line breaks with Ctrl+Shift+P

Posted: Mon Feb 04, 2019 11:51 am
by Oleksii
Thank you, it works.
What a kind of XPath syntax is it and where is it defined?

Re: additional line breaks with Ctrl+Shift+P

Posted: Mon Feb 04, 2019 12:03 pm
by Radu
Hi Oleksii,

This topic in our user's guide discusses about what the XPath-like expressions should look like:

https://www.oxygenxml.com/doc/versions/ ... t-xml.html

Regards,
Radu

Re: additional line breaks with Ctrl+Shift+P

Posted: Mon Feb 04, 2019 6:29 pm
by Oleksii
If I check the box Schema-aware format and indent and delete the schema association, the problem occurs anyway. Strangely, that it occurs only on supplied/descendants::*

Code: Select all

<supplied  xml:id="supplied_d1e1575">
<accid xml:id="accid_d1e1575_01" accid="n"/>
</supplied>
Another question: is there any option to declare elements where the indentation is not allowed?

Re: additional line breaks with Ctrl+Shift+P

Posted: Wed Feb 06, 2019 9:12 am
by Radu
Hi Oleksii,

In the same Oxygen Preferences->"Editor / Format / XML" page there is a "Preserve Space" tab containing a list of space-preserve elements. Is this what you need?

Regards,
Radu

Re: additional line breaks with Ctrl+Shift+P

Posted: Fri May 22, 2020 12:39 pm
by Radu
Hi,

In the recently released Oxygen 22.1 we fixed the bug which added new lines when format and indent was performed.

Regards,
Radu