Skip to content
This repository has been archived by the owner on Feb 17, 2021. It is now read-only.

Commit

Permalink
Nicer code for server.go
Browse files Browse the repository at this point in the history
  • Loading branch information
egonelbre committed Feb 3, 2019
1 parent 11e7bfc commit 99bacbb
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"time"

"github.com/keegancsmith/rpc"

"github.com/stamblerre/gocode/internal/suggest"
)

Expand Down Expand Up @@ -75,7 +74,6 @@ type AutoCompleteReply struct {
}

func (s *Server) AutoComplete(ctx context.Context, req *AutoCompleteRequest, res *AutoCompleteReply) error {
// ensure panics don't kill server
defer func() {
if err := recover(); err != nil {
fmt.Printf("panic: %s\n\n", err)
Expand All @@ -102,7 +100,7 @@ func (s *Server) AutoComplete(ctx context.Context, req *AutoCompleteRequest, res
var buf bytes.Buffer
log.Printf("Got autocompletion request for '%s'\n", req.Filename)
log.Printf("Cursor at: %d\n", req.Cursor)
if len(req.Data) > req.Cursor {
if req.Cursor <= len(req.Data) {
buf.WriteString("-------------------------------------------------------\n")
buf.Write(req.Data[:req.Cursor])
buf.WriteString("#")
Expand Down

0 comments on commit 99bacbb

Please sign in to comment.