DisposaBoy / GoSublime

A Golang plugin collection for SublimeText 3, providing code completion and other IDE-like features.
MIT License
3.42k stars 299 forks source link

Code completion not working #850

Closed kortschak closed 5 years ago

kortschak commented 6 years ago

I am using bf2ead85bfddd7e442ae89ec4b332ae22fb9dbfd on go1.11beta2 (but also go1.10.3).

Code completion brings up a list of words, some of which are possibly relevant, but the vast majority are not. These are entirely unrelated to the package or import context.

Here is the console output, though I don't see anything useful here.

DPI scale (detected): 1
startup, version: 3175 linux x64 channel: dev
executable: /opt/sublime_text/sublime_text
working dir: /
packages path: /home/userredacted/.config/sublime-text-3/Packages
state path: /home/userredacted/.config/sublime-text-3/Local
zip path: /opt/sublime_text/Packages
zip path: /home/userredacted/.config/sublime-text-3/Installed Packages
ignored_packages: ["Vintage"]
pre session restore time: 0.07466
loading dictionary Packages/Language - English/en_US.dic
startup time: 0.162235
first paint time: 0.178941
reloading plugin Default.arithmetic
reloading plugin Default.auto_indent_tag
reloading plugin Default.block
reloading plugin Default.colors
reloading plugin Default.comment
reloading plugin Default.convert_color_scheme
reloading plugin Default.convert_syntax
reloading plugin Default.copy_path
reloading plugin Default.delete_word
reloading plugin Default.detect_indentation
reloading plugin Default.duplicate_line
reloading plugin Default.echo
reloading plugin Default.exec
reloading plugin Default.fold
reloading plugin Default.font
reloading plugin Default.goto_line
reloading plugin Default.history_list
reloading plugin Default.indentation
reloading plugin Default.install_package_control
reloading plugin Default.kill_ring
reloading plugin Default.mark
reloading plugin Default.new_templates
reloading plugin Default.open_context_url
reloading plugin Default.open_in_browser
reloading plugin Default.pane
reloading plugin Default.paragraph
reloading plugin Default.paste_from_history
reloading plugin Default.profile
reloading plugin Default.quick_panel
reloading plugin Default.rename
reloading plugin Default.run_syntax_tests
reloading plugin Default.save_on_focus_lost
reloading plugin Default.scroll
reloading plugin Default.set_unsaved_view_name
reloading plugin Default.settings
reloading plugin Default.show_scope_name
reloading plugin Default.side_bar
reloading plugin Default.sort
reloading plugin Default.swap_line
reloading plugin Default.switch_file
reloading plugin Default.symbol
reloading plugin Default.transform
reloading plugin Default.transpose
reloading plugin Default.trim_trailing_white_space
reloading plugin Default.ui
reloading plugin CSS.css_completions
reloading plugin Diff.diff
reloading plugin HTML.encode_html_entities
reloading plugin HTML.html_completions
reloading plugin ShellScript.ShellScript
reloading plugin 0_package_control_loader.00-package_control
reloading plugin 0_package_control_loader.01-ssl-linux
Package Control: Linux SSL: successfully loaded _ssl module for libssl.so.1.0.0
Package Control: Linux SSL: unloading http module so ssl will be available
Package Control: Linux SSL: unloading urllib module so ssl will be available
reloading plugin 0_package_control_loader.02-bz2
reloading plugin FileDiffs.file_diffs
reloading plugin Find++.DirectoryPanel
reloading plugin Find++.FindPlusPlus
reloading plugin Git.git_commands
reloading plugin GoTests.GoTests
reloading plugin GoToTest.GoToTest
reloading plugin Package Control.1_reloader
reloading plugin Package Control.2_bootstrap
reloading plugin Package Control.Package Control
reloading plugin VCS Gutter.gutter_handlers
reloading plugin VCS Gutter.vcs_gutter
reloading plugin VCS Gutter.vcs_gutter_change
reloading plugin VCS Gutter.vcs_gutter_events
reloading plugin VCS Gutter.vcs_helpers
reloading plugin VCS Gutter.view_collection
reloading plugin GoSublime._after
reloading plugin GoSublime._before
reloading plugin GoSublime.GoSublime
reloading plugin GoSublime.gs9o
reloading plugin GoSublime.gscommands
reloading plugin GoSublime.gscomplete
reloading plugin GoSublime.gsdoc
reloading plugin GoSublime.gsev
reloading plugin GoSublime.gslint
reloading plugin GoSublime.gspalette
reloading plugin GoSublime.gstest
reloading plugin GoSublime.margo_sublime
reloading plugin LaTeXTools.01_reload_submodules
reloading plugin LaTeXTools.02_temp_file_cleanup
reloading plugin LaTeXTools.biblatex_crossref_completions
reloading plugin LaTeXTools.biblatex_field_name_completions
reloading plugin LaTeXTools.biblatex_name_completions
reloading plugin LaTeXTools.biblatex_snippet_completions
reloading plugin LaTeXTools.biblatex_syntax_listener
reloading plugin LaTeXTools.change_environment
reloading plugin LaTeXTools.create_mousemap
reloading plugin LaTeXTools.delete_temp_files
reloading plugin LaTeXTools.detect_spellcheck
reloading plugin LaTeXTools.getRegion
reloading plugin LaTeXTools.getTeXRoot
reloading plugin LaTeXTools.jumpto_anywhere
reloading plugin LaTeXTools.jumpto_tex_file
reloading plugin LaTeXTools.jumpToPDF
reloading plugin LaTeXTools.kpsewhich
reloading plugin LaTeXTools.latex_cite_completions
reloading plugin LaTeXTools.latex_cwl_completions
reloading plugin LaTeXTools.latex_env_completions
reloading plugin LaTeXTools.latex_fill_all
reloading plugin LaTeXTools.latex_input_completions
reloading plugin LaTeXTools.latex_installed_packages
reloading plugin LaTeXTools.latex_own_command_completions
reloading plugin LaTeXTools.latex_ref_completions
reloading plugin LaTeXTools.latexCommand
reloading plugin LaTeXTools.latexDocumentationViewer
reloading plugin LaTeXTools.latexEnvCloser
reloading plugin LaTeXTools.latexEnvironment
reloading plugin LaTeXTools.latextools_default_settings
reloading plugin LaTeXTools.latextools_plugin
reloading plugin LaTeXTools.makePDF
reloading plugin LaTeXTools.migrate
reloading plugin LaTeXTools.parseTeXlog
reloading plugin LaTeXTools.texcount
reloading plugin LaTeXTools.texMacro
reloading plugin LaTeXTools.texSections
reloading plugin LaTeXTools.texSyntaxListener
reloading plugin LaTeXTools.toggle_auto
reloading plugin LaTeXTools.toggle_focus
reloading plugin LaTeXTools.toggle_fwdsync
reloading plugin LaTeXTools.toggle_show
reloading plugin LaTeXTools.toggle_view_on_build
reloading plugin PlainTasks.PlainTasks
reloading plugin PlainTasks.PlainTasksDates
reloading plugin PlainTasks.PlainTasksToHTML
reloading plugin PlainTasks.plist_parser
plugins loaded
Loading LaTeXTools plugins...
Loaded LaTeXTools plugins ['base_viewer'] from path /home/userredacted/.config/sublime-text-3/Packages/LaTeXTools/viewers/base_viewer.py
Loaded LaTeXTools plugins ['zathura_viewer', 'evince_viewer', 'okular_viewer', 'sumatra_viewer', 'preview_viewer', 'command_viewer', 'skim_viewer'] from path /home/userredacted/.config/sublime-text-3/Packages/LaTeXTools/viewers
Loaded LaTeXTools plugins [] from path /home/userredacted/.config/sublime-text-3/Packages/User
Loaded LaTeXTools plugins ['pdf_builder'] from path /home/userredacted/.config/sublime-text-3/Packages/LaTeXTools/builders/pdfBuilder.py
Loaded LaTeXTools plugins ['traditional_builder', 'simple_builder', 'script_builder', 'basic_builder'] from path /home/userredacted/.config/sublime-text-3/Packages/LaTeXTools/builders
Loaded LaTeXTools plugins [] from path /home/userredacted/.config/sublime-text-3/Packages/User
Loaded LaTeXTools plugins ['new_bibliography', 'traditional_bibliography'] from path /home/userredacted/.config/sublime-text-3/Packages/LaTeXTools/bibliography_plugins
Loaded LaTeXTools plugins [] from path /home/userredacted/.config/sublime-text-3/Packages/User
GoSublime r18.05.19-1: _before.init()
GoSublime r18.05.19-1: gs.init()
GoSublime r18.05.19-1: sh.init()
GoSublime r18.05.19-1 sh: using shell env GOPATH=/home/userredacted
GoSublime r18.05.19-1 sh: using shell env GOROOT=/home/userredacted/go
GoSublime r18.05.19-1 sh: using shell env PATH=/home/userredacted/bin:/home/userredacted/.config/sublime-text-3/Packages/GoSublime/bin:/home/userredacted/.config/sublime-text-3/Packages/User/GoSublime/bin:/home/userredacted/bin:/home/userredacted/src/perkeep.org/bin:/home/userredacted/go/bin:/home/userredacted/Development/android-studio/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin:/usr/local/opt/go/bin
GoSublime r18.05.19-1 sh: go version: `devel..c814ac4` (raw version string `devel +c814ac4 Thu Jul 19 21:30:27 2018 +0000`)
GoSublime r18.05.19-1 sh: shell bootstrap took 0.067s
GoSublime r18.05.19-1: margo.init()
GoSublime r18.05.19-1: mg9.init()
[22:18:03] margo: agent#007: starting
GoSublime r18.05.19-1: _after.init()

