Module _m.textadept.snippets

Provides Textmate-like snippets for the textadept module. There are several option variables used: MARK_SNIPPET: The integer mark used to identify the line that marks the end of a snippet. SCOPES_ENABLED: Flag indicating whether scopes/styles can be used for snippets. MARK_SNIPPET_COLOR: The Scintilla color used for the line that marks the end of the snippet.

Functions

_DEBUG (text) [Local function] Prints debug text if the DEBUG flag is set.
cancel_current () Cancels active snippet, reverting to the state before the snippet was activated.
escape (text) [Local function] Replaces escaped snippet characters with their octal equivalents.
insert (snippet_arg) Begins expansion of a snippet.
join_lines () [Local function] Joins current line with the line below it, eliminating whitespace.
list () Lists available snippet triggers as an autocompletion list.
match_indention (ref_line, num_lines) [Local function] When snippets are inserted, matches their indentation level with their surroundings.
next_snippet_item () [Local function] Mirrors or transforms the most recently modified field in the current snippet and moves on to the next field.
remove_escapes (text) [Local function] Removes escaping forward-slashes from escaped snippet characters.
show_scope () Shows the scope/style at the current caret position as a call tip.
snippet_text () [Local function] Gets the text of the snippet.
unescape (text) [Local function] Replaces octal snippet characters with their escaped equivalents.

Tables

snippet [Local table] The current snippet.
snippet_stack [Local table] The stack of currently running snippets.
snippets Global container that holds all snippet definitions.


Functions

_DEBUG (text)
[Local function] Prints debug text if the DEBUG flag is set.

Parameters

  • text: Debug text to print.
cancel_current ()
Cancels active snippet, reverting to the state before the snippet was activated.
escape (text)
[Local function] Replaces escaped snippet characters with their octal equivalents.

Parameters

  • text:
insert (snippet_arg)
Begins expansion of a snippet.

Parameters

  • snippet_arg: Optional snippet to expand. If none is specified, the snippet is determined from the trigger word to the left of the caret, the lexer, and scope.
join_lines ()
[Local function] Joins current line with the line below it, eliminating whitespace. This is used to remove the empty line containing the end of snippet marker.
list ()
Lists available snippet triggers as an autocompletion list. Global snippets and snippets in the current lexer and scope are used.
match_indention (ref_line, num_lines)
[Local function] When snippets are inserted, matches their indentation level with their surroundings.

Parameters

  • ref_line:
  • num_lines:
next_snippet_item ()
[Local function] Mirrors or transforms the most recently modified field in the current snippet and moves on to the next field.
remove_escapes (text)
[Local function] Removes escaping forward-slashes from escaped snippet characters. At this point, they are no longer necessary.

Parameters

  • text:
show_scope ()
Shows the scope/style at the current caret position as a call tip.
snippet_text ()
[Local function] Gets the text of the snippet. This is the text bounded by the start of the trigger word to the end snippet marker on the line after the snippet's end.
unescape (text)
[Local function] Replaces octal snippet characters with their escaped equivalents.

Parameters

  • text:

Tables

snippet
[Local table] The current snippet.
snippet_stack
[Local table] The stack of currently running snippets.
snippets
Global container that holds all snippet definitions.

Valid XHTML 1.0!