Skip to content

Commit

Permalink
escape $ sign from the completion item
Browse files Browse the repository at this point in the history
  • Loading branch information
dimacodota committed Dec 12, 2020
1 parent 1574d07 commit c5c98a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion completions/completions_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
is_query_after_new_line,
should_return_empty_list,
active_view,
escape_tab_stop_sign,
)

from .commit_completion_handler import handle_completion
Expand Down Expand Up @@ -228,7 +229,9 @@ def get_completion(self):
return [
[
"{}\t{} {}".format(r.get("new_prefix"), ATTRIBUTION_ELEMENT, "tabnine"),
"{}$0{}".format(r.get("new_prefix"), r.get("new_suffix", "")),
"{}$0{}".format(
escape_tab_stop_sign(r.get("new_prefix")), r.get("new_suffix", "")
),
]
for r in self._results
]
Expand Down
5 changes: 5 additions & 0 deletions lib/view_helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sublime
import re

END_LINE_STOP_COMPLETION_CHARACTERS = ",;:"

Expand Down Expand Up @@ -48,3 +49,7 @@ def should_return_empty_list(view, locations, prefix):
or not view.match_selector(locations[0], "source | text")
or is_query_after_new_line(view, locations[0])
)


def escape_tab_stop_sign(value):
return re.sub(r"\$", "\\$", value)

1 comment on commit c5c98a9

@dimacodota
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#93

Please sign in to comment.