[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#67061: [PATCH] Improve syntax highlighting for python-ts-mode
From: |
Denis Zubarev |
Subject: |
bug#67061: [PATCH] Improve syntax highlighting for python-ts-mode |
Date: |
Sun, 10 Dec 2023 15:04:51 +0300 |
> Arguably, the last 2 lines are "variable references" rather than definitions
`var := 3` is assignment expressions. It allows variable assignments to occur inside of larger expressions. For example `if (match := pattern.search(data)) is not None:`.
It mostly used to define new variables and act on them if some condition is met.
My rationale for `var *= 3` was that it is shorthand for `var = var * 3` and currently the `var` on the left hand side is fontified with `font-lock-variable-name-face`.
I wanted shorthand form to be consistent with the full form.
Your point makes sense too, I don't have strong opinion about this.
Also I'm not sure now about `var[ii] = 1`, since it is actually accessing the list or dictionary element and `font-lock-variable-use-face` may suit better here.
Question about new changes.
Should I push them to this patch and provide description of new changes,
or it would be better to wait for review and send them as new patch?
On 09/12/2023 02:39, Denis Zubarev wrote:
assignment feature:
For all examples,
`for var in range(3)`
`var1[ii] = 1; t.var2[jj] = 2`
`var := 3`
`var *= 3`
highlight var as font-lock-variable-name-face
Arguably, the last 2 lines are "variable references" rather than
definitions (so font-lock-variable-use-face might make more sense),
since such operators imply that a variable has already been defined
previously.
And python--treesit-fontify-variable (in the 'variable' feature) already
applies that face.
The first example, however, should indeed use font-lock-variable-name-face.
- bug#67061: [PATCH] Improve syntax highlighting for python-ts-mode, Denis Zubarev, 2023/12/08
- bug#67061: [PATCH] Improve syntax highlighting for python-ts-mode, Eli Zaretskii, 2023/12/09
- bug#67061: [PATCH] Improve syntax highlighting for python-ts-mode, Dmitry Gutov, 2023/12/09
- bug#67061: [PATCH] Improve syntax highlighting for python-ts-mode,
Denis Zubarev <=
- bug#67061: [PATCH] Improve syntax highlighting for python-ts-mode, Dmitry Gutov, 2023/12/10
- bug#67061: [PATCH] Improve syntax highlighting for python-ts-mode, Yuan Fu, 2023/12/11
- bug#67061: [PATCH] Improve syntax highlighting for python-ts-mode, Dmitry Gutov, 2023/12/11
- bug#67061: [PATCH] Improve syntax highlighting for python-ts-mode, Denis Zubarev, 2023/12/11
- bug#67061: [PATCH] Improve syntax highlighting for python-ts-mode, Yuan Fu, 2023/12/12
- bug#67061: [PATCH] Improve syntax highlighting for python-ts-mode, Dmitry Gutov, 2023/12/12
- bug#67061: [PATCH] Improve syntax highlighting for python-ts-mode, Yuan Fu, 2023/12/12
- bug#67061: [PATCH] Improve syntax highlighting for python-ts-mode, Dmitry Gutov, 2023/12/13
- bug#67061: [PATCH] Improve syntax highlighting for python-ts-mode, Yuan Fu, 2023/12/14
- bug#67061: [PATCH] Improve syntax highlighting for python-ts-mode, Dmitry Gutov, 2023/12/14