** 2018-08-02 22:18:03.894940 **:
GoSublime init r18.05.19-1 (0.002s)
|   install margo: no
|   install state: done
| sublime.version: 3175
| sublime.channel: dev
|       about.ann: a18.07.17-1
|   about.version: r18.05.19-1
|         version: r18.05.19-1
|        platform: linux-x64
|            ~bin: ~/.config/sublime-text-3/Packages/User/GoSublime/linux-x64/bin
|       margo.exe: ~bin/gosublime.margo_r18.05.19-1_devel..c814ac4.exe (ok)
|          go.exe: ~/go/bin/go (ok)
|      go.version: devel..c814ac4
|          GOROOT: ~/go
|          GOPATH: /home/userredacted
|           GOBIN: (not set)
|       set.shell: []
|       env.shell: /bin/bash
|       shell.cmd: ['/bin/bash', '-l', '-c', '${CMD}']
|    sh.bootstrap: 
|                >  using shell env GOPATH=/home/userredacted
|                >  using shell env GOROOT=~/go
|                >  using shell env PATH=~/bin:~/.config/sublime-text-3/Packages/GoSublime/bin:~/.config/sublime-text-3/Packages/User/GoSublime/bin:~/bin:...yada yada....
|                >  go version: `devel..c814ac4` (raw version string `devel +c814ac4 Thu Jul 19 21:30:27 2018 +0000`)
|                >  shell bootstrap took 0.067s
|                >
--------------------------------

[22:18:04] margo: agent#007: ['/home/userredacted/.config/sublime-text-3/Packages/GoSublime/bin/margo.sh', 'start', 'margo.sublime', '-codec', 'msgpack']
[22:18:04] margo: agent#007: log: ``` go install -v -tags=margo -i margo.sh/cmd/margo.sublime ```
[22:18:04] margo: agent#007: log: ``` /home/userredacted/.config/sublime-text-3/Packages/GoSublime/bin/margo.sublime -codec msgpack ```
[22:18:04] margo: agent#007: log: store.go:137: started

The values for GOPATH and GOROOT are correct.

disposaboy-afk commented 6 years ago

This is most likely a side-effect of the margo extension not being enabled in https://github.com/DisposaBoy/GoSublime/issues/849

kortschak commented 6 years ago

Here is an example of what I see. code-completion

disposaboy-afk commented 6 years ago

That's Sublime Text's completion. It will show because the margo extension isn't being loaded which means that the Gocode reducer isn't there to suppress it.

downleave commented 6 years ago

@disposaboy-afk I have a similar issue. The autocompletion seems working, but the package "fmt." doesn't show up. qq 20180828155936

DisposaBoy commented 6 years ago

@downleave based on the snippet markers in your screenshot, it appears that you're using the current release version of GoSublime. Please switch to the development branch https://margo.sh/b/migrate/

stjepangolemac commented 6 years ago

I have the same problem and I am on the development branch already. http://prntscr.com/kpzj8h

If I type fmt there are no completions. Even when I do Ctrl+Space it says "no available completions".

DisposaBoy commented 6 years ago

@stjepangolemac

Make sure margo is actually configured and working (check console for errors, etc.).

Press ctrl+.,ctrl+x to configure margo. By default, some snippets are enabled but none of them are visible in your screenshot.

stjepangolemac commented 6 years ago

Here is my margo file, does it seem ok?

package margo

import (
    "margo.sh/golang"
    "margo.sh/mg"
    "time"
)

