Skip to content

Commit de8c31c

Browse files
Fixed matchin list on TextEditor
1 parent 2b42d24 commit de8c31c

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/robotide/editor/texteditor.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,7 +1243,7 @@ def on_content_assist(self, event):
12431243
# DEBUG: Here, if sugs is still [], then we can get all words from line and repeat suggestions
12441244
# In another evolution, we can use database of words by frequency (considering future by project db)
12451245
sel = [s for s in selected] if selected else ['']
1246-
entry_word = sel[0].split('.')[-1].strip()
1246+
entry_word = sel[0].split('.')[-1].strip() if '.' in sel[0] else sel[0]
12471247
length_entered = len(entry_word) # Because Libraries prefixed
12481248
# print(f"DEBUG: texteditor.py SourceEditor on_content_assist selection = {sel}")
12491249
# if sel[0] == '':
@@ -1276,7 +1276,9 @@ def on_content_assist(self, event):
12761276
found.append(s.name)
12771277
else:
12781278
found.append(s)
1279-
sugs.update(found)
1279+
sugs.update(found)
1280+
print(f"DEBUG: texteditor.py SourceEditor on_content_assist VARIABLES SEARCH selection = {sel}\n"
1281+
f"sugs={sugs}")
12801282
if len(sugs) > 0:
12811283
# sugs = [s for s in sugs if s != '']
12821284
if '' in sugs:

src/robotide/namespace/namespace.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,10 @@ def get_suggestions_for(self, controller, start):
147147
sugs.update(self._keyword_suggestions(datafile, start, ctx))
148148
else:
149149
sugs.update(self._variable_suggestions(controller, start, ctx))
150+
print(f"DEBUG: namespace.py Namespace get_suggestions_for BEFORE CONTENT start={start} {sugs=}")
150151
if not self._looks_like_variable(start): # Search in content
151152
for v in ['${', '@{', '&{', '%{', '$']:
152-
sugs.update(self._content_suggestions(f'{v}{start}'))
153+
sugs.update(self._content_suggestions(f'{v}{utils.normalize(start)}'))
153154
else:
154155
sugs.update(self._content_suggestions(start))
155156
print(f"DEBUG: namespace.py Namespace get_suggestions_for FROM CONTENT start={start} {sugs=}")
@@ -190,16 +191,16 @@ def _content_suggestions(self, start):
190191
if isinstance(v, (TestCaseUserKeywordInfo, ResourceUserKeywordInfo, UserKeywordInfo,
191192
LibraryKeywordInfo, BlockKeywordInfo)):
192193
if v.name.lower().startswith(start.lower()):
193-
sugs.update(v.name)
194+
sugs.add(v.name)
194195
elif isinstance(v, (VariableInfo, ArgumentInfo)):
195196
if v.name_matches(start):
196197
print(f"DEBUG: namespace.py Namespace _content_suggestions SUGGESTION from VARIABLE {v.name=}")
197-
sugs.update(v.name)
198+
sugs.add(v.name)
198199
elif (v.lower().startswith(start.lower()) or v.strip('$&@%{[()]}=').lower()
199200
.startswith(start.strip('$&@%{[()]}=').lower())):
200201
print(f"DEBUG: namespace.py Namespace _content_suggestions SUGGESTION from STRING {v=}"
201202
f"\n v.lower().startswith(start.lower() ={v.lower().startswith(start.lower())}")
202-
sugs.update(v)
203+
sugs.add(v)
203204
return sugs
204205

205206
@staticmethod

0 commit comments

Comments
 (0)