#739 \todo missing in the Structure View

todo (3)

That's midway between a bug and a feature request. Since TXS 2.8, my \todo*{Thing to do} are highlighted in green (which is nice). However, they are not added to the list of todo inside the Structure View (which seems to be a bug, according to the "What's new" of version 2.8.0).


  • Jan  Sundermeyer

    Jan Sundermeyer - 2014-07-01

    \todo* is not defined, only \todo

  • Jan  Sundermeyer

    Jan Sundermeyer - 2014-07-01

    \todo* is not mentioned in the manual either (todonotes)

  • Mathieu2L

    Mathieu2L - 2014-07-01

    Well, the manual says "todo-style commands (e.g. \todo{}) are added to the list of todos". Sure I agree it doesn't mention \todo*, but pretty close :-)

    And, on my side, \todo and \todo* behave exactly the same (that why I hinted a bug): the text following those commands is green-highlighted but nothing appears in the Structure View. (Perhaps I'm wrongly understanding the "are added to the list of todos" which means to me that they should appear on the TODO entry of the Structure View.)

    Edit. ok, I think the misunderstanding may come from the package(s). I'm refering to the todo package.

    Last edit: Mathieu2L 2014-07-01
  • Jan  Sundermeyer

    Jan Sundermeyer - 2014-07-01

    well, here \todo{text}, text is added to the TODO list ...

  • Mathieu2L

    Mathieu2L - 2014-07-01

    I think the difference comes from the package:
    - your \todo{text} behaves as you say provided that \usepackage{todonotes} is written.
    - otherwise, it is still highlighted in green but not added to the TODO list (which I found strange).

    So I'd transformed this bug into a feature request, requesting that the todo package is handled the same way as the todonotes.

  • Benito van der Zander

    Also strange:

    If no } is there, everything afterwards is green

    If a %} is there, it is treated like }

  • Tim Hoffmann

    Tim Hoffmann - 2014-07-01

    The above effects are the result of a compromize:

    • Adding todo content to the structure panel is handled by the internal parser: LatexDocument::patchStructure() (latexdocument.cpp l.516). The known commands are specified via cwl.
      Advantages: The argument can be extracted (necessary requirement). Known commands can are defined dynamically via the cwl mechanism.
      Disadvantages: No standard mechanism for highlighting the argument. Doesn't work for mutli-line comments.

    • The Highlighting specified in the language definition (tex.qnfa).
      Advantages: Easy to implement, supports multiline-comments.
      Disadvantages: The definition is static (everything command starting with \todo is interpreted as the start of a todo note). The definition is not exact (highlighting extends up to the next non-escaped curly brace).

    Given the current limitations, this was the best I could implement with reasonable effort. It works well for most standard situations. I think, living with these limitations is better than having no highlighting and structure-panel addition for \todo commands at all.

    A better support would probably require a complete rewrite of the internal LaTeX parser and an extension for dynamic modification of the highlighter rules.

  • Tim Hoffmann

    Tim Hoffmann - 2014-07-01

    Workaround for \todo*: Add this command to a cwl file and define it as todo-like

  • Tim Hoffmann

    Tim Hoffmann - 2014-07-01

    Ticket moved from /p/texstudio/bugs/1029/

  • Mathieu2L

    Mathieu2L - 2014-07-02

    The workaround works fine with me. Thanks!

  • NotDifficult

    NotDifficult - 2014-12-08

    Mentioning the option of adding custom todo commands via a cwl file to the user manual would be great!

    PS: cwl are stored in %APPDATA%\texstudio. Just add workaround from above to bottom of any existing cwl file and restart texstudio.

    SEARCH KEYS: add item to list of todos, custom todo command, todos in structure, define additional todo command

    Last edit: NotDifficult 2014-12-08
    • Tim Hoffmann

      Tim Hoffmann - 2014-12-08

      If you search the manual for "todo", you get two matches (apart from the changelog section). One of them is for the cwl specifier "D":

      "this command declares a todo item (will be added to the todo list in the side panel)"

      IMHO thats clear enough.

      Nevertheless, volunteer wanting to help and improve the manual are highly welcome. We as core developers simply do not have the time to make it as good as it could be.

  • Tim Hoffmann

    Tim Hoffmann - 2017-02-26
    • status: open --> closed
    • Group: -->

Log in to post a comment.