Skip to content

Commit

Permalink
Few fixes, be more nice if the archive cannot be found.
Browse files Browse the repository at this point in the history
  • Loading branch information
nsf committed Jul 11, 2010
1 parent 6eea9a3 commit 9b82898
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions gocodelib.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,11 @@ func (self *AutoCompleteContext) processPackage(filename string, uniquename stri
if self.cache[filename] {
return
}
self.cache[filename] = true
data, err := ioutil.ReadFile(filename)
if err != nil {
panic("Failed to open archive file")
return
}
self.cache[filename] = true
s := string(data)

i := strings.Index(s, "import\n$$\n")
Expand Down Expand Up @@ -508,7 +508,7 @@ func prettyPrintDecl(out io.Writer, d ast.Decl, p string) {
}
}

func autoCompleteDecl(out io.Writer, d ast.Decl, p string) {
func prettyPrintAutoCompleteDecl(out io.Writer, d ast.Decl, p string) {
switch t := d.(type) {
case *ast.GenDecl:
switch t.Tok {
Expand Down Expand Up @@ -669,12 +669,12 @@ func (self *AutoCompleteContext) Apropos(file []byte, apropos string) ([]string,
case 1:
for _, decl := range self.m[self.cfns[apropos]] {
prettyPrintDecl(buf, decl, "")
autoCompleteDecl(buf2, decl, "")
prettyPrintAutoCompleteDecl(buf2, decl, "")
}
case 2:
for _, decl := range self.m[self.cfns[parts[0]]] {
prettyPrintDecl(buf, decl, parts[1])
autoCompleteDecl(buf2, decl, parts[1])
prettyPrintAutoCompleteDecl(buf2, decl, parts[1])
}
}

Expand Down Expand Up @@ -702,6 +702,7 @@ func (self *AutoCompleteContext) Status() string {
}
i++
}
fmt.Fprintf(buf, "\n")
}
return buf.String()
}
2 changes: 1 addition & 1 deletion gocodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func NewACRServer(path string) *ACRServer {
if err != nil {
panic(err.String())
}
self.cmd_in = make(chan int)
self.cmd_in = make(chan int, 1)
return self
}

Expand Down

0 comments on commit 9b82898

Please sign in to comment.