Bug 443118 - KDevelop's "Problems" panel should list FIXME/TODO comments for other programming languages
Summary: KDevelop's "Problems" panel should list FIXME/TODO comments for other program...
Status: CONFIRMED
Alias: None
Product: kdevplatform
Classification: Developer tools
Component: problemreporter (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-29 15:02 UTC by Luke Horwell
Modified: 2025-02-24 12:51 UTC (History)
1 user (show)

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


Attachments
TODOs in Problems tool view (59.27 KB, image/png)
2021-09-30 11:14 UTC, Igor Kushnir
Details
Test files for checking TODO functionality (516 bytes, application/gzip)
2021-09-30 11:51 UTC, Luke Horwell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luke Horwell 2021-09-29 15:02:42 UTC
SUMMARY

In KDevelop, a productive addition to the Problems view would be to list actionable comments, like FIXME, TODO and HACK. This could appear under a separate "Comments" (or "Tasks") tab adjacent to the existing "Parser" tab.

This feature should work for comments across multiple languages - starting with // or # - as well as different scopes, like "Current Project" and "Current Document".

There is a "TODO marker words" field in Configure → Language Support, which could be used as the user-configurable list of keywords to determine the lines for listing.


ADDITIONAL INFORMATION

According to the mailing list archive, this was a feature in KDevelop 4.6.0:
https://mail.kde.org/pipermail/kdevelop/2014-February/018244.html

If this feature is already implemented, but is broken, consider this a bug. A quick look in the source code suggests the logic may be there already (todoextractor.cpp), but not hooked up to a tab for display.
Comment 1 Igor Kushnir 2021-09-30 11:14:24 UTC
Created attachment 142026 [details]
TODOs in Problems tool view

TODOs are present in my Problems tool view. Perhaps such comments are not detected with some specific languages or project managers?
Comment 2 Igor Kushnir 2021-09-30 11:19:58 UTC
FIXME comments are also detected. For example:
// TODO: move check into process selection dialog
// FIXME: support non-local URLs

HACK is not supported. I suppose adding one more detectable keyword should be easy enough.
Comment 3 Luke Horwell 2021-09-30 11:48:37 UTC
Thanks for the feedback. Looks like it's specific languages. I'm using Python with a generic project ("KDevGenericManager" according to .kdev4).

I just tried a blank session with some simple hello world files. C and C++ are OK, but other languages/markup like these do not show:

- Python
- JavaScript
- CSS
- HTML

The syntax highlighter - although not directly related - highlights the word HACK in a scary red, so I was under the impression the Problems tab would show these for consistency. Would be a plus to see HACK listed too!

I do observe with a test C file that the Problems tool view doesn't list them after the initial save of a new file, or by changing a new document's highlight to C. They do show and start monitoring the document after switching file tabs.


SOFTWARE/OS VERSIONS

kdevelop: 5.6.2-5
kdevelop-python: 5.6.2-1
Distro: Arch Linux
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.86.0
Qt Version: 5.15.2
Comment 4 Luke Horwell 2021-09-30 11:51:30 UTC
Created attachment 142027 [details]
Test files for checking TODO functionality

If it helps, here's some basic files with comments for testing.
Comment 5 Igor Kushnir 2021-09-30 13:01:06 UTC
> Would be a plus to see HACK listed too!
Turns out that simply adding the word HACK (or any other word one uses to mark problems in code) in Configure->Language Support->{TODO marker words} is enough to make it supported. It could be added to the default list alongside TODO and FIXME.

Patches for HACK and other languages are welcome.
Comment 6 Luke Horwell 2021-11-02 00:27:07 UTC
Looking at the source code again, the file "plugins/clang/duchain/todoextractor.cpp" suggests that Clang is used to extract TODO markers, which would confirm by design it's limited to the C family of languages.

A solution could be to add logic to the problem reporter's model that parses commented lines (for any known language) against the list of TODO markers. Maybe there's something in KTextEditor/KPart/duchain (whichever handles the syntax highlighting) that can help filter a document's lines to comments only.

My C++ is extremely limited, otherwise I'd give it a stab. A workaround for now could be to add an "external script" that executes:  "egrep -n 'FIXME|TODO' %f"