// Margo is the entry-point to margo
func Margo(m mg.Args) {
    // See the documentation for `mg.Reducer`
    // comments beginning with `gs:` denote features that replace old GoSublime settings

    // add our reducers (margo plugins) to the store
    // they are run in the specified order
    // and should ideally not block for more than a couple milliseconds
    m.Use(
        mg.NewReducer(func(mx *mg.Ctx) *mg.State {
            // By default, events (e.g. ViewSaved) are triggered in all files.
            // Replace `mg.AllLangs` with `mg.Go` to restrict events to Go(-lang) files.
            // Please note, however, that this mode is not tested
            // and saving a non-go file will not trigger linters, etc. for that go pkg
            return mx.SetConfig(mx.Config.EnabledForLangs(
                mg.AllLangs,
            ))
        }),

        // Add `go` command integration
        // this adds a new commands:
        // gs: these commands are all callable through 9o:
        // * go: Wrapper around the go command, adding linter support
        // * go.play: Automatically build and run go commands or run go test for packages
        //   with support for linting and unsaved files
        // * go.replay: Wrapper around go.play limited to a single instance
        //   by default this command is bound to ctrl+.,ctrl+r or cmd+.,cmd+r
        //
        // UserCmds are also added for `Go Play` and `Go RePlay`
        &golang.GoCmd{},

        // add the day and time to the status bar
        &DayTimeStatus{},

        // both GoFmt and GoImports will automatically disable the GoSublime version
        // you will need to install the `goimports` tool manually
        // https://godoc.org/golang.org/x/tools/cmd/goimports
        //
        // gs: this replaces settings `fmt_enabled`, `fmt_tab_indent`, `fmt_tab_width`, `fmt_cmd`
        //
        // golang.GoFmt,
        // or
        // golang.GoImports,

        // use gocode for autocompletion
        // gs: this replaces the `gscomplete_enabled` setting
        &golang.Gocode{
            // Whether or not to do gocode completion using source code
            // instead of the pre-compiled package files.
            // Using source is often slower but offer more up-to-date completions.
            Source: true,

            // show the function parameters. this can take up a lot of space
            ShowFuncParams: true,

            // whether or not to include Test*, Benchmark* and Example* functions in the auto-completion list
            // gs: this replaces the `autocomplete_tests` setting
            ProposeTests: false,

            // whether or not builtin types and functions should be shown in the auto-completion list
            // gs: this replaces the `autocomplete_builtins` setting
            ProposeBuiltins: true,
        },

        // show func arguments/calltips in the status bar
        // gs: this replaces the `calltips` setting
        &golang.GocodeCalltips{
            // Whether or not to do gocode completion using source code
            // instead of the pre-compiled package files.
            // Using source is often slower but offer more accurate completions.
            Source: true,
        },

        // use guru for goto-definition
        // new commands `goto.definition` and `guru.definition` are defined
        // gs: by default `goto.definition` is bound to ctrl+.,ctrl+g or cmd+.,cmd+g
        &golang.Guru{},

        // add some default context aware-ish snippets
        // gs: this replaces the `autocomplete_snippets` and `default_snippets` settings
        golang.Snippets,

        // add our own snippets
        // gs: this replaces the `snippets` setting
        MySnippets,

        // check the file for syntax errors
        // gs: this and other linters e.g. below,
        //     replaces the settings `gslint_enabled`, `lint_filter`, `comp_lint_enabled`,
        //     `comp_lint_commands`, `gslint_timeout`, `lint_enabled`, `linters`
        &golang.SyntaxCheck{},

        // run `go install -i` on save
        // golang.GoInstall("-i"),
        // or
        // golang.GoInstallDiscardBinaries("-i"),
        //
        // GoInstallDiscardBinaries will additionally set $GOBIN
        // to a temp directory so binaries are not installed into your $GOPATH/bin
        //
        // the -i flag is used to install imported packages as well
        // it's only supported in go1.10 or newer

        // run `go vet` on save. go vet is ran automatically as part of `go test` in go1.10
        // golang.GoVet(),

        // run `go test -race` on save
        // golang.GoTest("-race"),

        // run `golint` on save
        // &golang.Linter{Name: "golint", Label: "Go/Lint"},

        // run gometalinter on save
        // &golang.Linter{Name: "gometalinter", Args: []string{
        //  "--disable=gas",
        //  "--fast",
        // }},
    )
}

// DayTimeStatus adds the current day and time to the status bar
type DayTimeStatus struct {
    mg.ReducerType
}

func (dts DayTimeStatus) ReducerMount(mx *mg.Ctx) {
    // kick off the ticker when we start
    dispatch := mx.Store.Dispatch
    go func() {
        ticker := time.NewTicker(1 * time.Second)
        for range ticker.C {
            dispatch(mg.Render)
        }
    }()
}

func (dts DayTimeStatus) Reduce(mx *mg.Ctx) *mg.State {
    // we always want to render the time
    // otherwise it will sometimes disappear from the status bar
    now := time.Now()
    format := "Mon, 15:04"
    if now.Second()%2 == 0 {
        format = "Mon, 15 04"
    }
    return mx.AddStatus(now.Format(format))
}

// MySnippets is a slice of functions returning our own snippets
var MySnippets = golang.SnippetFuncs(
    func(cx *golang.CompletionCtx) []mg.Completion {
        // if we're not in a block (i.e. function), do nothing
        if !cx.Scope.Is(golang.BlockScope) {
            return nil
        }

        return []mg.Completion{
            {
                Query: "if err",
                Title: "err != nil { return }",
                Src:   "if ${1:err} != nil {\n\treturn $0\n}",
            },
        }
    },
)

And here is my console output

environment variables loaded using: /bin/bash -l
reloading plugin Default.arithmetic
reloading plugin Default.auto_indent_tag
reloading plugin Default.block
reloading plugin Default.colors
reloading plugin Default.comment
reloading plugin Default.convert_color_scheme
reloading plugin Default.convert_syntax
reloading plugin Default.copy_path
reloading plugin Default.delete_word
reloading plugin Default.detect_indentation
reloading plugin Default.duplicate_line
reloading plugin Default.echo
reloading plugin Default.exec
reloading plugin Default.fold
reloading plugin Default.font
reloading plugin Default.goto_line
reloading plugin Default.history_list
reloading plugin Default.indentation
reloading plugin Default.install_package_control
reloading plugin Default.kill_ring
reloading plugin Default.mark
reloading plugin Default.new_templates
reloading plugin Default.open_context_url
reloading plugin Default.open_in_browser
reloading plugin Default.pane
reloading plugin Default.paragraph
reloading plugin Default.paste_from_history
reloading plugin Default.profile
reloading plugin Default.quick_panel
reloading plugin Default.rename
reloading plugin Default.run_syntax_tests
reloading plugin Default.save_on_focus_lost
reloading plugin Default.scroll
reloading plugin Default.set_unsaved_view_name
reloading plugin Default.settings
reloading plugin Default.show_scope_name
reloading plugin Default.side_bar
reloading plugin Default.sort
reloading plugin Default.swap_line
reloading plugin Default.switch_file
reloading plugin Default.symbol
reloading plugin Default.transform
reloading plugin Default.transpose
reloading plugin Default.trim_trailing_white_space
reloading plugin Default.ui
reloading plugin CSS.css_completions
reloading plugin Diff.diff
reloading plugin HTML.encode_html_entities
reloading plugin HTML.html_completions
reloading plugin ShellScript.ShellScript
reloading plugin Vintage.vintage
reloading plugin Vintage.vintage_commands
reloading plugin Vintage.vintage_motions
reloading plugin 0_package_control_loader.00-package_control
reloading plugin 0_package_control_loader.01-pygments
reloading plugin 0_package_control_loader.50-backrefs
reloading plugin 0_package_control_loader.50-markupsafe
reloading plugin 0_package_control_loader.50-pymdownx
reloading plugin 0_package_control_loader.50-python-markdown
reloading plugin 0_package_control_loader.50-pyyaml
reloading plugin 0_package_control_loader.51-python-jinja2
reloading plugin 0_package_control_loader.55-mdpopups
reloading plugin A File Icon.A File Icon
reloading plugin AdvancedNewFile.AdvancedNewFile
reloading plugin ayu.activation
reloading plugin ayu.Icons
reloading plugin BracketHighlighter.bh_core
reloading plugin BracketHighlighter.bh_logging
reloading plugin BracketHighlighter.bh_plugin
reloading plugin BracketHighlighter.bh_popup
reloading plugin BracketHighlighter.bh_regions
reloading plugin BracketHighlighter.bh_remove
reloading plugin BracketHighlighter.bh_rules
reloading plugin BracketHighlighter.bh_search
reloading plugin BracketHighlighter.bh_swapping
reloading plugin BracketHighlighter.bh_wrapping
reloading plugin BracketHighlighter.support
reloading plugin DocBlockr.jsdocs
reloading plugin Git.git_commands
reloading plugin GitGutter.debounce
reloading plugin GitGutter.plugin
reloading plugin Package Control.1_reloader
reloading plugin Package Control.2_bootstrap
reloading plugin Package Control.Package Control
reloading plugin SideBarEnhancements.SideBar
reloading plugin SideBarEnhancements.SideBarAPI
reloading plugin SideBarEnhancements.SideBarDefaultDisable
reloading plugin Babel.Babel
reloading plugin ESLint.ESLint
reloading plugin GoSublime._after
reloading plugin GoSublime._before
reloading plugin GoSublime.GoSublime
reloading plugin GoSublime.gs9o
reloading plugin GoSublime.gscommands
reloading plugin GoSublime.gscomplete
reloading plugin GoSublime.gsdoc
reloading plugin GoSublime.gsev
reloading plugin GoSublime.gslint
reloading plugin GoSublime.gspalette
reloading plugin GoSublime.gstest
reloading plugin GoSublime.margo_sublime
reloading plugin JsPrettier.JsPrettier
plugins loaded
GoSublime r18.08.31-1: _before.init()
GoSublime r18.08.31-1: gs.init()
GoSublime r18.08.31-1: sh.init()
GoSublime r18.08.31-1 sh: using shell env GOPATH=/Users/stjepangolemac/go
GoSublime r18.08.31-1 sh: using shell env GOROOT=/usr/local/Cellar/go/1.10.1/libexec
GoSublime r18.08.31-1 sh: using shell env PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Users/stjepangolemac/Library/Application Support/Sublime Text 3/Packages/GoSublime/bin:/Users/stjepangolemac/Library/Application Support/Sublime Text 3/Packages/User/GoSublime/bin:/Users/stjepangolemac/go/bin:/Users/stjepangolemac/n/bin:/Users/stjepangolemac/Library/Python/2.7/bin:/Users/stjepangolemac/bin:/usr/local/opt/go/bin:/Users/stjepangolemac/Library/Python/2.7/bin
GoSublime r18.08.31-1 sh: go version: `go1.10.1` (raw version string `go1.10.1`)
GoSublime r18.08.31-1 sh: shell bootstrap took 0.539s
GoSublime r18.08.31-1: margo.init()
GoSublime r18.08.31-1: mg9.init()
[12:02:31] margo: agent#007: starting
GoSublime r18.08.31-1: _after.init()

