You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
YAML editor generates wrong EOL characters in Windows #709
When some nested property is added using the "Content Assist" tool of the YAML editor (STS 4.13.0), that is immediately reported by the validator as an error, such as "Nested mappings are not allowed in compact mappings" or "Implicit keys need to be on a single line".
As I found out, that error is caused by the EOL characters generated by the YAML editor, which follow the Linux convention (CR). However, I am running on Windows, and also installed the Windows version of STS (spring-tool-suite-4-4.13.0.RELEASE-e4.22.0-win32.win32.x86_64.self-extracting.jar).
I thought this might be an easy fix for us, but looking a bit closer, I am not so sure. I am not sure which editor is responsible for this error. That doesn't like an STS-specific yaml editor. Anyway... I guess will try to reproduce and dig a little. But since this isn't actually an STS editor (yes the editor is shipped with STS, but it is one probably coming from Eclipse and we do not have direct control over it).
I still have some hope however that there may be some way to control the newline formats indirectly via a preference.
We (@BoykoAlex and me) are not able to reproduce this so far. Here are some questions I do not have answers to:
what editor is being used there? There are two editors that I know of that support yaml, one is YEdit, and the other is called 'Generic Text Editor' (this comes LSP4e and it supports yaml editing).
what is the name / path of the file in the screenshot (This factors into what editor gets used to open a file and what editor features get enabled)
What kind of file is this (is this a spring properties file? Or some other yaml format).
What we tried:
created a spring project
add a 'tap,yaml' file
open the file with both editors (YEdit and 'generic text')
Both those editors seem to work fine and don't report errors entering text as in screenshot.
Neither of these editors looks like the screenshot (the colors are different and the editor doesn't support 'folding').
@aritzbastida Can you try clarifying some of this? Ideally you would write up a sequence of steps that begins with a clean install of STS and leads to producing the problem in question. For example:
install STS
create a new workspace
import this sample project in attachment using 'Import as Existing Maven project'
open the file /foo/bar/tap.yml
notice the errors which are unexpected
type '....' notice that it inserts the wrong kind of newline
I.e to avoid a lot of guess work on our behalf, it is best to try and be as specific as possible as to how you got into the situation shown in the screenshot. We can often fill in some blanks, but at the moment, the blanks are just too many, I have no clue at all what editor you have in that screenshot, and as a result cannot reproduce the problem.
Some more things we tried (with both mentioned editors).
open a file that uses unix convention for newlines and type more lines
open a file that uses windows convention and type more lines
In both cases both editors seems to use the same newline convention as it detects in the existing file. This doesn't cause them to report problems. So this brings up another question. How did you get into a situation where the file has a mix of different newline conventions being used at the same time?
Aha! Okay, so Alex was just able to reproduce something very similar to the bug report. Here are the steps:
create a spring boot project
add an application.yml boot properties file
editing the file using the generic text editor (which enables our spring boot specific support)
add some content that uses windows newlines, just by typing or pasting it in.
So far all works fine.
Now we insert a new property using the autocompletion. If we select a long / nested property, so that it results in the insertion of a multi-line completion text... then the newlines in that completion are using the unix convention. This results in exactly the error as in the bug report.
I'm still not sure this is actually the bug being reported here, but in any case it is:
very similar.
definitely a bug.
something we should be able to fix easily (since these newline do come from our editor completion).
Hi! I just read your comments to this issue! As I can see, you could finally reproduce the bug, but let me explain the steps nonetheless:
Install STS 4.13.0
Create a YAML configuration file with Windows EOL style. For example, application.yml.
Open it with "Generic Editor - Spring YAML Properties". Not the same as "Generic Text Editor". Note also that the snapshot in my original post was made with Notepad++ (not a STS editor), to highlight the EOL markers. Sorry for the confusion.
Use content-assist (Control+Space) to enter some nested property. For example: management.info.env.enabled.
The following error will be shown in the nested properties: "Nested mappings are not allowed in compact mappings"
I'm glad to know that the "bug" comes from your editor completion tool, because that means you can fix it. Hope it's not too difficult 😄
Activity
kdvolder commentedon Jan 11, 2022
I thought this might be an easy fix for us, but looking a bit closer, I am not so sure. I am not sure which editor is responsible for this error. That doesn't like an STS-specific yaml editor. Anyway... I guess will try to reproduce and dig a little. But since this isn't actually an STS editor (yes the editor is shipped with STS, but it is one probably coming from Eclipse and we do not have direct control over it).
I still have some hope however that there may be some way to control the newline formats indirectly via a preference.
kdvolder commentedon Jan 11, 2022
We (@BoykoAlex and me) are not able to reproduce this so far. Here are some questions I do not have answers to:
What we tried:
@aritzbastida Can you try clarifying some of this? Ideally you would write up a sequence of steps that begins with a clean install of STS and leads to producing the problem in question. For example:
/foo/bar/tap.ymlI.e to avoid a lot of guess work on our behalf, it is best to try and be as specific as possible as to how you got into the situation shown in the screenshot. We can often fill in some blanks, but at the moment, the blanks are just too many, I have no clue at all what editor you have in that screenshot, and as a result cannot reproduce the problem.
kdvolder commentedon Jan 11, 2022
Some more things we tried (with both mentioned editors).
In both cases both editors seems to use the same newline convention as it detects in the existing file. This doesn't cause them to report problems. So this brings up another question. How did you get into a situation where the file has a mix of different newline conventions being used at the same time?
kdvolder commentedon Jan 11, 2022
Aha! Okay, so Alex was just able to reproduce something very similar to the bug report. Here are the steps:
application.ymlboot properties fileSo far all works fine.
Now we insert a new property using the autocompletion. If we select a long / nested property, so that it results in the insertion of a multi-line completion text... then the newlines in that completion are using the unix convention. This results in exactly the error as in the bug report.
I'm still not sure this is actually the bug being reported here, but in any case it is:
aritzbastida commentedon Jan 12, 2022
Hi! I just read your comments to this issue! As I can see, you could finally reproduce the bug, but let me explain the steps nonetheless:
I'm glad to know that the "bug" comes from your editor completion tool, because that means you can fix it. Hope it's not too difficult 😄
kdvolder commentedon Jan 12, 2022
Thanks for the clarifications. That clears up the last bit of confusion I had with the screenshot showing a 'unfamiliar' editor.
No. Actually we pushed in a fix already yesterday. So fix should be there in the next release.
kdvolder commentedon Jan 12, 2022
FYI: If you wanted to try something sooner, nighly builds are available here:
https://dist.springsource.com/snapshot/STS4/nightly-distributions.html
aritzbastida commentedon Jan 13, 2022
Thanks for the quick fix!