summaryrefslogtreecommitdiffstats
path: root/examples/comment-out-current-function.qs
blob: 4cb712f190db9885158874976b3e40554d5de975 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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)