robotframework / RIDE

Test data editor for Robot Framework
Apache License 2.0
958 stars 378 forks source link

Saving in Text Edit removes all line comments in "Variables" section #2676

Closed p-zander closed 5 months ago

p-zander commented 9 months ago

I think this behavior was introduced in the last release. Tried with RIDE v2.0.8.1 and v2.0.9dev1 on Python 3.10.12

Steps to reproduce:

  1. Add full line comment in Variable section or comment out existing variables
  2. Hit Save or Ctrl+S
p-zander commented 6 months ago

Seems like this was fixed, I can't make out which change actually did it. Leaving open in case you still want to add a test for it or something, but can be closed from my side.

Tested in v2.1dev21

JFoederer commented 5 months ago

I think the issue is still present in 2.1dev22. Or at least a similar issue.

Saving a file with below content...

*** Settings ***
# Comment on resources
Resource          first.resource
Resource          second.resource

# Comment on libraries
Library           third.py
Library           fourth.py

*** Test Cases ***
just one
    No operation

changes it to this:

*** Settings ***
Resource          first.resource
Resource          second.resource
Resource          \
Library           third.py
Library           fourth.py

*** Test Cases ***
just one
    No operation
HelioGuilherme66 commented 5 months ago

This is so tricky. The data model, just removes all lines that are not settings. I don't think it is worth the effort to fix this. Adding comments after Library or Resources is OK.

JFoederer commented 5 months ago

That's a shame. I agree that it isn't an essential fix within the scope of 2.1. Version 2.1 should be about RF7 support and the translations. This issue should be worth the effort at some point, though.

I think there are more issues that are caused by how the model is structured. Some are discussed under issue #1971. One thing mentioned there is working in a team where different people use different editors. That is also what happened in the example I added. Someone writes a test in their editor with comments or different spacing and as soon as I open that file with RIDE the layout changes, giving tons of diffs during the next review. This doesn't help to promote RIDE as an editor in a diverse team, but if that team has both programmers and non-programmers I overall prefer RIDE. But I do not want to force programmers that have Robot integrated in their dev IDE to an additional tool.

Moving back to this specific issue, the extra annoying thing is that it also yields a parser error at load time: Error in file '/home/<..>/DomainLibrary/example.resource' Non-existing setting '# below settings were moved from settings.robot and should be cleaned up'.

By the way, there is no settings.robot involved.