Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Keep "csv" formatter as is. Introduce new "csv-with-package" formatter.
Emacs-company plugin is switched to "csv-with-package" format.

Adding one field to "csv" formatter breaks local sublime plugin. It's python
there, args spread goes into a function with 3 arguments, it says you give it
4 and throws an exception.

Fucking fuck. I said - backwards compatibility, please.

See: #463
  • Loading branch information
nsf committed Aug 25, 2017
1 parent abcc7f1 commit 84b76ec
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion emacs-company/company-go.el
Expand Up @@ -71,7 +71,7 @@ symbol is preceded by a \".\", ignoring `company-minimum-prefix-length'."
(defun company-go--invoke-autocomplete ()
(let ((code-buffer (current-buffer))
(gocode-args (append company-go-gocode-args
(list "-f=csv"
(list "-f=csv-with-package"
"autocomplete"
(or (buffer-file-name) "")
(concat "c" (int-to-string (- (point) 1)))))))
Expand Down
14 changes: 14 additions & 0 deletions formatters.go
Expand Up @@ -123,6 +123,18 @@ func (*emacs_formatter) write_candidates(candidates []candidate, num int) {
type csv_formatter struct{}

func (*csv_formatter) write_candidates(candidates []candidate, num int) {
for _, c := range candidates {
fmt.Printf("%s,,%s,,%s\n", c.Class, c.Name, c.Type)
}
}

//-------------------------------------------------------------------------
// csv_with_package_formatter
//-------------------------------------------------------------------------

type csv_with_package_formatter struct{}

func (*csv_with_package_formatter) write_candidates(candidates []candidate, num int) {
for _, c := range candidates {
fmt.Printf("%s,,%s,,%s,,%s\n", c.Class, c.Name, c.Type, c.Package)
}
Expand Down Expand Up @@ -163,6 +175,8 @@ func get_formatter(name string) formatter {
return new(nice_formatter)
case "csv":
return new(csv_formatter)
case "csv-with-package":
return new(csv_with_package_formatter)
case "json":
return new(json_formatter)
case "godit":
Expand Down

0 comments on commit 84b76ec

Please sign in to comment.