SUMMARY When a file with a modeline (a rarely mentioned feature of Kate BTW) is opened, the language used for syntax highlighting is set properly, but the status bar keeps the automatically detected one. Moreover, when the user sets the language via the menu shown after clicking the status bar element, the syntax highlighting mechanism switches to the one I chose, but after saving the file with a(n already existent) language-setting modeline, it's switched to that (previous) one, but the status bar still shows the one chosen by the user. STEPS TO REPRODUCE 1. Create a file with an extension known to Kate (e.g., `test.md`). 2. Add a modeline with another language (e.g., `// kate: syntax C`) 3. Hit Ctrl+S. OBSERVED RESULT The syntax highlighting starts using the language defined by the modeline (e.g., C), but the status bar stays the same. EXPECTED RESULT The status bar should show the language really used to highlight the text, one way or another. OPTIONAL FURTHER STEPS 4. Reopen the same file in Kate. SOFTWARE/OS VERSIONS Kate version: 24.12.0 KDE Frameworks version: 6.9.0 Qt version: 6.8.1 ADDITIONAL INFORMATION I didn't test the behavior of LSP when a modeline is used, it may also cause bugs. I also didn't test KWrite and KDevelop. The modeline feature, if it's still there, could be advertised a little more than in a 2006 blog post.
Created attachment 177276 [details] a screenshot I forgot to upload a screenshot from a real-life situation – probably not too frequent in a case like this – an ERB script used to generate a Typst document (in this case, my résumé) in different variants. Since there is more Typst than Ruby in here, I prefer to have Typst syntax highlighting despite the `.erb` extension.
It will work if you write: // kate: mode C So, I think its working as intended atm. However, I think The mode/highlighting difference in Kate is just unnecessary complexity. It just confuses users including myself
It works as expected, the split in mode and highlighting api and ui wise in perhaps not perfect, but altering that might break more stuff than keeping it as is.