Skip to content

Commit b144e93

Browse files
Improve docinfo (#2972)
* Change some imports to use installed robot * Use installed Robot Framework libraries in libdoc import modules * Add attributes and is_private for UserKeywords * Show private keyword setting in ItemInfo Details * Sort list of suggestions, fix left, right arrows. WIP use Tab to select and edit. DEBUG * ENTER fills cell with selection. Tab to select and keep edit working, WIP * Fixed list selection in Cell Editor. Values in Grid not saved to model WIP * Update documentation * DEBUG test_namespace * DEBUG XML SPEC Import * Skip some XML SPEC Import unit tests * Condition utests on Windows * Correct colorization for private kws from different files. Need to condition by Keywords table. * Fix unit tests * conditions different file and Keywords. WIP * Complete solution for private keywords. Need to fix indication of modified items * Update CHANGELOG
1 parent 3b5428c commit b144e93

35 files changed

+528
-185
lines changed

CHANGELOG.adoc

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,19 @@ All notable changes to this project will be documented in this file.
66
The format is based on http://keepachangelog.com/en/1.0.0/[Keep a Changelog]
77
and this project adheres to http://semver.org/spec/v2.0.0.html[Semantic Versioning].
88

9-
// == https://github.com/robotframework/RIDE[Unreleased]
9+
== https://github.com/robotframework/RIDE[Unreleased]
10+
11+
=== Added
12+
- Added indication of *private* keywords in Grid Editor, keywords will show in _Italic_, and with error
13+
background, when they are used outside of Keywords section, or from different files.
14+
15+
- Added indication of *private* keywords in Details pop-up for keywords with tag *robot:private* or name starting with underscore, *'_'* in Grid Editor.
16+
17+
=== Changed
18+
- Modified the action of key TAB when selecting from auto-suggestions list in Grid Editor. Pressing TAB, selects the item and continues in cell editor.
19+
20+
=== Fixed
21+
- Fix cursor position when editing cells in Grid Editor.
1022

1123
== https://github.com/robotframework/RIDE/blob/master/doc/releasenotes/ride-2.1.4.1.rst[2.1.4.1] - 2025-06-24
1224

src/robotide/application/CHANGELOG.html

Lines changed: 65 additions & 56 deletions
Large diffs are not rendered by default.

src/robotide/application/releasenotes.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,13 @@ def set_content(self, html_win, content):
172172
</ul>
173173
<p><strong>New Features and Fixes Highlights</strong></p>
174174
<ul class="simple">
175+
<li>Added indication of <b>private</b> keywords in Grid Editor, keywords will show in <em>Italic</em>, and with error
176+
background, when they are used outside of Keywords section, or from different files.</li>
177+
<li>Added indication of <b>private</b> keywords in Details pop-up for keywords with tag <b>robot:private</b> or name starting
178+
with underscore, <b>'_'</b> in Grid Editor.</li>
179+
<li>Modified the action of key TAB when selecting from auto-suggestions list in Grid Editor. Pressing TAB, selects the
180+
item and continues in cell editor.</li>
181+
<li>Fix cursor position when editing cells in Grid Editor.</li>
175182
<li>Fix broken installation of RIDE v2.1.4 by adding missing dependencies.</li>
176183
<li>Added <b>Tools-&gt;Library Finder...</b> to install libraries and <b>Help-&gt;Open Library Documentation...</b> .
177184
They share the same dialog, and definitions are recorded in ``settings.cfg``.</li>
@@ -248,7 +255,7 @@ def set_content(self, html_win, content):
248255
<pre class="literal-block">python -m robotide.postinstall -install</pre>
249256
<p>or</p>
250257
<pre class="literal-block">ride_postinstall.py -install</pre>
251-
<p>RIDE {VERSION} was released on 24/June/2025.</p>
258+
<p>RIDE {VERSION} was released on 17/July/2025.</p>
252259
<!-- <br/>
253260
<h3>May The Fourth Be With You!</h3>
254261
<h3>Celebrate the bank holiday, 10th June, Day of Portugal, Portuguese Communities and Camões!!</h3>

src/robotide/controller/basecontroller.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,14 @@ def clear_namespace_update_listeners(self):
103103
self.namespace.clear_update_listeners()
104104

105105
def is_user_keyword(self, datafile, value):
106-
return self.namespace.is_user_keyword(datafile, value)
106+
user_kw = self.namespace.is_user_keyword(datafile, value)
107+
if user_kw:
108+
private=self.is_private(datafile, value)
109+
# print(f"DEBUG: basecontroller.py is_user_keyword CALLED is_private=={private} datafile={datafile.source}")
110+
return user_kw # self.namespace.is_user_keyword(datafile, value)
111+
112+
def is_private(self, datafile, value):
113+
return self.namespace.is_private(datafile, value)
107114

108115
def is_library_keyword(self, datafile, value):
109116
return self.namespace.is_library_keyword(datafile, value)
@@ -115,6 +122,7 @@ def get_all_cached_library_names(self):
115122
return self.namespace.get_all_cached_library_names()
116123

117124
def keyword_info(self, datafile, keyword_name):
125+
# print(f"DEBUG: basecontroller.py WithNamespace keyword_info call find_keyword keyword_name={keyword_name}")
118126
return self.namespace.find_keyword(datafile, keyword_name)
119127

120128
def is_library_import_ok(self, imp):

src/robotide/controller/cellinfo.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,25 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16+
from enum import Enum, auto
1617
from ..action.shortcut import localize_shortcuts
1718
from ..utils import highlightmatcher, html_escape
1819

1920
CTRL_LABEL = localize_shortcuts('CtrlCmd')
2021

2122

23+
class PrivateError(Enum):
24+
no_error = auto()
25+
invalid = auto()
26+
27+
2228
class CellInfo(object):
2329

2430
def __init__(self, cell_content, cell_position, for_loop=False):
2531
self._cell_content = cell_content
2632
self._cell_position = cell_position
2733
self.for_loop = for_loop
34+
self._error_state = PrivateError.no_error
2835

2936
@property
3037
def content_type(self):
@@ -38,12 +45,22 @@ def cell_type(self):
3845
def source(self):
3946
return self._cell_content.source
4047

48+
@property
49+
def private(self):
50+
return self._cell_content.private
51+
4152
@property
4253
def arg_name(self):
4354
return self._cell_position.argument_name
4455

4556
def has_error(self):
46-
return self.argument_missing() or self.too_many_arguments()
57+
return self.argument_missing() or self.too_many_arguments() or self._error_state == PrivateError.invalid
58+
59+
def set_or_clear_error(self, mode=False):
60+
if mode:
61+
self._error_state = PrivateError.invalid
62+
else:
63+
self._error_state = PrivateError.no_error
4764

4865
def argument_missing(self):
4966
return self.cell_type == CellType.MANDATORY \
@@ -137,10 +154,11 @@ def __str__(self):
137154

138155
class CellContent(object):
139156

140-
def __init__(self, ctype, value, source=None):
157+
def __init__(self, ctype, value, source=None, private=False):
141158
self.type = ctype
142159
self.value = value
143160
self.source = source
161+
self.private = private
144162

145163

146164
class CellPosition(object):

src/robotide/controller/filecontrollers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ def is_library_keyword(self, datafile, value):
275275

276276
def keyword_info(self, datafile, keyword_name):
277277
_ = datafile
278+
# print(f"DEBUG: filecontrollers.py _DataController keyword_info call keyword_info keyword_name={keyword_name}")
278279
return WithNamespace.keyword_info(self, self.data, keyword_name)
279280

280281
def mark_dirty(self):

src/robotide/controller/macrocontrollers.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,16 @@ def get_cell_info(self, row, col):
177177
steps = self.steps
178178
if row < 0 or len(steps) <= row:
179179
return None
180+
# print(f"DEBUG: macrocontrollers.py WithStepsController call get_cell_info row={row} col={col}")
180181
return steps[row].get_cell_info(col)
181182

182183
def get_keyword_info(self, kw_name):
184+
# print(f"DEBUG: macrocontrollers.py WithStepsController get_keyword_info call keyword_info kw_name={kw_name}")
183185
return self.datafile_controller.keyword_info(None, kw_name)
184186

185187
def is_user_keyword(self, value):
188+
# print(f"DEBUG: macrocontrollers.py WithStepsController is_user_keyword call "
189+
# f"DATAFILE_CONTROLER.is_user_keyword value={value}, source={self.datafile_controller.source}")
186190
return self.datafile_controller.is_user_keyword(None, value)
187191

188192
def is_library_keyword(self, value):
@@ -499,6 +503,10 @@ def teardown(self):
499503
def arguments(self):
500504
return ArgumentsController(self, self.kw.args)
501505

506+
@property
507+
def is_private_keyword(self):
508+
return self.kw.is_private_keyword
509+
502510
def validate_keyword_name(self, name):
503511
return self._parent.validate_name(name)
504512

src/robotide/controller/stepcontrollers.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,13 @@ def _change_last_empty_to_empty_var(args, comment):
8787
def get_keyword_info(self, kw):
8888
if not kw:
8989
return None
90-
return self.parent.get_keyword_info(kw)
90+
# print(f"DEBUG: stepcontrollers.py StepController get_keyword_info call parent kw={kw}")
91+
kw_info = self.parent.get_keyword_info(kw)
92+
if kw_info: # and kw_info.type == CellType.KEYWORD:
93+
private = kw_info.is_private_keyword
94+
# print(f"DEBUG: stepcontrollers.py StepController get_keyword_info called parent get_keyword_info kw_info={kw_info} "
95+
# f"kw={kw} is PRIVATE?=={private}")
96+
return kw_info
9197

9298
def __eq__(self, other):
9399
if self is other:
@@ -115,6 +121,7 @@ def get_value(self, col):
115121
def get_cell_info(self, col):
116122
position = self._get_cell_position(col)
117123
content = self._get_content_with_type(col, position)
124+
# print(f"DEBUG: stepcontrollers.py StepController call get_cell_info col={col} content.type={content.type}")
118125
if content.type == ContentType.COMMENTED:
119126
return self._build_cell_info(content, CellPosition(CellType.OPTIONAL, None))
120127
return self._build_cell_info(content, position)
@@ -132,6 +139,7 @@ def is_assigning(self, value):
132139
return False
133140

134141
def _build_cell_info(self, content, position):
142+
# print(f"DEBUG: stepcontrollers.py StepController _build_cell_info call CellInfo content={content} position={position}")
135143
return CellInfo(content, position)
136144

137145
def _get_cell_position(self, column):
@@ -244,13 +252,13 @@ def _get_content_with_type(self, col, position):
244252
return CellContent(ContentType.UNKNOWN_VARIABLE, value)
245253
return CellContent(ContentType.VARIABLE, value)
246254
if self.is_user_keyword(value):
247-
return CellContent(
248-
ContentType.USER_KEYWORD, value,
249-
self.get_keyword_info(value).source)
255+
kw_info = self.get_keyword_info(value)
256+
source = kw_info.source
257+
# print(f"DEBUG: stepcontrollers.py StepController file={self.display_name} "
258+
# f"call get_keyword_info value={value}, source={source} PRIVATE={kw_info.private}")
259+
return CellContent(ContentType.USER_KEYWORD, value, source=source, private=kw_info.private)
250260
if self.is_library_keyword(value):
251-
return CellContent(
252-
ContentType.LIBRARY_KEYWORD, value,
253-
self.get_keyword_info(value).source)
261+
return CellContent(ContentType.LIBRARY_KEYWORD, value, source=self.get_keyword_info(value).source)
254262
if value == 'END': # DEBUG Don't consider start column (col == 0 and)
255263
return CellContent(ContentType.END, value)
256264
return CellContent(ContentType.STRING, value)
@@ -284,6 +292,8 @@ def is_modifiable(self):
284292
return self.datafile_controller.is_modifiable()
285293

286294
def is_user_keyword(self, value):
295+
# print(f"DEBUG: stepcontrollers.py StepController is_user_keyword CALL parent.is_user_keyword"
296+
# f" = {self.parent.source}")
287297
return self.parent.is_user_keyword(value)
288298

289299
def is_library_keyword(self, value):
@@ -297,7 +307,7 @@ def contains_variable(self, name):
297307
return any(variablematcher.value_contains_variable(item, name)
298308
for item in self.as_list())
299309

300-
def contains_variable_assignment(self, name):
310+
def contains_variable_assignment(self, name): # TODO: Consider first cell if variable and FOR assignments
301311
return any(variablematcher.value_contains_variable(item, "%s=" % name)
302312
for item in self.as_list())
303313

src/robotide/editor/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ def on_uncomment_cells(self, event):
307307

308308
def on_content_assistance(self, event):
309309
__ = event
310+
print(f"DEBUG: init.py _EditorTab on_content_assistance event={event}")
310311
self.editor.show_content_assist()
311312

312313
def save(self, message=None):

0 commit comments

Comments
 (0)