Created attachment 141294 [details] With *, syntax SUMMARY Since Python 3, one can enforce the use of keyword arguments in method definitions. This ensures that downstream code is proof against possible future changes to the order of positional arguments. All arguments from a `*,` onwards need to be preceeded with explicit keywords (cf. https://www.vegardstikbakke.com/python-keyword-only/). However, this syntax seems to partly break KDevelop's Python syntax highlighting, with default arguments following the `*,` not being recognised/highlighted anymore. Example: ```python3 import os class Backend: AUTO = None def run( info, tempdir, *, backend = Backend.AUTO, n_processes = os.cpu_count()+1, n_chunks = 1, scaling = 1, cache_name = 'cache', verbose = True, ): pass ``` STEPS TO REPRODUCE 1. Paste a Python code using the keyword-only enforcing `*,` into KDevelop, for instance the above example. 2. Save it as $SOME_FILENAME.py for syntax highlighting to get active. 3. Remove the `*,` and see how syntax highlighting changes OBSERVED RESULT Default arguments after `*,` are not highlighted. Without `*,` they are. EXPECTED RESULT Default arguments should always be highlighted correctly, regardless of whether there is a `*,` or not. SOFTWARE/OS VERSIONS Operating System: KDE neon 5.22 KDE Plasma Version: 5.22.5 KDE Frameworks Version: 5.85.0 Qt Version: 5.15.3 Kernel Version: 5.11.0-27-generic (64-bit) Graphics Platform: Wayland ADDITIONAL INFORMATION Maybe this is rather a problem with KDevelop than with the syntax highlighting framework. If you think so, feel free to move the issue.
Created attachment 141295 [details] Without `*,` syntax
At first I was a bit puzzled by this issue because stopping syntax highlighting first gave me the impression that there was a fault in my code.
Can confirm with KDevelop built from master and kdevelop-python 5.62 from the KDE Neon repos. The highlighting of arguments, class, etc. are provided by kdevelop's python support plugin and the syntax-highlighting framework only provides basic syntax highlighting in this case (e.g. in Kate, only 1, `cache`, and True will be highlighted differently in the parameter list). Moved to kdev-python
Yes, this is a kdevelop-python bug, I can also reproduce it.