-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Update python highlighting to take advantage of themes. #2451
Changes from 2 commits
62a6345
1e4a9da
25815df
d5b6bc4
fc84edd
9da79d9
ef740fb
065ab2a
41cfaed
d3ee550
2009d2b
b07f84f
6756086
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
"type" = { fg = "type" } | ||
"type.builtin" = { fg = "type" } | ||
"type.enum.variant" = { fg = "constant" } | ||
"constructor" = { fg = "constant" } | ||
"constructor" = { fg = "type" } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. \cc @kirawi to confirm this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I think that the usage of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The recent commits we made to this PR fixed up the usage of |
||
"variable.other.member" = { fg = "variable" } | ||
|
||
"keyword" = { fg = "blue2" } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are built in functions though (if used with parentheses) https://www.programiz.com/python-programming/methods/built-in/str
VSCode highlights these differently, but I'd argue our highlighting is more precise here since we can distinguish between a type and a built-in function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is true, however, I would respectfully argue that the type changing properties of these functions and their uses for type checking tools like Mypy and Typeguard more closely relate these particular functions to types.
At least in the codebases I am using, these functions are increasingly called to clarify types for type checkers as much as to change types at runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Independently of this (only just found this PR now), I implement some changes to the python highlighting. This touches on type highlighting among other things (parameters, decorators, etc.). I managed to treat
str
and the like as@function.builtin
when being used as a function, and treat them as@type
when being used in type hints. See #2457There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Zeddicus414 if you think this is ready, go ahead and mark this PR as open again.
We've merged in the highlights work in #2457. archseer one of the changes keeps str, int, list, and so on as
@function.builtin
for the cases where they are being called, otherwise they are treated as@type.builtin
. So hopefully that addressed your concern. Hopefully the sequence of commits is not too messy to follow, otherwise let us know if we need to clean things up.