** 2018-09-03 12:02:31.663823 **:
GoSublime init r18.08.31-1 (0.004s)
|   install margo: no
|   install state: done
| sublime.version: 3176
| sublime.channel: stable
|       about.ann: a18.08.31-1
|   about.version: r18.08.31-1
|         version: r18.08.31-1
|        platform: osx-x64
|            ~bin: ~/Library/Application Support/Sublime Text 3/Packages/User/GoSublime/osx-x64/bin
|       margo.exe: ~bin/gosublime.margo_r18.08.31-1_go1.10.1.exe (ok)
|          go.exe: /usr/local/Cellar/go/1.10.1/libexec/bin/go (ok)
|      go.version: go1.10.1
|          GOROOT: /usr/local/Cellar/go/1.10.1/libexec
|          GOPATH: ~/go
|           GOBIN: (not set)
|       set.shell: []
|       env.shell: /bin/bash
|       shell.cmd: ['/bin/bash', '-l', '-c', '${CMD}']
|    sh.bootstrap: 
|                >  using shell env GOPATH=~/go
|                >  using shell env GOROOT=/usr/local/Cellar/go/1.10.1/libexec
|                >  using shell env PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:~/Library/Application Support/Sublime Text 3/Packages/GoSublime/bin:~/Library/Application Support/Sublime Text 3/Packages/User/GoSublime/bin:~/go/bin:~/n/bin:~/Library/Python/2.7/bin:~/bin:/usr/local/opt/go/bin:~/Library/Python/2.7/bin
|                >  go version: `go1.10.1` (raw version string `go1.10.1`)
|                >  shell bootstrap took 0.539s
|                >
--------------------------------

[12:02:32] margo: agent#007: ['/Users/stjepangolemac/Library/Application Support/Sublime Text 3/Packages/GoSublime/bin/margo.sh', 'start', 'margo.sublime', '-codec', 'msgpack']
[12:02:32] margo: agent#007: log: Using margo extension: /Users/stjepangolemac/Library/Application Support/Sublime Text 3/Packages/User/GoSublime/src/margo
[12:02:32] margo: agent#007: log: ``` go install -v -tags="margo margo_extension" margo.sh/cmd/margo.sublime ```
[12:02:32] margo: agent#007: log: ``` "/Users/stjepangolemac/Library/Application Support/Sublime Text 3/Packages/GoSublime/bin/margo.sublime" -codec msgpack ```
[12:02:32] margo: agent#007: log: store.go:137: started
Package Control: No updated packages
DisposaBoy commented 6 years ago

@stjepangolemac

The file should be fine (works for me). Do you see the time in the status bar or any errors in the Sublime Text console?

stjepangolemac commented 6 years ago

Yep I see the time and I cannot find any errors in the console, the output is up there if you want to check it out.

DisposaBoy commented 6 years ago

Be sure to check the console after you attempt autocompletion. The log you posted seems to be from earlier in the session because I can't see any output from guru which should print something like go install margo.sh/vendor/golang.org/x/tools/cmd/guru when a .go file becomes active.

If you add the reducer below, do you see abc123 in the status bar or xyz when you type x?

mg.NewReducer(func(mx *mg.Ctx) *mg.State {
    return mx.AddStatus("abc123").
        AddCompletions(
            mg.Completion{Query: "xyz"},
        )
}),
zyxar commented 6 years ago

I got the completion issue. Log as below:

Package Control: Skipping automatic upgrade, last run at 2018-09-05 14:56:13, next run at 2018-09-05 15:56:13 or after
[15:05:58] margo: agent#007: log: ``` go install margo.sh/vendor/golang.org/x/tools/cmd/guru ```
[15:06:01] margo: agent#007: log: gocode.go:168: gocode didn't respond after 250ms taking 253ms
[15:06:01] margo: agent#007: log: gocode.go:143: gocode didn't accept the request after 103ms
[15:06:02] margo: agent#007: log: gocode.go:143: gocode didn't accept the request after 102ms
[15:06:03] margo: agent#007: log: gocode.go:143: gocode didn't accept the request after 104ms
[15:06:04] margo: agent#007: log: gocode.go:143: gocode didn't accept the request after 101ms
[15:06:05] margo: agent#007: log: gocode.go:143: gocode didn't accept the request after 104ms
[15:06:05] margo: agent#007: log: gocode.go:143: gocode didn't accept the request after 102ms
[15:06:05] margo: agent#007: log: gocode.go:159: gocode eventually responded after 4.925s

The victim repo is out of GOPATH. (But it worked the other day, if I recalled correctly)

For projects in GOPATH, the completion works fine at present.

$ go version:
go version go1.11 darwin/amd64
stjepangolemac commented 6 years ago

@DisposaBoy when I paste this reducer I get the xyz completion, it is the only one. And after typing something and manually invoking the completion this is the log.

