Skip to content

Commit 2a14325

Browse files
committed
Add user documentation
1 parent 817c671 commit 2a14325

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

docs/user-guide.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,26 @@ Language-configuration files enable additional editor behavior for a language. T
5757
These behaviors are applied on top of whatever the underlying editor already provides.
5858
TM4E can add these behaviors to simple text editors, or refine them when an editor or language server already offers partial support.
5959

60-
### 3) Diagnostic tools (token hover)
60+
### 3) Custom code templates and code proposals
61+
62+
TM4E offers support for defining and proposing custom code templates for the languages available through a TextMate grammar.
63+
Users can specify their own code templates using the `TextMate > Templates` preferences page.
64+
65+
Each template is registered to a context type, i.e. a language or grammar (technically a TextMate scope).
66+
In addition to available grammars, TM4E offers two special context types for comments.
67+
Templates registered for these context types can be used in all languages having such comments in their grammar.
68+
69+
For example, users can register custom C/C++ or JavaScript statements, but also generally usable comment texts like a Copyright notice, a license, or a TODO comment with the user's name.
70+
Having a TM4E-based editor open, they'll get that code snippets suggested via code completion triggered by Ctrl + Space.
71+
72+
The two generic context types for comments are:
73+
74+
- Comment (any comment that is not a documentation comment, i.e. line comments and standard block comments like code between `/*` and `*/` in Java / C++)
75+
- Documentation comment (a comment that is used for code documentation, e.g. javadoc comments in Java, i.e. code between `/**` and `*/`)
76+
77+
![Custom Code Proposal](img/code_template_proposal.png)
78+
79+
### 4) Diagnostic tools (token hover)
6180

6281
For advanced users, some editors expose a TextMate token hover that shows the token scopes and partition information at the caret location.
6382

@@ -102,6 +121,9 @@ Most user-facing configuration lives under the `TextMate` section in the Eclipse
102121
1. `TextMate > Task Tags` lets you define tags in comments (such as `TODO` or `FIXME`) that should be treated as tasks or problems, and configure how they are marked in the workspace.\
103122
![Task Tags Preferences](img/task_tags_preferences.png)
104123

124+
1. `TextMate > Templates` lets you specify custom code templates for available TextMate grammars (languages). These will be used in code proposals triggered by Ctrl + Space.\
125+
![Templates Preferences](img/templates_preferences.png)
126+
105127
1. `TextMate > Themes` lets you choose between built-in Light and Dark themes and any additional themes contributed by installed plugins, as well as import extra theme files and set the default theme for light and dark modes.
106128
You can also switch themes from the editor's context menu under `TextMate`.\
107129
![Themes Preferences](img/themes_preferences.png)

0 commit comments

Comments
 (0)