I'd like to ask/discuss if `self` could be added as a keyword in the geany syntax highlighter.
While it is a convention and technically not a keyword, it is used as a defacto keyword. It is used and treated as a keyword in teaching materials, including the official python [documentation](https://docs.python.org/3/library/dataclasses.html) whose syntax highlighter also highlights it as a keyword.
Most syntax highlighters and text editors consider it to be a keyword.
[KDE/QT](https://invent.kde.org/frameworks/syntax-highlighting/-/blob/master/data/syn...): Kate/Kwrite, KDevelop, QTCreator, Featherpad, etc [GtkSourceView](https://gitlab.gnome.org/GNOME/gtksourceview/-/blob/master/data/language-spe...): Gedit, Gnome Text, Gnome Builder, Mousepad, etc CudaText, Lazarus, and other Lazarus or SynEdit based apps [VSCode](https://github.com/microsoft/vscode-textmate/blob/main/test-cases/themes/syn...) Sublime Text PyCharm
Anyway, I just wanted to put this up as a discussion. I set it as a draft for that reason.
If it is able to be added, please let me know if my changes here are enough. I think I made changes in all the places I needed to.
Thanks! You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/3023
-- Commit Summary --
* Adds 'self' as keyword for Python syntax highlighting
-- File Changes --
M data/filedefs/filetypes.Cython.conf (2) M data/filedefs/filetypes.python.in (2) M scripts/update-python-identifiers.sh (2)
-- Patch Links --
https://github.com/geany/geany/pull/3023.patch https://github.com/geany/geany/pull/3023.diff
My intuitive thought was: no. But this is probably mainly driven because I'm used to have it styled as a normal identifier and because I personally do not consider it a keyword.
From a less subjective perspective, it makes sense, especially because the Python docs do it as well and I could imagine most people think of self as a keyword (though it is not technically, as you said).
Your changes look good to me, nice that you found and adjusted the update script!
github-comments@lists.geany.org