GoFillStruct failed :No code actions available
go.nvim
● go.nvim 0.14ms start
dir /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/go.nvim
url https://github.com/ray-x/go.nvim
branch master
commit 9ac3e6f
readme README.md
help |go-nvim|
config
{
"ray-x/go.nvim",
dependencies = { -- optional packages
"ray-x/guihua.lua",
"neovim/nvim-lspconfig",
"nvim-treesitter/nvim-treesitter",
},
config = function()
require("go").setup()
end,
event = { "CmdlineEnter" },
ft = { "go", 'gomod' },
build = ':lua require("go.install").update_all_sync()' -- if you need to install/update all binaries
},
// else
keymap('n', '<leader>mm', [[<cmd>lua try_require'telescope'.extensions.goimpl.goimpl{}<CR>]])
keymap("n", "gI", "<cmd>lua try_require'telescope'.extensions.goimpl.goimpl{}<CR>")
keymap("", "gn", "<Cmd>GoGenReturn<cr>")
keymap("", "gt", "<Cmd>GoFillStruct<cr>")
local format_sync_grp = vim.api.nvim_create_augroup("GoFormat", {})
vim.api.nvim_create_autocmd("BufWritePre", {
pattern = "*.go",
callback = function()
require('go.format').goimport()
end,
group = format_sync_grp,
})
try_require('go').setup()
neovim version
$ v --version
NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1703358377
path
$ echo $PATH | grep "$GOPATH/bin"
/Users/edte/.cargo/bin:/opt/homebrew/bin:/Users/edte/.local/bin:/home/edte/.local/bin:/Users/edte/.local/share/zinit/polaris/bin:/opt/homebrew/bin:/opt/homebrew/bin:/Users/cygr-0101-01-0133/Documents/project/flutter/bin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/X11R6/bin:/Users/edte/go/bin
fill struct by cmd https://github.com/ray-x/go.nvim/assets/50194671/899ece7e-bfc2-4239-abfc-d656e4cb03d2
fill succ by lsp action
https://github.com/ray-x/go.nvim/assets/50194671/998c5d72-bef7-444a-a064-b97e65940480
checkhealth
==============================================================================
diffview: require("diffview.health").check()
Checking plugin dependencies ~
- OK nvim-web-devicons installed.
Checking VCS tools ~
- The plugin requires at least one of the supported VCS tools to be valid.
- OK Git found.
- OK Git is up-to-date. (2.41.0)
- WARNING Configured `hg_cmd` is not executable: 'hg'
==============================================================================
go: require("go.health").check()
Binaries ~
- go installed.
- Tool installed: callgraph
- Tool installed: gotests
- WARNING Missing tool: gonew
- Tool installed: dlv
- Tool installed: impl
- Tool installed: govulncheck
- Tool installed: goimports
- Tool installed: golines
- Tool installed: gomvp
- Tool installed: go-enum
- Tool installed: golangci-lint
- Tool installed: json-to-struct
- Tool installed: iferr
- Tool installed: gotestsum
- Tool installed: richgo
- Tool installed: mockgen
- Tool installed: ginkgo
- Tool installed: gorename
- Tool installed: gofumpt
- Tool installed: gomodifytags
- Tool installed: gopls
- Tool installed: guru
- Tool installed: fillswitch
- sed installed.
- curl installed.
- WARNING Some binaries are not installed, please check if your $HOME/go/bin or $GOBIN $exists and in your $PATH
Go Plugin Check ~
- OK lspconfig: plugin is installed
- OK nvim-treesitter: plugin is installed
- OK guihua: plugin is installed
- WARNING nvim-dap-virtual-text: not installed/loaded
- OK telescope: plugin is installed
- OK nvim-treesitter-go is installed
- OK nvim-dap: plugin is installed
- OK nvim-dap-ui: plugin is installed
- WARNING Not all plugin installed
- OK GOROOT is set
- OK GOBIN is set
- OK All environment variables set
- OK GOBIN is in PATH
==============================================================================
lazy: require("lazy.health").check()
lazy.nvim ~
- OK Git installed
- OK no existing packages found by other package managers
- OK packer_compiled.lua not found
- WARNING {nvim-treesitter-textobjects}: unknown key <after>
- WARNING {nvim-treesitter-textsubjects}: unknown key <after>
==============================================================================
mason: require("mason.health").check()
- ERROR Failed to run healthcheck for "mason" plugin. Exception:
function health#check,第 25 行
Vim(eval):E5108: Error executing lua ...arvim/site/pack/lazy/opt/mason.nvim/lua/mason/health.lua:333: function health#check[25]..health#report_error[2]..<SNR>123_format_report_message, line 7: a:1: expected String or List
stack traceback:
[C]: in function 'error'
...e/pack/lazy/opt/mason.nvim/lua/mason-core/async/init.lua:131: in function 'run_blocking'
...arvim/site/pack/lazy/opt/mason.nvim/lua/mason/health.lua:333: in function 'check'
[string "luaeval()"]:1: in main chunk
==============================================================================
null-ls: require("null-ls.health").check()
- sql-formatter: cannot verify if the command is an executable.
==============================================================================
nvim: require("nvim.health").check()
Configuration ~
- WARNING Missing user config file: /Users/edte/.config/lvim/init.vim
- ADVICE:
- :help |nvim-from-vim|
Runtime ~
- OK $VIMRUNTIME: /opt/homebrew/Cellar/neovim/0.9.5/share/nvim/runtime
Performance ~
- OK Build type: Release
Remote Plugins ~
- OK Up to date
terminal ~
- key_backspace (kbs) terminfo entry: `key_backspace=^H`
- key_dc (kdch1) terminfo entry: `key_dc=\E[3~`
- $TERM_PROGRAM="tmux"
- $COLORTERM="truecolor"
tmux ~
- OK escape-time: 0
- WARNING `focus-events` is not enabled. |'autoread'| may not work.
- ADVICE:
- (tmux 1.9+ only) Set `focus-events` in ~/.tmux.conf:
set-option -g focus-events on
- $TERM: tmux-256color
- WARNING Neither Tc nor RGB capability set. True colors are disabled. |'termguicolors'| won't work properly.
- ADVICE:
- Put this in your ~/.tmux.conf and replace XXX by your $TERM outside of tmux:
set-option -sa terminal-features ',XXX:RGB'
- For older tmux versions use this instead:
set-option -ga terminal-overrides ',XXX:Tc'
==============================================================================
nvim-treesitter: require("nvim-treesitter.health").check()
Installation ~
- OK `tree-sitter` found 0.20.8 (parser generator, only needed for :TSInstallFromGrammar)
- OK `node` found v21.7.1 (only needed for :TSInstallFromGrammar)
- OK `git` executable found.
- OK `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
Version: Apple clang version 15.0.0 (clang-1500.0.40.1)
- OK Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.
OS Info:
{
machine = "arm64",
release = "23.3.0",
sysname = "Darwin",
version = "Darwin Kernel Version 23.3.0: Wed Dec 20 21:30:44 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6000"
} ~
Parser/Features H L F I J
- bash ✓ ✓ ✓ . ✓
- c ✓ ✓ ✓ ✓ ✓
- comment ✓ . . . .
- commonlisp ✓ ✓ ✓ . .
- cpp ✓ ✓ ✓ ✓ ✓
- css ✓ . ✓ ✓ ✓
- d ✓ . ✓ ✓ ✓
- git_config ✓ . . . .
- gitcommit ✓ . . . ✓
- gitignore ✓ . . . .
- go ✓ ✓ ✓ ✓ ✓
- gomod ✓ . . . ✓
- gosum ✓ . . . .
- html ✓ ✓ ✓ ✓ ✓
- ini ✓ . ✓ . .
- java ✓ ✓ ✓ ✓ ✓
- javascript ✓ ✓ ✓ ✓ ✓
- json ✓ ✓ ✓ ✓ .
- jsonc ✓ ✓ ✓ ✓ ✓
- kdl ✓ ✓ ✓ ✓ ✓
- lua ✓ ✓ ✓ ✓ ✓
- make ✓ . ✓ . ✓
- markdown ✓ . ✓ ✓ ✓
- markdown_inline ✓ . . . ✓
- nix ✓ ✓ ✓ . ✓
- norg . . . . .
- proto ✓ . ✓ . .
- python ✓ ✓ ✓ ✓ ✓
- query ✓ ✓ ✓ ✓ ✓
- regex ✓ . . . .
- rust ✓ ✓ ✓ ✓ ✓
- scss ✓ . ✓ ✓ .
- sql ✓ . . ✓ ✓
- toml ✓ ✓ ✓ ✓ ✓
- tsx ✓ ✓ ✓ ✓ ✓
- typescript ✓ ✓ ✓ ✓ ✓
- vim ✓ ✓ ✓ . ✓
- vimdoc ✓ . . . ✓
- vue ✓ . ✓ ✓ ✓
- xml ✓ ✓ ✓ ✓ ✓
- yaml ✓ ✓ ✓ ✓ ✓
Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
+) multiple parsers found, only one will be used
x) errors found in the query, try to run :TSUpdate {lang} ~
==============================================================================
provider: health#provider#check
Clipboard (optional) ~
- OK Clipboard tool found: pbcopy
Python 3 provider (optional) ~
- pyenv: Path: /opt/homebrew/Cellar/pyenv/2.3.36/libexec/pyenv
- pyenv: $PYENV_ROOT is not set. Infer from `pyenv root`.
- pyenv: Root: /Users/edte/.pyenv
- `g:python3_host_prog` is not set. Searching for python3.11 in the environment.
- WARNING pyenv is not set up optimally.
- ADVICE:
- Create a virtualenv specifically for Nvim using pyenv, and set `g:python3_host_prog`. This will avoid the need to install the pynvim module in each version/virtualenv.
- Executable: /opt/homebrew/bin/python3.11
- Python version: 3.11.7
- pynvim version: 0.4.3 (outdated; from ~/Library/Python/3.11/lib/python/site-packages/neovim)
- WARNING Latest pynvim is NOT installed: 0.5.0
Python virtualenv ~
- OK no $VIRTUAL_ENV
Ruby provider (optional) ~
- Ruby: ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.arm64e-darwin23]
- WARNING `neovim-ruby-host` not found.
- ADVICE:
- Run `gem install neovim` to ensure the neovim RubyGem is installed.
- Run `gem environment` to ensure the gem bin directory is in $PATH.
- If you are using rvm/rbenv/chruby, try "rehashing".
- See :help |g:ruby_host_prog| for non-standard gem installations.
- You may disable this provider (and warning) by adding `let g:loaded_ruby_provider = 0` to your init.vim
Node.js provider (optional) ~
- Node.js: v21.7.1
- WARNING Missing "neovim" npm (or yarn, pnpm) package.
- ADVICE:
- Run in shell: npm install -g neovim
- Run in shell (if you use yarn): yarn global add neovim
- Run in shell (if you use pnpm): pnpm install -g neovim
- You may disable this provider (and warning) by adding `let g:loaded_node_provider = 0` to your init.vim
Perl provider (optional) ~
- WARNING "Neovim::Ext" cpan module is not installed
- ADVICE:
- See :help |provider-perl| for more information.
- You may disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim
==============================================================================
telescope: require("telescope.health").check()
Checking for required plugins ~
- OK plenary installed.
- OK nvim-treesitter installed.
Checking external dependencies ~
- OK rg: found ripgrep 13.0.0
- OK fd: found fd 8.7.0
===== Installed extensions ===== ~
Telescope Extension: `fzf` ~
- OK lib working as expected
- OK file_sorter correctly configured
- OK generic_sorter correctly configured
Telescope Extension: `goimpl` ~
- No healthcheck provided
Telescope Extension: `project` ~
- No healthcheck provided
Telescope Extension: `projects` ~
- No healthcheck provided
==============================================================================
vim.lsp: require("vim.lsp.health").check()
- LSP log level : WARN
- Log path: /Users/edte/.local/state/lvim/lsp.log
- WARNING Log size: 172069 KB
vim.lsp: Active Clients ~
- gopls (id=1, root_dir=/Users/edte/go/src/test)
==============================================================================
vim.treesitter: require("vim.treesitter.health").check()
- Nvim runtime ABI version: 14
- OK Parser: bash ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/bash.so
- OK Parser: c ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/c.so
- OK Parser: comment ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/comment.so
- OK Parser: commonlisp ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/commonlisp.so
- OK Parser: cpp ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/cpp.so
- OK Parser: css ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/css.so
- OK Parser: d ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/d.so
- OK Parser: gitcommit ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/gitcommit.so
- OK Parser: gitignore ABI: 13, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/gitignore.so
- OK Parser: git_config ABI: 13, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/git_config.so
- OK Parser: go ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/go.so
- OK Parser: gomod ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/gomod.so
- OK Parser: gosum ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/gosum.so
- OK Parser: html ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/html.so
- OK Parser: ini ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/ini.so
- OK Parser: java ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/java.so
- OK Parser: javascript ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/javascript.so
- OK Parser: json ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/json.so
- OK Parser: jsonc ABI: 13, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/jsonc.so
- OK Parser: kdl ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/kdl.so
- OK Parser: lua ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/lua.so
- OK Parser: make ABI: 13, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/make.so
- OK Parser: markdown ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/markdown.so
- OK Parser: markdown_inline ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/markdown_inline.so
- OK Parser: nix ABI: 13, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/nix.so
- OK Parser: norg ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/norg.so
- OK Parser: proto ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/proto.so
- OK Parser: python ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/python.so
- OK Parser: regex ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/regex.so
- OK Parser: rust ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/rust.so
- OK Parser: scss ABI: 13, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/scss.so
- OK Parser: sql ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/sql.so
- OK Parser: toml ABI: 13, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/toml.so
- OK Parser: tsx ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/tsx.so
- OK Parser: typescript ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/typescript.so
- OK Parser: vim ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/vim.so
- OK Parser: vimdoc ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/vimdoc.so
- OK Parser: vue ABI: 13, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/vue.so
- OK Parser: xml ABI: 14, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/xml.so
- OK Parser: yaml ABI: 13, path: /Users/edte/.local/share/lunarvim/site/pack/lazy/opt/nvim-treesitter/parser/yaml.so
- OK Parser: c ABI: 14, path: /opt/homebrew/Cellar/neovim/0.9.5/lib/nvim/parser/c.so
- OK Parser: lua ABI: 14, path: /opt/homebrew/Cellar/neovim/0.9.5/lib/nvim/parser/lua.so
- OK Parser: query ABI: 14, path: /opt/homebrew/Cellar/neovim/0.9.5/lib/nvim/parser/query.so
- OK Parser: vim ABI: 14, path: /opt/homebrew/Cellar/neovim/0.9.5/lib/nvim/parser/vim.so
- OK Parser: vimdoc ABI: 14, path: /opt/homebrew/Cellar/neovim/0.9.5/lib/nvim/parser/vimdoc.so
==============================================================================
which-key: require("which-key.health").check()
WhichKey: checking conflicting keymaps ~
- WARNING conflicting keymap exists for mode **"n"**, lhs: **"m"**
- rhs: `<Cmd>lua require'marks'.set()<CR>`
- WARNING conflicting keymap exists for mode **"n"**, lhs: **"dm"**
- rhs: `<Cmd>lua require'marks'.delete()<CR>`
- WARNING conflicting keymap exists for mode **"n"**, lhs: **"c"**
- rhs: `<Cmd>bd<CR>`
- WARNING conflicting keymap exists for mode **"n"**, lhs: **"#"**
- rhs: `*`
- WARNING conflicting keymap exists for mode **"n"**, lhs: **"gc"**
- rhs: `<Plug>(comment_toggle_linewise)`
- WARNING conflicting keymap exists for mode **"n"**, lhs: **"gb"**
- rhs: `<Plug>(comment_toggle_blockwise)`
- WARNING conflicting keymap exists for mode **"n"**, lhs: **"ys"**
- rhs: `<Plug>(nvim-surround-normal)`
- WARNING conflicting keymap exists for mode **"n"**, lhs: **"yS"**
- rhs: `<Plug>(nvim-surround-normal-line)`
Is the gopls enabled? the latest will use gopls to fillstruct. I donot see the issue from my side
https://github.com/ray-x/go.nvim/assets/1681295/5ff4c299-ee48-4bb2-8e8c-39e8d250fbda
gopls has enabled
and version
$ gopls version
golang.org/x/tools/gopls v0.13.2
golang.org/x/tools/[email protected] h1:Pyvx6MKvatbX3zzZmdGiFRfQZl0ohPlt2sFxO/5j6Ro=
Update go to the latest version
$ go version
go version go1.22.1 darwin/arm64
gopls downloaded by mason
$ /Users/edte/.local/share/lvim/mason/bin/gopls version
golang.org/x/tools/gopls v0.14.2
golang.org/x/tools/[email protected] h1:sIw6vjZiuQ9S7s0auUUkHlWgsCkKZFWDHmrge8LYsnc=
same question
Did you try with minium vimrc, you can use this one: https://github.com/ray-x/go.nvim/blob/master/playground/init_lazy.lua
You can run nvim -u init_lazy.lua your_go_file.go and try GoFillStruct
I just want to rule out the possibility that other plugin/tools/autocmd have been used.
Also, FYI, the GoFillStruct command will be tested by github action for each commit into branch & master. I have not seen any issues so far.
I'm also noticing this, GoFillStruct stopped working for me
My gopls version: golang.org/x/tools/gopls v0.15.2
Also : https://github.com/golang/go/issues/64297 seems it is upstream issue
My gopls is the same version as well. This is my config if I log before start.
{
capabilities = {
textDocument = {
completion = {
completionItem = {
commitCharactersSupport = true,
deprecatedSupport = true,
documentationFormat = { "markdown", "plaintext" },
insertReplaceSupport = true,
labelDetailsSupport = true,
preselectSupport = true,
resolveSupport = {
properties = { "documentation", "details", "additionalTextEdits" }
},
snippetSupport = true
},
contextSupport = true,
dynamicRegistration = true
}
}
},
cmd = { "gopls", "-remote=auto" },
filetypes = { "go", "gomod", "gosum", "gotmpl", "gohtmltmpl", "gotexttmpl" },
flags = {
allow_incremental_sync = true,
debounce_text_changes = 500
},
message_level = 1,
on_attach = <function 1>,
root_dir = <function 2>,
settings = {
gopls = {
analyses = {
ST1003 = true,
fieldalignment = false,
fillreturns = true,
nilness = true,
nonewvars = true,
shadow = true,
undeclaredname = true,
unreachable = true,
unusedparams = true,
unusedwrite = true,
useany = true
},
buildFlags = { "-tags", "integration" },
codelenses = {
gc_details = true,
generate = true,
regenerate_cgo = true,
test = true,
tidy = true,
upgrade_dependency = true,
vendor = true
},
completeUnimported = true,
diagnosticsDelay = "500ms",
gofumpt = false,
hints = {
assignVariableTypes = true,
compositeLiteralFields = true,
compositeLiteralTypes = true,
constantValues = true,
functionTypeParameters = true,
parameterNames = true,
rangeVariableTypes = true
},
["local"] = "...",
matcher = "Fuzzy",
semanticTokens = true,
staticcheck = true,
symbolMatcher = "fuzzy",
usePlaceholders = true
}
}
}