-
Notifications
You must be signed in to change notification settings - Fork 60
Description
When working with C/C++ code using CDT LSP (which uses the C/C++ grammar and language configuration from TM4E), I found some cases where task tags are not detected in C++ comments where I would expected them to be detected.
Steps to reproduce
- Install CDT LSP 3.4 and TM4E 0.17.1
- Take the following C++ code example and open it the LSP-based C++ editor
- Check the Tasks view and the markers on the left side of the editor
// TODO task 1
class SomeClass
{
// TODO task 2
public:
// TODO task 3
void f1() // TODO task 4
{
// TODO task 5
if (true) // TODO task 6
{
// TODO task 7
bool value = false; // TODO task 8
// TODO task 9
}
// TODO task 10
}
// TODO task 11
};
// TODO task 12Expected result: All tasks (1 - 12) should be listed in the Tasks view and should be marked on the left side of the editor.
Actual result: Only tasks 1, 2, 3, 11, 12 are listed in the tasks view and marked in the editor, see Screenshot:
Environment
- TM4E 0.17.1
- CDT LSP 3.4
- Eclipse 2025-12
- RHEL 9.2
Remarks
It seems, the issue has something to do with https://github.com/eclipse-tm4e/tm4e/blob/main/org.eclipse.tm4e.ui/src/main/java/org/eclipse/tm4e/ui/internal/utils/MarkerUtils.java. While debugging, I found out that the comment tokens are found, but the following condition in updateTextMarkers method is not met since the token type contains the definition string. Maybe the second part of this condition is wrong or there is something wrong with the C/C++ grammar.
if (!token.type.contains("comment") || token.type.contains("definition"))