Skip to content

Commit 5c485d1

Browse files
andfoytomv564
authored andcommitted
Prevent selection of CompletionItem hint if its label is empty
1 parent 37068be commit 5c485d1

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
LSP.sublime-workspace
22
LSP.sublime-project
3-
.mypy_cache
3+
.mypy_cache
4+
.ropeproject

plugin/completion.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def format_completion(self, item: dict) -> 'Tuple[str, str]':
239239
hint = completion_item_kind_names[kind]
240240
# label is an alternative for insertText if insertText not provided
241241
insert_text = item.get("insertText") or label
242-
if insert_text[0] == '$': # sublime needs leading '$' escaped.
242+
if len(insert_text) > 0 and insert_text[0] == '$': # sublime needs leading '$' escaped.
243243
insert_text = '\$' + insert_text[1:]
244244
# only return label with a hint if available
245245
return "\t ".join((label, hint)) if hint else label, insert_text

0 commit comments

Comments
 (0)