-
Notifications
You must be signed in to change notification settings - Fork 0
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
Python highlight improvements: type, parameter etc #1
Conversation
* str, list, etc. handled as @function.builtin and @type.builtin * None and non-conforming type indentifiers as @type in type hints * class identifiers treated as @type * @constructor used for constructor definitions and calls rather than as a catch-all for type-like things * Parameters highlighted * self and cls as @variable.builtin * improved decorator highlighting as part of @function Re-ordering of some statements to give more accurate priority.
Hey I've decided to chuck everything in at once. Have a try of this. If you are happy then you can merge it, and then take a look at the upstream PR to see if it updates with these new changes. You can reopen your upstream PR if you are happy. |
Hi @paul-scott , thank you so much for being so responsive, I keep looking into issues and not really finding solutions and you are crazy on top of it. Here is the test file I've been using: This doesn't show up like mine did? The Tree-Sitter Playground seems to agree with my copy of helix too: Another fun edge case that might not be fixable: |
You said that you increased the nesting and it didn't help. Did you do that in the above? If I change it to the following it works. ; Handle [] . and | nesting 6 levels deep
(type
(_ [(identifier) (none)]? @type
(_ [(identifier) (none)]? @type
(_ [(identifier) (none)]? @type
(_ [(identifier) (none)]? @type
(_ [(identifier) (none)]? @type
(_ [(identifier) (none)]? @type))))))) As I said I thought it would be prudent to keep it at fewer levels for now. Your test file identified another issue with the decorator colouring. |
You are right. I think I just got my parentheses in the wrong place during the nesting and had siblings rather than nested structures. |
That is expected. If you search the queries for the one with the comment mentioning "nested" you'll see I've only implemented it four deep. If you had something like datetime in this place it similarly wouldn't be highlighted right here. See discussion with Mike in my draft PR about there seeming to not be a nice way to do this. I figured nesting four deep would be good enough for most uses. Neovim only does 1 or 2 levels and is usable.
…On Sat, 14 May 2022, at 06:31, Zeddicus414 wrote:
It looks great! Here is the only problem I see that I haven't been able to track down why it really wants that nested "None" to be blue: image <https://user-images.githubusercontent.com/31261142/168384944-7bfc0092-292c-4c84-b363-dd6ea36418fb.png>
—
Reply to this email directly, view it on GitHub <#1 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ABPBNSLPTNIZXUIRNQFPU3LVJ23YVANCNFSM5V2L74WQ>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
as a catch-all for type-like things
Re-ordering of some statements to give more accurate priority.