robotframework / RIDE

Test data editor for Robot Framework
Apache License 2.0
968 stars 382 forks source link

Grid editor fails to load when commented out keywords have arguments #2527

Closed JFoederer closed 1 year ago

JFoederer commented 1 year ago

After the upgrade to RIDE2.0b3 (Linux Python 3.8) I opened an existing robot file in the test suite tree view and selected the first test in the file. The Grid editor stayed completely empty image

The part causing the failure was a line the had a commented out keyword, using a #, that also had arguments. A line that read #keyword with two args first_arg second_arg changed into #keyword with two args after editing the file using the Text editor (I removed an empty variables section). Adding back a single argument directly in the file using an external editor reintroduced the issue in RIDE.

This is the traceback as reported in the RIDE log:

Traceback (most recent call last):
None
  File "/home/this_user/.local/lib/python3.8/site-packages/pubsub/core/topicobj.py", line 482, in __sendMessage
    listener(data, self, allData)
  File "/home/this_user/.local/lib/python3.8/site-packages/pubsub/core/listener.py", line 237, in __call__
    cb(**kwargs)
  File "/home/this_user/.local/lib/python3.8/site-packages/robotide/editor/__init__.py", line 156, in OnTabChanged
    self._show_editor()
  File "/home/this_user/.local/lib/python3.8/site-packages/robotide/editor/__init__.py", line 129, in _show_editor
    self._editor = self._create_editor()
  File "/home/this_user/.local/lib/python3.8/site-packages/robotide/editor/__init__.py", line 133, in _create_editor
    return self._creator.editor_for(self, self._tab, self.tree)
  File "/home/this_user/.local/lib/python3.8/site-packages/robotide/editor/editorcreator.py", line 53, in editor_for
    self._editor = self._create_editor(editor_panel, plugin, tree)
  File "/home/this_user/.local/lib/python3.8/site-packages/robotide/editor/editorcreator.py", line 70, in _create_editor
    return self._create_new_editor(_controller, editor_panel, plugin, tree)
  File "/home/this_user/.local/lib/python3.8/site-packages/robotide/editor/editorcreator.py", line 88, in _create_new_editor
    return editor_class(plugin, editor_panel, _controller, tree)
  File "/home/this_user/.local/lib/python3.8/site-packages/robotide/editor/editors.py", line 94, in __init__
    self._populate()
  File "/home/this_user/.local/lib/python3.8/site-packages/robotide/editor/macroeditors.py", line 32, in _populate
    self._create_kweditor()
  File "/home/this_user/.local/lib/python3.8/site-packages/robotide/editor/macroeditors.py", line 36, in _create_kweditor
    self.kweditor = KeywordEditor(self, self.controller, self._tree)
  File "/home/this_user/.local/lib/python3.8/site-packages/robotide/editor/kweditor.py", line 109, in __init__
    max((controller.max_columns + 1), 5),
  File "/home/this_user/.local/lib/python3.8/site-packages/robotide/controller/macrocontrollers.py", line 123, in max_columns
    return max(chain((len(step) for step in self.steps), [0]))
  File "/home/this_user/.local/lib/python3.8/site-packages/robotide/controller/macrocontrollers.py", line 123, in <genexpr>
    return max(chain((len(step) for step in self.steps), [0]))
  File "/home/this_user/.local/lib/python3.8/site-packages/robotide/controller/stepcontrollers.py", line 572, in __len__
    return len(self._step)
  File "/home/this_user/.local/lib/python3.8/site-packages/robotide/lib/robot/parsing/model.py", line 1017, in __len__
    assert seglen == cells_len
JFoederer commented 1 year ago

Duplicate of #2526