Bug 458775

Summary: File type detection fails on reload after external change
Product: [Applications] kate Reporter: Duncan <kde.bugs>
Component: applicationAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: normal CC: loh.tar
Priority: NOR    
Version First Reported In: 22.04.3   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Screen capture of issue

Description Duncan 2022-09-06 06:41:34 UTC
SUMMARY
Mutating a file outside of Kate causes Kate to offer a reload option. Taking that option will result in Kate "forgetting" that the file is of a particular type (Python in my case), and disables type-specific behaviours like syntax highlighting and LSP usage.

STEPS TO REPRODUCE
1. Install pylsp
2. Install black, flake8 plugins for pylsp
3. Edit a python file with Kate - ensure the file type is detected as Python, with syntax highlighting etc
4. Save the file with content that black will fix (extra long lines or whatever)
5. Mutate the file outside of Kate with black <filename>
6. Back to Kate, accept the reload of the file

OBSERVED RESULT

Syntax highlighting and LSP support stop working; Kate appears to treat the file as text/plain, not Python. Detected language in the bottom right is still Python.

Clicking the detected language, and then clicking the already-ticked Python causes Kate to re-apply syntax highlighting and LSP support for Python.

EXPECTED RESULT

Upon reload, Kate considers the file to be Python still, with syntax highlighting and LSP support.

SOFTWARE/OS VERSIONS
Operating System: Kubuntu 22.04
KDE Plasma Version: 5.24.6
KDE Frameworks Version: 5.95.0
Qt Version: 5.15.3
Kernel Version: 5.15.0-47-generic (64-bit)
Graphics Platform: X11
Processors: 24 × AMD Ryzen 9 5900X 12-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 3060 Ti/PCIe/SSE2

ADDITIONAL INFORMATION
Comment 1 Duncan 2022-09-06 06:45:28 UTC
Created attachment 151860 [details]
Screen capture of issue
Comment 2 Lothar 2022-09-29 07:43:56 UTC
Yes, I'm annoyed by this since a while too but find not the drive to dig into this.
Comment 3 Lothar 2022-09-29 08:29:01 UTC

*** This bug has been marked as a duplicate of bug 454715 ***