startup, version: 3176 osx x64 channel: stable
executable: /Applications/Sublime Text.app/Contents/MacOS/Sublime Text
working dir: /
packages path: /Users/stjepangolemac/Library/Application Support/Sublime Text 3/Packages
state path: /Users/stjepangolemac/Library/Application Support/Sublime Text 3/Local
zip path: /Applications/Sublime Text.app/Contents/MacOS/Packages
zip path: /Users/stjepangolemac/Library/Application Support/Sublime Text 3/Installed Packages
ignored_packages: ["ActualVim"]
Errors parsing theme:
icon_file_type is missing layer0.opacity, setting to 1.0 for backwards compatibility
icon_file_type is missing layer0.opacity, setting to 1.0 for backwards compatibility
pre session restore time: 0.255862
using gpu buffer for window
loading dictionary Packages/Language - English/en_US.dic
font face "Source Code Pro" could not be found, defaulting to "Menlo"
startup time: 0.377903
environment variables loaded using: /bin/bash -l
reloading plugin Default.arithmetic
reloading plugin Default.auto_indent_tag
reloading plugin Default.block
reloading plugin Default.colors
reloading plugin Default.comment
reloading plugin Default.convert_color_scheme
reloading plugin Default.convert_syntax
reloading plugin Default.copy_path
reloading plugin Default.delete_word
reloading plugin Default.detect_indentation
reloading plugin Default.duplicate_line
reloading plugin Default.echo
reloading plugin Default.exec
reloading plugin Default.fold
reloading plugin Default.font
reloading plugin Default.goto_line
reloading plugin Default.history_list
reloading plugin Default.indentation
reloading plugin Default.install_package_control
reloading plugin Default.kill_ring
reloading plugin Default.mark
reloading plugin Default.new_templates
reloading plugin Default.open_context_url
reloading plugin Default.open_in_browser
reloading plugin Default.pane
reloading plugin Default.paragraph
reloading plugin Default.paste_from_history
reloading plugin Default.profile
reloading plugin Default.quick_panel
reloading plugin Default.rename
reloading plugin Default.run_syntax_tests
reloading plugin Default.save_on_focus_lost
reloading plugin Default.scroll
reloading plugin Default.set_unsaved_view_name
reloading plugin Default.settings
reloading plugin Default.show_scope_name
reloading plugin Default.side_bar
reloading plugin Default.sort
reloading plugin Default.swap_line
reloading plugin Default.switch_file
reloading plugin Default.symbol
reloading plugin Default.transform
reloading plugin Default.transpose
reloading plugin Default.trim_trailing_white_space
reloading plugin Default.ui
reloading plugin CSS.css_completions
reloading plugin Diff.diff
reloading plugin HTML.encode_html_entities
reloading plugin HTML.html_completions
reloading plugin ShellScript.ShellScript
reloading plugin Vintage.vintage
reloading plugin Vintage.vintage_commands
reloading plugin Vintage.vintage_motions
reloading plugin 0_package_control_loader.00-package_control
reloading plugin 0_package_control_loader.01-pygments
reloading plugin 0_package_control_loader.50-backrefs
reloading plugin 0_package_control_loader.50-markupsafe
reloading plugin 0_package_control_loader.50-pymdownx
reloading plugin 0_package_control_loader.50-python-markdown
reloading plugin 0_package_control_loader.50-pyyaml
reloading plugin 0_package_control_loader.51-python-jinja2
reloading plugin 0_package_control_loader.55-mdpopups
reloading plugin A File Icon.A File Icon
reloading plugin AdvancedNewFile.AdvancedNewFile
reloading plugin ayu.activation
reloading plugin ayu.Icons
reloading plugin BracketHighlighter.bh_core
reloading plugin BracketHighlighter.bh_logging
reloading plugin BracketHighlighter.bh_plugin
reloading plugin BracketHighlighter.bh_popup
reloading plugin BracketHighlighter.bh_regions
reloading plugin BracketHighlighter.bh_remove
reloading plugin BracketHighlighter.bh_rules
reloading plugin BracketHighlighter.bh_search
reloading plugin BracketHighlighter.bh_swapping
reloading plugin BracketHighlighter.bh_wrapping
reloading plugin BracketHighlighter.support
reloading plugin DocBlockr.jsdocs
reloading plugin Git.git_commands
reloading plugin GitGutter.debounce
reloading plugin GitGutter.plugin
reloading plugin Package Control.1_reloader
reloading plugin Package Control.2_bootstrap
reloading plugin Package Control.Package Control
reloading plugin SideBarEnhancements.SideBar
reloading plugin SideBarEnhancements.SideBarAPI
reloading plugin SideBarEnhancements.SideBarDefaultDisable
reloading plugin Babel.Babel
reloading plugin ESLint.ESLint
reloading plugin GoSublime._after
reloading plugin GoSublime._before
reloading plugin GoSublime.GoSublime
reloading plugin GoSublime.gs9o
reloading plugin GoSublime.gscommands
reloading plugin GoSublime.gscomplete
reloading plugin GoSublime.gsdoc
reloading plugin GoSublime.gsev
reloading plugin GoSublime.gslint
reloading plugin GoSublime.gspalette
reloading plugin GoSublime.gstest
reloading plugin GoSublime.margo_sublime
reloading plugin JsPrettier.JsPrettier
plugins loaded
GoSublime r18.08.31-1: _before.init()
GoSublime r18.08.31-1: gs.init()
GoSublime r18.08.31-1: sh.init()
GoSublime r18.08.31-1 sh: using shell env GOPATH=/Users/stjepangolemac/go
GoSublime r18.08.31-1 sh: using shell env GOROOT=/usr/local/Cellar/go/1.10.1/libexec
GoSublime r18.08.31-1 sh: using shell env PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Users/stjepangolemac/Library/Application Support/Sublime Text 3/Packages/GoSublime/bin:/Users/stjepangolemac/Library/Application Support/Sublime Text 3/Packages/User/GoSublime/bin:/Users/stjepangolemac/go/bin:/Users/stjepangolemac/n/bin:/Users/stjepangolemac/Library/Python/2.7/bin:/Users/stjepangolemac/bin:/usr/local/opt/go/bin:/Users/stjepangolemac/Library/Python/2.7/bin
GoSublime r18.08.31-1 sh: go version: `go1.10.1` (raw version string `go1.10.1`)
GoSublime r18.08.31-1 sh: shell bootstrap took 0.186s
GoSublime r18.08.31-1: margo.init()
GoSublime r18.08.31-1: mg9.init()
[09:22:07] margo: agent#007: starting
GoSublime r18.08.31-1: _after.init()

** 2018-09-05 09:22:07.515300 **:
GoSublime init r18.08.31-1 (0.003s)
|   install margo: no
|   install state: done
| sublime.version: 3176
| sublime.channel: stable
|       about.ann: a18.08.31-1
|   about.version: r18.08.31-1
|         version: r18.08.31-1
|        platform: osx-x64
|            ~bin: ~/Library/Application Support/Sublime Text 3/Packages/User/GoSublime/osx-x64/bin
|       margo.exe: ~bin/gosublime.margo_r18.08.31-1_go1.10.1.exe (ok)
|          go.exe: /usr/local/Cellar/go/1.10.1/libexec/bin/go (ok)
|      go.version: go1.10.1
|          GOROOT: /usr/local/Cellar/go/1.10.1/libexec
|          GOPATH: ~/go
|           GOBIN: (not set)
|       set.shell: []
|       env.shell: /bin/bash
|       shell.cmd: ['/bin/bash', '-l', '-c', '${CMD}']
|    sh.bootstrap: 
|                >  using shell env GOPATH=~/go
|                >  using shell env GOROOT=/usr/local/Cellar/go/1.10.1/libexec
|                >  using shell env PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:~/Library/Application Support/Sublime Text 3/Packages/GoSublime/bin:~/Library/Application Support/Sublime Text 3/Packages/User/GoSublime/bin:~/go/bin:~/n/bin:~/Library/Python/2.7/bin:~/bin:/usr/local/opt/go/bin:~/Library/Python/2.7/bin
|                >  go version: `go1.10.1` (raw version string `go1.10.1`)
|                >  shell bootstrap took 0.186s
|                >
--------------------------------

