Skip to content

Task tags in comments are not detected in some cases #978

@travkin79

Description

@travkin79

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

  1. Install CDT LSP 3.4 and TM4E 0.17.1
  2. Take the following C++ code example and open it the LSP-based C++ editor
  3. 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 12

Expected 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:

Image

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"))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions