Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve highlighting of signature parameters when labels are of type string #2072

Merged
merged 9 commits into from
Oct 5, 2022
4 changes: 3 additions & 1 deletion plugin/core/signature_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from .views import minihtml
import functools
import html
import re
import sublime


Expand Down Expand Up @@ -115,7 +116,8 @@ def _render_label(self, view: sublime.View, signature: SignatureInformation) ->
# route relies on the client being smart enough to figure where the parameter is inside of
# the signature label. The above case where the label is a tuple of (start, end) positions is much
# more robust.
start = label[prev:].find(rawlabel)
label_match = re.search(r"\b{}\b".format(re.escape(rawlabel)), label[prev:])
start = label_match.start() if label_match else label[prev:].find(rawlabel)
if start == -1:
debug("no match found for {}".format(rawlabel))
continue
Expand Down