[09:22:07] margo: agent#007: ['/Users/stjepangolemac/Library/Application Support/Sublime Text 3/Packages/GoSublime/bin/margo.sh', 'start', 'margo.sublime', '-codec', 'msgpack']
[09:22:07] margo: agent#007: log: Using margo extension: /Users/stjepangolemac/Library/Application Support/Sublime Text 3/Packages/User/GoSublime/src/margo
[09:22:07] margo: agent#007: log: ``` go install -v -tags="margo margo_extension" margo.sh/cmd/margo.sublime ```
[09:22:08] margo: agent#007: log: ``` "/Users/stjepangolemac/Library/Application Support/Sublime Text 3/Packages/GoSublime/bin/margo.sublime" -codec msgpack ```
[09:22:08] margo: agent#007: log: store.go:137: started
Package Control: Skipping automatic upgrade, last run at 2018-09-05 09:21:01, next run at 2018-09-05 10:21:01 or after
[09:22:16] margo: agent#007: log: ``` go install margo.sh/vendor/golang.org/x/tools/cmd/guru ```
DisposaBoy commented 6 years ago

@zyxar is that a Go module? are you using Source: true?

DisposaBoy commented 6 years ago

@stjepangolemac what does the following reducer print - EDIT: make sure it's bellow all the other reducers? does it fail in all go files?

    mg.NewReducer(func(mx *mg.Ctx) *mg.State {
        if !mx.ActionIs(mg.QueryCompletions{}) {
            return mx.State
        }

        m := map[mg.CompletionTag]int{}
        for _, c := range mx.Completions {
            m[c.Tag] += 1
        }
        mx.Log.Dbg.Printf("lang=%s, comps=%v\n", mx.View.Lang, m)

        return mx.State
    }),

If the xyz reducer works, but the golang.Snippets don't, it could be that the the type of the file isn't detected correctly.

zyxar commented 6 years ago

@DisposaBoy yes it's a Go module. Both Source: false and Source: true have the issue.

DisposaBoy commented 6 years ago

@zyxar maybe adding the &golang.MarGocodeCtl{Debug: true}, reducer will shed some light on the situation. Your logs show that gocode is slow, which is somewhat expected the first time you attempt any autocompletion. This reducer with Debug: true will print logs about packages that are being imported.

stjepangolemac commented 6 years ago

@DisposaBoy this is the output from your reducer:

[12:44:05] margo: agent#007: log: DBG: margo.go:135: lang=go, comps=map[]

In margo.go I get type completions (such as float, int ,bool) and nothing else, but in other files I don't get anything besides func and for.

EDIT: lang in the bottom says GoSublime: Go

DisposaBoy commented 6 years ago

@stjepangolemac can you comment out both the golang.Gocode and golang.GocodeCalltips reducers and only the golangSnippets? If snippets aren't working, it might be easier to debug that.

Note: all GoSublime completions end with characters like ·ƒ, ·ρ, ·ν, ·ʂ, etc. If it doesn't look like that, then it's not a margo/GoSublime completion.

Also, the cmd+space keybinding was removed from OSX so manually triggering autocomplete may or may not work as expected. You can be sure it's triggering by running this command in the Sublime Text console: view.run_command('auto_complete').

