package completionimport ()// CompleteSyntax updates the line with either user-defined syntax completers, or with the builtin ones.func ( *Engine) ( func([]rune, int) ([]rune, int)) {if == nil {return } := []rune(*.line) := .cursor.Pos() - 1 , := (, )ifstring() == string() {return } ++ .line.Set(...) .cursor.Set()}// AutopairInsertOrJump checks if the character to be inserted in the line is a pair character.// If the character is an opening one, its inserted along with its closing equivalent.// If it's a closing one and the next character in line is the same, the cursor jumps over it.func ( rune, *core.Line, *core.Cursor) ( bool) { , := strutil.SurroundType()if ! {return }switch {case && .Char() == : = true .Inc()case && != '\'' && != '"':returndefault: , := strutil.MatchSurround() .Insert(.Pos(), ) }return}// AutopairDelete checks if the character under the cursor is an opening pair// character which is immediately followed by its closing equivalent. If yes,// the closing character is removed.func ( *core.Line, *core.Cursor) {if .Pos() == 0 {return } := (*)[.Pos()-1] , := strutil.SurroundType() := strutil.IsSurround(, .Char())// Cut the (closing) rune under the cursor.if && { .CutRune(.Pos()) }}
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.