Bug 499311 - Symbol Outline out of sync if file is reloaded
Summary: Symbol Outline out of sync if file is reloaded
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (other bugs)
Version First Reported In: Git
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-30 09:37 UTC by Akseli Lahtinen
Modified: 2025-02-21 09:16 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Akseli Lahtinen 2025-01-30 09:37:53 UTC
SUMMARY

If file is reloaded and the amount of lines change, the Symbol Outline is out of sync with the lines, and shows a wrong symbol for the line.

STEPS TO REPRODUCE
1. Open any file with language server that has Symbol Outline
2. Modify the file by adding 100 lines somewhere
3. Make sure the symbol outline shows the correct symbol within those lines
4. Use git or other tool *outside of Kate* to discard the changes
5. Reload the file (do not close and re-open, reload it in place)

OBSERVED RESULT
Symbols in symbol outline get out of sync, and you may get wrong symbol for the line
now that the amount of lines has changed.

EXPECTED RESULT
Symbol outline is refreshed when file is reloaded

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 41
KDE Plasma Version: 6.3.80
KDE Frameworks Version: 6.11.0
Qt Version: 6.8.1
Kernel Version: 6.12.10-200.fc41.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 3600 6-Core Processor
Memory: 15.5 GiB of RAM
Graphics Processor: AMD Radeon RX 6600

ADDITIONAL INFORMATION

Like mentioned above, if the file is closed and re-opened, the symbol outline is in sync again. This only occurs if file is reloaded in-place, for example from the info notification that appears on top of file when Kate notices the file has been externally modified.
Comment 1 Bug Janitor Service 2025-02-20 21:13:42 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/ktexteditor/-/merge_requests/789
Comment 2 Christoph Cullmann 2025-02-20 21:14:01 UTC
My try to fix that needs testing, perhaps it is no good idea.
Comment 3 Waqar Ahmed 2025-02-21 09:16:36 UTC
Git commit 77cbafd60690de3cc7a6d8b33388501dd10257dc by Waqar Ahmed, on behalf of Christoph Cullmann.
Committed on 21/02/2025 at 09:08.
Pushed by waqar into branch 'master'.

don't reset revision on reload but increment it

this avoids that we assume we are back to an old revision even
if the loaded text is totally different

M  +2    -2    autotests/src/katedocument_test.cpp
M  +5    -4    src/buffer/katetextbuffer.cpp
M  +3    -4    src/buffer/katetexthistory.cpp

https://invent.kde.org/frameworks/ktexteditor/-/commit/77cbafd60690de3cc7a6d8b33388501dd10257dc