Skip to content

Add support for custom code templates (and corresponding code proposals) for the languages / grammars available via TM4E #987

@travkin79

Description

@travkin79

It would be great to have support for custom code templates that can be user-created for the languages available as a TextMate grammar through TM4E.

  • These code templates should be managed through a preferences dialog very similar to the Templates dialog in JDT and CDT (see screenshot).
  • Having specified custom code templates, users should have code completion support (code proposals) for available code templates.
  • When adding a new code template, it should be mapped to a context type.
    • There should be at least one context type for each language that TM4E has a grammar for, e.g. a "C++" context type, a "Java" context type, etc.
    • In addition, there should be some common context types like "Comment" (for a comment in any language) and "Documentation comment" (for a comment used as documentation in any language, e.g. javadoc comments in Java or Doxygen comment in C/C++). Such common context type would make certain code templates usable in all languages, e.g. Copyright comments, author comments, or TODO comments (tasks).
  • In best case, the code templates could be used with template variables similar to those in JDT and CDT. For example, a ${user} variable could be used to place the active user's name into the code template being created.
    • Of course, it would be even better if we had not only language-independent template variables like ${user}, ${date}, or ${cursor}, but also language-specific template variables like the Java-specific variable ${Exception} in the example from the screenshot.
    • These language-specific templates variables could be offered through some kind of extension mechanism.
Image

The ideas for this feature requests were first discussed in a CDT LSP issue.

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