Giter Site home page Giter Site logo

go-eldoc's Introduction

go-eldoc.el travis badge melpa badge melpa stable badge

Introduction

go-eldoc.el provides eldoc for Go language. go-eldoc.el shows type information for variable, functions and current argument position of function.

Screenshot

Argument Type of Function

Screenshot of showing argument type of function

Variable Type Information

Screenshot of showing variable type information

Return Value Type

Screenshot of showing return value type

Dependency

You can install go-mode with package.el from MELPA. And you can install gocode by go get as below.

% go get -u github.com/nsf/gocode

Installation

You can install go-eldoc.el from MELPA with package.el.

(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(package-initialize)
(package-refresh-contents)

evaluate this code and M-x package-install go-eldoc.

Setup

Call go-eldoc-setup function at go-mode-hook

(require 'go-eldoc) ;; Don't need to require, if you install by package.el
(add-hook 'go-mode-hook 'go-eldoc-setup)

Customize

You can change face of current argument position by eldoc-highlight-function-argument like this.

(set-face-attribute 'eldoc-highlight-function-argument nil
                    :underline t :foreground "green"
                    :weight 'bold)
go-eldoc-gocode(Default: gocode)

gocode location. You need not to set this variable if you set ($GOPATH/bin) to PATH environment variable correctly.

go-eldoc-gocode-args(Default: nil)

Arguments of gocode command. Type of this variable is list of strings.

go-eldoc's People

Contributors

dominikh avatar kostya-sh avatar purcell avatar syohex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-eldoc's Issues

Function as argument types not properly handled

Thanks for the eldoc. I like it a lot! 😄
Here goes my rambling:

In the regexp package, there's a method which accepts lambda function argument:

func (re *Regexp) ReplaceAllFunc(src []byte, repl func([]byte) []byte) []byte

But go-eldoc shows below, putting another comma right before the lambda return value type:

ReplaceAllFunc: (src []byte, repl func([]byte), []byte) []byte

Large amount of *go-eldoc* buffers when go-eldoc--invoke-autocomplete has an error

In go-eldoc--invoke-autocomplete, if call-process-region encounters an error then the temporary *go-eldoc* buffer isn't killed, resulting in many *go-eldoc* temporary buffers accumulating in the background. It seems that using with-temp-buffer instead of generate-new-buffer or condition-case instead of prog2 (and suitable refactoring) should fix this.

Original report: syl20bnr/spacemacs#7979
Related: nsf/gocode#435

go-eldoc.el Error: Unrecognized keyword godef-jump

While installing go-eldoc from elpa, I got the following:

Compiling no file at Sun Feb 22 15:02:11 2015
Leaving directory `/home/tong/.emacs.d/elpa/go-eldoc-20141218.2036'

Compiling file /home/tong/.emacs.d/elpa/go-eldoc-20141218.2036/go-eldoc.el at Sun Feb 22 15:02:11 2015
Entering directory `/home/tong/.emacs.d/elpa/go-eldoc-20141218.2036/'
go-eldoc.el:37:1:Error: Unrecognized keyword: (bind-key M-. (quote godef-jump) go-mode-map)

and I also get it whenever I open a .go file.

How can I fix it?

Thanks

No type information for operator results

With this program:

package main

import (
	"fmt"
	"math/rand"
)

func main() {
	x := rand.Intn(10)
	y := rand.Intn(10)
	sum := x + y
	fmt.Printf("%v + %v is %v\n", x, y, sum)
}

When I have the point over sum on the 3rd line of main, I don't get any type information. However, I am getting type information correctly for everything else in this program. I'm using go-eldoc 0.30, emacs 26.1. Thanks for your help!

`go-eldoc-setup` doesn't work via adding it to `go-mode-hook`

I added this in emacs init file: (add-hook 'go-mode-hook #'go-eldoc-setup), but eldoc doesn't show function/variable information in minibuffer when .go file opened.
the value of go-mode-hook is:

(go-eldoc-setup +lookup--init-go-mode-handlers-h doom-modeline-env-setup-go flycheck-golangci-lint-setup +lookup|init--set-go-mode)

If i run the go-eldoc-setup manually, eldoc works well.

Please support company-mode

Hi. The auto-complete library was giving me trouble, and I switched my working environment over to company-mode. It seems a lot cleaner and nicer.

It would be nice if emacs-go-eldoc supported company-mode too.

gocode already has the relevant emacs bindings, in the emacs-company subdir: https://github.com/nsf/gocode/tree/master/emacs-company

Switching is a 2-line patch, see https://github.com/tv42/emacs-go-eldoc for a quick hack -- though obviously a real proper change would have to support both ways, and be backwards compatible. Maybe a custom variable to set what completer function to use, and default to ac-go-invoke-autocomplete? My emacs-fu isn't good enough to write that in 10 minutes..

More info on company-mode: http://company-mode.github.io/

Update docs to link to mdempsky/gocode (currently linked nsf/gocode is no longer maintained)

From nsf/gocode

VERY IMPORTANT: this project is not maintained anymore, look for alternatives or forks if you need Go autocompletion tool
IMPORTANT: consider switching to https://github.com/mdempsky/gocode if you have problems starting with Go version 1.10, due to changes in binary packages architecture (introduction of package cache) I'm not going to adjust gocode for it for quite some time. There is a higher chance that fork under the given link will have some solution to the problem sooner or later.

Please add a prefix to test-helper.el to avoid conflicts with 68 other packages

There exist at least 69 packages that contain a file named test-helper.el that also provides the feature test-helper.

This leads to issues for users who have at least two of these packages installed. It is unlikely that such a user would be able to run the tests of all of those packages. If the primary test file of one of those packages does (require 'test-helper), then it is undefined which of the various test-helper.el files gets loaded. Which it is, depends on the order of the load-path.

To avoid this conflicts, you should rename your test-helper.el to <your-package>-test-helper.el and adjust the feature accordingly.

Also don't forget to update the require form in your primary test file and/or update references to the library/feature elsewhere. Also, if your primary test file is named something like test.el, then please consider renaming that too (same for any other utility elisp files your repositoroy may contain).

Thanks!

PS: This issue is a bit generic because I had to open 69 issues.

Tests in test/lhs.el are failing

It seems travis doesn't run tests in lhs.el, and some of those are now failing. Sometimes go-eldoc--count-string is called with arguments where from > to which raises the error Invalid search bound (wrong side of point).

Cheers

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.