diff options
author | Jesper K. Pedersen <jesper.pedersen@kdab.com> | 2013-05-08 10:57:36 +0200 |
---|---|---|
committer | Jesper K. Pedersen <jesper.pedersen@kdab.com> | 2013-05-13 10:17:36 +0200 |
commit | f2d8214879b056edeedf6cce314e9903d7e704e0 (patch) | |
tree | 3d974f44f68a1e1315d8df3e11bfdf495bf2a29a | |
parent | 8115489dadbb93438346ee492ca684cc79e96e34 (diff) |
added example comment-out-current-function.qs
Change-Id: I9cfce1e924ea172cd23de2f1988e9d0690753c53
Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com>
-rw-r--r-- | examples/comment-out-current-function.qs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/comment-out-current-function.qs b/examples/comment-out-current-function.qs new file mode 100644 index 0000000..4cb712f --- /dev/null +++ b/examples/comment-out-current-function.qs @@ -0,0 +1,17 @@ +// This simple example shows how to use mark to remember positions +// and currentFunction to retrieve information about the function. + +var editor = editors.current() +var start = editor.createMark() + +editor.gotoPosition(editor.currentFunction.start) + +editor.find("{") +var startOfFunction = editor.position() +editor.gotoBlockEnd() +editor.gotoLineStart(); +editor.insert("*/\n") +editor.gotoPosition(startOfFunction) +editor.insert("\n/*") + +editor.gotoPosition(start) |