If you place the cursor inside of a function e.g. func main() {|cursor here| and run that command, you should at least get some entries ending with ·ʂ, and it should show them in every .go file.

That should at least provide some good hints on where to look next.

zyxar commented 6 years ago

@DisposaBoy too many import errors. I'll try inspecting when I have time (maybe in the weekend).

brianmartens commented 6 years ago

@DisposaBoy After switching to the development branch as you've specified above my autocompletion now works as intended, but go formatting does not work anymore and I must manually indent/format my code now.

DisposaBoy commented 6 years ago

@brianmartens I'll need some way to reproduce the issue e.g. your margo.go file

logrusorgru commented 6 years ago

It's about scope issue. I had added cx.Log.Println("OOOPS!") before this line, and I got the "OOOPS!" in sublime console. Seems it affects other snippets.

logrusorgru commented 6 years ago

Yep. It works fine on a blank file. Open blank file, set syntax to "GoSublime Go" and all complitters works like a charm. Package, import, main function, methods of imported package (standard and not standard library). But if file is not blank, then it doesn't work.

DisposaBoy commented 6 years ago

@logrusorgru Are you talking about snippets only? or all auto-completion in general? If you can reliably reproduce the issue, please open a new issue with more details. The line you added the println to is concerned with snippets only.

DisposaBoy commented 6 years ago

Or wait 30 mins. I'm about to push a new release.

logrusorgru commented 6 years ago

But this behavior is not permanent. Sometimes, by unknown reason, it works fine and then doesn't work again. Hm-m-m-m. I'm confused.

logrusorgru commented 6 years ago

@DisposaBoy, I'm about snippets only. But, probably, this also applies to autocompletion in general.

logrusorgru commented 6 years ago

I'm using this to debug the CompletionScope:

// margo.sh/golang/completion.go

func (c CompletionScope) String() (s string) {
    switch {
    case c&PackageScope != 0:
        s += ",package"
    case c&FileScope != 0:
        s += ",file"
    case c&DeclScope != 0:
        s += ",decl"
    case c&BlockScope != 0:
        s += ",block"
    case c&ImportScope != 0:
        s += ",import"
    case c&ConstScope != 0:
        s += ",const"
    case c&VarScope != 0:
        s += ",var"
    case c&TypeScope != 0:
        s += ",type"
    case c&CommentScope != 0:
        s += ",comment"
    case c&StringScope != 0:
        s += ",string"
    case c&ImportPathScope != 0:
        s += ",importPath"
    }
    if s == "" {
        return "<no>"
    }
    return s[1:]
}
logrusorgru commented 6 years ago

@DisposaBoy, ah, sorry, no. Not snippets only. Methods of an imported package too.

@DisposaBoy, I'm about snippets only. But, probably, this also applies to autocompletion in general.

brianmartens commented 6 years ago

Thanks, Here is my margo.go file

On Mon, Sep 24, 2018 at 2:17 PM DisposaBoy notifications@github.com wrote:

@brianmartens https://github.com/brianmartens I'll need some way to reproduce the issue e.g. your margo.go file

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/DisposaBoy/GoSublime/issues/850#issuecomment-424073547, or mute the thread https://github.com/notifications/unsubscribe-auth/AOZiwbdzfn8Qa2hH1ReRA_quamMwAuh1ks5ueSG0gaJpZM4VsOlk .

DisposaBoy commented 6 years ago

I just pushed a new release that uses the source importer by default. Maybe it helps with the gocode completions.

DisposaBoy commented 6 years ago

@logrusorgru Are you sure it's a bug? remember the snippets are context-sensitive. So if the file is empty, only the the package snippet is show. If you're inside a function the import (...) snippet isn't shown, etc. EDIT: Maybe doing a screen recording or something will help make it easier for me to understand what's happening.

DisposaBoy commented 6 years ago

@brianmartens I think you forgot the attachement.

logrusorgru commented 6 years ago

@DisposaBoy, yes, I'm sure. I meant that snippets and completion doesn't work as expected (as it was).

brianmartens commented 6 years ago

@DisposaBoy Sorry about that. I tried using Gmail to reply but it must not have added the attachment here. margo.go.zip

DisposaBoy commented 6 years ago

@brianmartens you didn't enabled code formatting. You uncomment either golang.GoFmt on line 49 or golang.GoImports on line 51

DisposaBoy commented 6 years ago

@logrusorgru In that case, can you share some way (code, screen recording, etc.) for me to reproduce this?

brianmartens commented 6 years ago

Ah, I see now. Thanks for the help!

On Tue, Sep 25, 2018 at 2:02 PM DisposaBoy notifications@github.com wrote:

@brianmartens https://github.com/brianmartens you didn't enabled code formatting. You uncomment either golang.GoFmt on line 49 or golang.GoImports on line 51

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/DisposaBoy/GoSublime/issues/850#issuecomment-424443299, or mute the thread https://github.com/notifications/unsubscribe-auth/AOZiwSW2kvZo5xYe-Womp8ZJPRo37Ki7ks5uem_JgaJpZM4VsOlk .

logrusorgru commented 6 years ago

@DisposaBoy , in a middle case it's unpredictable. But, there is a case that can be reproduced.

A comment before package directive breaks import snippet completion.

sublime_competion_doesnt_work sublime_completion_works_fine

Also, dot in the leading comment triggers package <name> auto-completion.

About the scope of imp where import snippet is expected: without the comment its scope is file, with the comment its scope is package.

That's all can be reproduced I found for now.

DisposaBoy commented 6 years ago

@logrusorgru thanks I'll fix them in the next few days. Note: imp/Import completion is not provided by margo/GoSublime. It's coming from the Go package (which you can safely disable if you want).

EDIT: also note, no gocode completion is shown in the global/file scope unless it's inside var (...)

notbaab commented 6 years ago

I have the same issue as well on the latest release. If it helps here is my output in the console.

GoSublime r18.07.22-1: gs.init()
reloading settings Packages/User/Package Syncing.sublime-settings
GoSublime r18.07.22-1: sh.init()
GoSublime r18.07.22-1 sh: GOPATH is not set... setting it to the default: /Users/et/go
GoSublime r18.07.22-1 sh: using shell env GOPATH=/Users/et/go
GoSublime r18.07.22-1 sh: using shell env GOROOT=/usr/local/Cellar/go/1.11.1/libexec
GoSublime r18.07.22-1 sh: using shell env PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Wireshark.app/Contents/MacOS:/Users/et/go/bin:/usr/local/sbin:/Users/et/bin:/usr/local/go/bin:/usr/local/opt/go/bin
GoSublime r18.07.22-1 sh: go version: `go1.11.1` (raw version string `go1.11.1`)
GoSublime r18.07.22-1 sh: shell bootstrap took 0.165s
GoSublime r18.07.22-1: margo.init()
GoSublime r18.07.22-1: mg9.init()
[21:32:31] margo: agent#007: starting

** 2018-10-17 21:32:31.920453 **:
GoSublime init r18.07.22-1 (0.001s)
|   install margo: no
|   install state: done
| sublime.version: 3176
| sublime.channel: stable
|       about.ann: a18.07.31-1
|   about.version: r18.07.22-1
|         version: r18.07.22-1
|        platform: osx-x64
|            ~bin: ~/Library/Application Support/Sublime Text 3/Packages/User/GoSublime/osx-x64/bin
|       margo.exe: ~bin/gosublime.margo_r18.07.22-1_go1.11.1.exe (ok)
|          go.exe: /usr/local/Cellar/go/1.11.1/libexec/bin/go (ok)
|      go.version: go1.11.1
|          GOROOT: /usr/local/Cellar/go/1.11.1/libexec
|          GOPATH: ~/go
|           GOBIN: (not set)
|       set.shell: []
|       env.shell: /bin/bash
|       shell.cmd: ['/bin/bash', '-l', '-c', '${CMD}']
|    sh.bootstrap: 
|                >  GOPATH is not set... setting it to the default: ~/go
|                >  using shell env GOPATH=~/go
|                >  using shell env GOROOT=/usr/local/Cellar/go/1.11.1/libexec
|                >  using shell env PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Wireshark.app/Contents/MacOS:~/go/bin:/usr/local/sbin:~/bin:/usr/local/go/bin:/usr/local/opt/go/bin
|                >  go version: `go1.11.1` (raw version string `go1.11.1`)
|                >  shell bootstrap took 0.165s
|                >
--------------------------------

[21:32:32] margo: agent#007: ['/Users/et/Library/Application Support/Sublime Text 3/Packages/GoSublime/bin/margo', 'sublime', '-codec', 'msgpack']
[21:32:32] margo: agent#007: log: run["go" "install" "-v" "-tags=margo" "-i" "disposa.blue/margo/cmd/margo.sublime"]
[21:32:32] margo: agent#007: log: run["/Users/et/Library/Application Support/Sublime Text 3/Packages/GoSublime/bin/margo.sublime" "-codec" "msgpack"]
[21:32:32] margo: agent#007: log: agent.go:136: started
arsham commented 6 years ago

I have the same issue as well. This is a fresh install of ST3. The installed GoSublime git hash is cde59b7a (development branch).

Contents of the file

package tmp

func main() {
    fmt.
}

Cursor is positioned after fmt., hit Ctrl+Space you I get:

[07:13:16] margo: agent#008: log: DBG: gocode_suggest.go:71: Gocode: Error parsing input file (outer block):
[07:13:16] margo: agent#008: log: DBG: gocode_suggest.go:71: Gocode:  /home/arsham/Projects/Go/src/github.com/arsham/tests/tmp/main.go:4:6: expected selector or type assertion, found ';'
[07:13:18] margo: agent#008: log: DBG: gocode_suggest.go:71: Gocode: Error parsing input file (outer block):
[07:13:18] margo: agent#008: log: DBG: gocode_suggest.go:71: Gocode:  /home/arsham/Projects/Go/src/github.com/arsham/tests/tmp/main.go:4:6: expected selector or type assertion, found ';'

ST3 Logs

GoSublime r18.10.06-1: _before.init()
GoSublime r18.10.06-1: gs.init()
GoSublime r18.10.06-1: sh.init()
GoSublime r18.10.06-1 sh: GOPATH is not set... setting it to the default: /home/arsham/go
GoSublime r18.10.06-1 sh: using shell env CGO_CFLAGS_ALLOW=.*
GoSublime r18.10.06-1 sh: using shell env CGO_CXXFLAGS_ALLOW=.*
GoSublime r18.10.06-1 sh: using shell env CGO_LDFLAGS_ALLOW=.*
GoSublime r18.10.06-1 sh: using shell env GOPATH=/home/arsham/Projects/Go
GoSublime r18.10.06-1 sh: using shell env GOROOT=/usr/lib/go
GoSublime r18.10.06-1 sh: using shell env PATH=/usr/lib/ccache/bin/:/home/arsham/Projects/Go/bin:/home/arsham/.config/sublime-text-3/Packages/GoSublime/bin:/home/arsham/.config/sublime-text-3/Packages/User/GoSublime/bin:/home/arsham/go/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/opt/cuda/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/arsham/bin:/usr/local/go/bin:/usr/local/opt/go/bin:/opt/cuda/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
GoSublime r18.10.06-1 sh: go version: `go1.11.1` (raw version string `go1.11.1`)
GoSublime r18.10.06-1 sh: shell bootstrap took 0.069s
GoSublime r18.10.06-1: margo.init()
GoSublime r18.10.06-1: mg9.init()
[07:12:29] margo: agent#007: starting
GoSublime r18.10.06-1: _after.init()

** 2018-10-18 07:12:29.805067 **:
GoSublime init r18.10.06-1 (0.001s)
|   install margo: no
|   install state: done
| sublime.version: 3180
| sublime.channel: dev
|       about.ann: a18.10.06-1
|   about.version: r18.10.06-1
|         version: r18.10.06-1
|        platform: linux-x64
|            ~bin: ~/.config/sublime-text-3/Packages/User/GoSublime/linux-x64/bin
|       margo.exe: ~bin/gosublime.margo_r18.10.06-1_go1.11.1.exe (ok)
|          go.exe: /usr/lib/go/bin/go (ok)
|      go.version: go1.11.1
|          GOROOT: /usr/lib/go
|          GOPATH: ~/Projects/Go
|           GOBIN: (not set)
|       set.shell: []
|       env.shell: /usr/bin/zsh
|       shell.cmd: ['/usr/bin/zsh', '-l', '-c', '${CMD}']
|    sh.bootstrap: 
|                >  GOPATH is not set... setting it to the default: ~/go
|                >  using shell env CGO_CFLAGS_ALLOW=.*
|                >  using shell env CGO_CXXFLAGS_ALLOW=.*
|                >  using shell env CGO_LDFLAGS_ALLOW=.*
|                >  using shell env GOPATH=~/Projects/Go
|                >  using shell env GOROOT=/usr/lib/go
|                >  using shell env PATH=/usr/lib/ccache/bin/:~/Projects/Go/bin:~/.config/sublime-text-3/Packages/GoSublime/bin:~/.config/sublime-text-3/Packages/User/GoSublime/bin:~/go/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/opt/cuda/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:~/bin:/usr/local/go/bin:/usr/local/opt/go/bin:/opt/cuda/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
|                >  go version: `go1.11.1` (raw version string `go1.11.1`)
|                >  shell bootstrap took 0.069s
|                >
--------------------------------

[07:12:29] margo: agent#007: ['/home/arsham/.config/sublime-text-3/Packages/GoSublime/bin/margo.sh', 'start', 'margo.sublime', '-codec', 'msgpack']
[07:12:29] margo: agent#007: log: Using margo extension: /home/arsham/.config/sublime-text-3/Packages/User/GoSublime/src/margo
[07:12:29] margo: agent#007: log: ``` go install -v -tags="margo margo_extension" margo.sh/cmd/margo.sublime ```
[07:12:30] margo: agent#007: log: ``` /home/arsham/.config/sublime-text-3/Packages/GoSublime/bin/margo.sublime -codec msgpack ```
[07:12:30] margo: agent#007: log: store.go:137: started
[07:12:30] margo: agent#007: log: ``` go install margo.sh/vendor/golang.org/x/tools/cmd/guru ```

Margo

package margo

import (
    "margo.sh/golang"
    "margo.sh/mg"
)

// Margo is the entry-point to margo
func Margo(m mg.Args) {
    m.Use(
        mg.NewReducer(func(mx *mg.Ctx) *mg.State {
            return mx.SetConfig(mx.Config.EnabledForLangs(
                mg.AllLangs,
            ))
        }),
        &golang.GoCmd{},
        golang.GoFmt,
        &golang.Gocode{
            ShowFuncParams:     true,
            ProposeBuiltins:    true,
            Source:             true,
            UnimportedPackages: true,
            Debug:              true,
        },
        &golang.GocodeCalltips{},
        &golang.Guru{},
        golang.Snippets,
        &golang.SyntaxCheck{},
        &golang.TestCmds{
            TestArgs:  []string{},
            BenchArgs: []string{"-benchmem"},
        },
        golang.GoInstall("-i"),
        golang.GoVet(),
        golang.GoTest(),
        &golang.Linter{Name: "gometalinter", Args: []string{
            "--disable=gas",
            "--fast",
        }},
    )
}

I can confirm if I import fmt the completion works.

DisposaBoy commented 6 years ago

@arsham UnimportedPackages is not implemented, so you'll have to manually add the import or use goimports.

Also you can remove Source:; it's ignored now that the source code is used by default. See https://github.com/DisposaBoy/GoSublime/blob/development/CHANGELOG.md#180925

DisposaBoy commented 6 years ago

@notbaab That's not the latest version, see https://margo.sh/b/migrate/

notbaab commented 6 years ago

That was exactly the issue for me, thanks!

arsham commented 6 years ago

I can confirm that my issue has been resolved by this commit c5646a2ad98.

Thanks.

eddyli1989 commented 5 years ago

i also have the problem

[14:36:03] margo: agent#007: log: gocode.go:201: gocode didn't respond after 250ms taking 250ms [14:36:03] margo: agent#007: log: gocode.go:176: gocode didn't accept the request after 109ms [14:36:03] margo: agent#007: log: gocode.go:192: gocode eventually responded after 563ms [14:36:04] margo: agent#007: log: gocode.go:201: gocode didn't respond after 250ms taking 250ms [14:36:04] margo: agent#007: log: gocode.go:176: gocode didn't accept the request after 109ms [14:36:04] margo: agent#007: log: gocode.go:192: gocode eventually responded after 578ms [14:37:10] margo: agent#007: log: gocode.go:201: gocode didn't respond after 250ms taking 250ms [14:37:11] margo: agent#007: log: gocode.go:192: gocode eventually responded after 688ms [14:37:12] margo: agent#007: log: gocode.go:201: gocode didn't respond after 250ms taking 250ms [14:37:13] margo: agent#007: log: gocode.go:192: gocode eventually responded after 594ms

and gofmt always use tab but i want to use space,the fmt_tab_indent config seems not working

DisposaBoy commented 5 years ago

@suckli please open a new issue.

egroj97 commented 5 years ago

Hi, first I would like to say that your plugin is awesome and has made me a lot more productive developer. The only issue that I'm having right now is that when I type func, the http handler does not appear as completion suggestion. I'm using the default settings and:

egroj97@SmallFootIX:~/Code/go/src/gitlab.com/bolson67/wish$ go version
go version go1.11.2 linux/amd64

With the latest commit to this date:

commit 9be2a67d5dec0bc85736b44b1e09b79d3779aa05 (HEAD -> development, origin/development, origin/HEAD)
Author: DisposaBoy <disposaboy@kuroku.io>
Date:   Mon Dec 10 10:29:42 2018 +0000
rename Go.sublime-syntax to Go-Copy.sublime-syntax as work-around for DisposaBoy/GoSublime#893

If you could please give me any suggestion about it, I would really appreciate it. Thanks in advance.