| Summary: | Spell checking is confused by Python format strings | ||
|---|---|---|---|
| Product: | [Frameworks and Libraries] frameworks-syntax-highlighting | Reporter: | Vitaliy <silverunicorn2011> |
| Component: | syntax | Assignee: | KWrite Developers <kwrite-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | minor | CC: | walter.von.entferndt, waqar.17a |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | https://invent.kde.org/frameworks/syntax-highlighting/-/commit/1676b99f5ac4bd1003126aca048a938c4efc14ff | Version Fixed/Implemented In: | |
| Sentry Crash Report: | |||
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/702 Git commit 1676b99f5ac4bd1003126aca048a938c4efc14ff by Christoph Cullmann, on behalf of Jonathan Poelen. Committed on 24/05/2025 at 12:04. Pushed by cullmann into branch 'master'. Python: add string deliminator highlighting and disable spell checking on them - String Deliminator - F-String Deliminator - B-String Deliminator - Raw F-String Deliminator - Raw String Deliminator - Raw B-String Deliminator M +1 -1 autotests/html/highlight.gdb.dark.html M +1 -1 autotests/html/highlight.gdb.html M +2 -2 autotests/html/highlight.gdbinit.dark.html M +2 -2 autotests/html/highlight.gdbinit.html M +1 -1 autotests/html/highlight.rpy.dark.html M +1 -1 autotests/html/highlight.rpy.html M +1 -1 autotests/html/test.org.dark.html M +1 -1 autotests/html/test.org.html M +48 -48 autotests/html/test.py.dark.html M +48 -48 autotests/html/test.py.html M +1 -1 autotests/reference/highlight.gdb.ref M +2 -2 autotests/reference/highlight.gdbinit.ref M +1 -1 autotests/reference/highlight.rpy.ref M +1 -1 autotests/reference/test.org.ref M +155 -155 autotests/reference/test.py.ref M +106 -97 data/syntax/python.xml https://invent.kde.org/frameworks/syntax-highlighting/-/commit/1676b99f5ac4bd1003126aca048a938c4efc14ff |
SUMMARY When Kate encounters a format string like “f'Some {1} things'”, it highlights the “f'Some” part as misspelled as if the “f'” prefix was part of the first word. It is not very consistent though, e.g. I have two instances of “mbox.setText(f'Can’t ...” and in one place it highlights “f'Can’t” while in the other, it highlights “f'Can” only. Note that it works well with regular quoted strings. STEPS TO REPRODUCE 1. Open Kate or KWrite 2. Create new document 3. Set the document type to Python (saving it as .py does that as well IIUC) 4. Type (not paste) “var = f'Some thing theree'” (without outer quotes) (pasting may not trigger the spell check) OBSERVED RESULT “f'Some” and “theree” highlighted as misspelled. EXPECTED RESULT Only “theree” is highlighted as misspelled. SOFTWARE/OS VERSIONS KDE Plasma Version: 5.26.3 KDE Frameworks Version: 5.101.0 Qt Version: 5.15.7 ADDITIONAL INFORMATION The behavior seems to be the same as with plaintext documents where it IS expected. Also, using “f"” instead of “f'” seems to help.