Bug 487932 - Syntax highlighting breaks if last line is blank
Summary: Syntax highlighting breaks if last line is blank
Status: RESOLVED UPSTREAM
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: 24.02.2
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-02 17:26 UTC by aylamz
Modified: 2024-07-29 07:12 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Adding and deleting an empty line to/from the end of a file in Kate to make the bug appear. (478.51 KB, video/webm)
2024-06-02 17:26 UTC, aylamz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description aylamz 2024-06-02 17:26:18 UTC
Created attachment 170067 [details]
Adding and deleting an empty line to/from the end of a file in Kate to make the bug appear.

SUMMARY
Syntax highlighting breaks if last line is blank or contains only whitespace

STEPS TO REPRODUCE
1.  Open a file that's syntax highlighted
2.  Scroll to the end
3.  Add a new empty line if the last line is not blank

OBSERVED RESULT
Syntax highlighting breaks: functions, etc aren't colored anymore. (See attachment)

EXPECTED RESULT
Syntax highlighting works even if the last line of the file is empty 

SOFTWARE/OS VERSIONS
Linux/KDE Plasma:  Fedora Linux 40
(available in About System)
KDE Plasma Version:  6.0.5
KDE Frameworks Version:  6.2.0
Qt Version:  6.7.1

ADDITIONAL INFORMATION
Also reproduced on the latest git master branch (as of writing this)
Comment 1 Christoph Cullmann 2024-06-20 18:11:45 UTC
Hmm, that is the semantic highlighting info the zig language server sends to us.
Could that be a bug in that? We just send over the content.
Naturally we might handle the response wrong.
Comment 2 aylamz 2024-06-21 06:26:43 UTC
(In reply to Christoph Cullmann from comment #1)
> Hmm, that is the semantic highlighting info the zig language server sends to
> us.
> Could that be a bug in that? We just send over the content.
> Naturally we might handle the response wrong.

Don't know, but I can't reproduce this bug in other text editors such as Helix and VSCodium.
Comment 3 Waqar Ahmed 2024-07-26 17:54:20 UTC
Debugged this a little bit, seems to be a server issue. 

When a range with last line == empty, the server sends over a response which highlights all the comments in the document for some reason??

Filed an issue https://github.com/zigtools/zls/issues/1974
Comment 4 Waqar Ahmed 2024-07-29 07:12:01 UTC
Fixed on the server side, closing.