Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions src/textual/tree-sitter/highlights/python.scm
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
(interpolation) @none

;; Identifier naming conventions
((identifier) @type
(#match? @type "^[A-Z].*[a-z]"))
((identifier) @constant
(#match? @constant "^[A-Z][A-Z_0-9]*$"))
Comment on lines 12 to -16
Copy link
Collaborator

Choose a reason for hiding this comment

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

This follows naming conventions as mentioned in the comment above.

Here's a simple example of variables with different casings in Python:

score = 999
Score = 999
SCORE = 999

Notice the syntax highlighting on GitHub and the screenshot below from Neovim:

image


((attribute
attribute: (identifier) @field)
(#match? @field "^([A-Z])@!.*$"))
;; ((identifier) @type
;; (#match? @type "^[A-Z].*[a-z]"))
;; ((identifier) @constant
;; (#match? @constant "^[A-Z][A-Z_0-9]*$"))
;;
;; ((attribute
;; attribute: (identifier) @field)
;; (#match? @field "^([A-Z])@!.*$"))

((identifier) @type.builtin
(#any-of? @type.builtin
Expand Down Expand Up @@ -57,14 +57,14 @@
function: (attribute
attribute: (identifier) @method.call))

((call
function: (identifier) @constructor)
(#match? @constructor "^[A-Z]"))

((call
function: (attribute
attribute: (identifier) @constructor))
(#match? @constructor "^[A-Z]"))
;; ((call
;; function: (identifier) @constructor)
;; (#match? @constructor "^[A-Z]"))
;;
;; ((call
;; function: (attribute
;; attribute: (identifier) @constructor))
;; (#match? @constructor "^[A-Z]"))

;; Decorators

Expand Down