summaryrefslogtreecommitdiffstats
path: root/examples/comment-out-current-function.qs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/comment-out-current-function.qs')
-rw-r--r--examples/comment-out-current-function.qs17
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)