-
Notifications
You must be signed in to change notification settings - Fork 1
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
Differentiate between tag and valuie #7
Comments
I've made a regex with named groups:
example usagedocstr = """
:par32ram arg1: description
:param arg2: description
:type arg1: type description
:type arg1: type description
:return: return description
:rtype: the return type description
"""
for line in docstr.split("\n"):
match = re.search(
r"(?P<open>:)(?P<tag>[A-z]{1,}[A-z0-9]*?)[\s]*?(?P<argument>[A-z]{1,}[A-z0-9]*?)?(?P<close>:)",
line
)
if match:
print(match.groupdict()) output{'open': ':', 'tag': 'par4m', 'argument': 'arg1', 'close': ':'}
{'open': ':', 'tag': 'param1', 'argument': 'arg2', 'close': ':'}
{'open': ':', 'tag': 'type', 'argument': 'arg1', 'close': ':'}
{'open': ':', 'tag': 'type', 'argument': 'arg1', 'close': ':'}
{'open': ':', 'tag': 'return', 'argument': None, 'close': ':'}
{'open': ':', 'tag': 'rtype', 'argument': None, 'close': ':'} |
Both VS Code and TextMate allegedly support named RegEx groups, but I have been unable to make them work in VS Code grammar definitions, so I will have to keep using indices to identify capture groups. I have introduced the I have pushed the above changes to the Please do let me know if you encounter any other issues with the current parsing behaviour. I originally created this extension to help me navigate my own projects, and scope name selection was therefore often governed by what provided good contrast in the themes I used most. |
Closing as this was implemented in fe1d69b. |
Thank you! Any ETA on releasing the update to marketplace? |
1 similar comment
Thank you! Any ETA on releasing the update to marketplace? |
I just published v0.2.0 on the VS Code Marketplace containing the new additions. It might take a few hours before it shows up due to caching, but it should become available to you over the course of the day. Thank you for the contributions! |
Thank you for fast response and great extension! |
Problem
I'm porting Darcula theme from PyCharm and trying to achieve same look for docstrings.
Your extension works like a charm, however it doesn't differentiate between tag and its value, making it impossible to replicate PyCharm look, or do other customisations (e.g. highlight only param value, or highlight it s source):
Details
My current json settings:
Inspector:
Proposal
Introduce separate scope for tag value, e.g.
entity.name.tag.value
Thank you for the awesome extension!
The text was updated successfully, but these errors were encountered: