Comments (4)
It looks ok now
Thanks!!!!!!
I am not a lsp-installer user. If you still seeing issues, please add a minimum vimrc for me to reproduce.
structure
# ~/.config/nvim/
.
├── ...
├── init.lua
├── lua
│ ├── ...
│ ├── go-setup.lua
│ ├── lsp-setup.lua
│ └── ...
└── ...
A
version
Available prior to this version
problem
- attemp to compare string with nil
gopls
(py39) xxx@xxx: ~ $ echo $PATH
/Users/xxx/.cargo/bin:
/usr/local/Caskroom/miniconda/base/envs/py39/bin:
/usr/local/Caskroom/miniconda/base/condabin:
/Users/xxx/.nvm/versions/node/v16.13.2/bin:
/Users/xxx/.jenv/shims:
/Users/xxx/.jenv/bin:
/usr/local/bin:
/usr/bin:
/bin:
/usr/sbin:
/sbin:
/Users/xxx/go/bin (gopls)
(py39) xxx@xxx: ~ $ gopls version
golang.org/x/tools/gopls master 👈 (that time : master??? not v0.7.5)
golang.org/x/tools/[email protected] h1:8Az52YwcFXTWPvrRomns1C0N+zlgTyyPKWvRazO9GG8=
local v = vim.fn.system("gopls version"):match("%s+v([%d%.]+)%s+")
print(v) -- nil
structure
init.lua
require 'go-setup'
require 'lsp-setup'
go-setup.lua
require('go').setup({
goimport = 'gopls', -- if set to 'gopls' will use golsp format
gofmt = 'gopls', -- if set to gopls will use golsp format
max_line_len = 120,
tag_transform = false,
test_dir = '',
comment_placeholder = ' ',
lsp_cfg = false, -- false: use your own lspconfig
lsp_gofumpt = true, -- true: set default gofmt in gopls format to gofumpt
lsp_on_attach = true, -- use on_attach from go.nvim
dap_debug = true,
})
lsp-setup.lua
local lsp_installer = require 'nvim-lsp-installer'
lsp_installer.on_server_ready(function(server)
local opts = {
on_attach = on_attach,
capabilities = capabilities,
}
if language_servers[server.name] then
if server.name == ... then
-- config
-- ...
server:attach_buffers()
elseif server.name == "gopls" then
local go_lsp_opts = require'go.lsp'.config() -- config() return the go.nvim gopls setup
go_lsp_opts = vim.tbl_deep_extend("force", go_lsp_opts, opts)
server:setup(go_lsp_opts)
else
-- config
-- ...
server:setup(opts)
end
end
end)
B
version
problem
- "E730: using List as a String"
gopls
(py39) xxx@xxx: ~ $ echo $PATH
/Users/xxx/.local/share/nvim/lsp_servers/go: (gopls)
/Users/xxx/.cargo/bin:
/usr/local/Caskroom/miniconda/base/envs/py39/bin:
/usr/local/Caskroom/miniconda/base/condabin:
/Users/xxx/.nvm/versions/node/v16.13.2/bin:
/Users/xxx/.jenv/shims:
/Users/xxx/.jenv/bin:
/usr/local/bin:
/usr/bin:
/bin:
/usr/sbin:
/sbin:
/Users/xxx/go/bin (gopls)
(py39) xxx@xxx: ~ $ gopls version
golang.org/x/tools/gopls v0.7.5
golang.org/x/tools/[email protected] h1:8Az52YwcFXTWPvrRomns1C0N+zlgTyyPKWvRazO9GG8=
structure
init.lua
require 'go-setup'
require 'lsp-setup'
go-setup.lua
local path = require 'nvim-lsp-installer.path'
local install_root_dir = path.concat { vim.fn.stdpath 'data', 'lsp_servers' }
require('go').setup {
gopls_cmd = { install_root_dir .. '/go/gopls' },
filstruct = 'gopls',
dap_debug = true,
dap_debug_gui = true,
}
lsp-setup.lua
local lsp_installer = require 'nvim-lsp-installer'
lsp_installer.on_server_ready(function(server)
local opts = {
on_attach = on_attach,
capabilities = capabilities,
}
if language_servers[server.name] then
if server.name == ... then
-- config
-- ...
server:attach_buffers()
elseif server.name == "gopls" then
local go_lsp_opts = require'go.lsp'.config() -- config() return the go.nvim gopls setup
go_lsp_opts = vim.tbl_deep_extend("force", go_lsp_opts, opts)
server:setup(go_lsp_opts)
else
-- config
-- ...
server:setup(opts)
end
end
end)
from go.nvim.
If you are using lsp-installer you need to export the PATH
check this: https://github.com/ray-x/go.nvim#integrate-with-nvim-lsp-installer
And also make sure you are using the latest version.
from go.nvim.
another error:
"E730: using List as a String"
If you are using lsp-installer you need to export the PATH
echo $PATH
/Users/xxx/.local/share/nvim/lsp_servers/go:
/Users/xxx/.cargo/bin:
/usr/local/Caskroom/miniconda/base/envs/py39/bin:
/usr/local/Caskroom/miniconda/base/condabin:
/Users/xxx/.nvm/versions/node/v16.13.2/bin:
/Users/xxx/.jenv/shims:
/Users/xxx/.jenv/bin:
/usr/local/bin:
/usr/bin:
/bin:
/usr/sbin:
/sbin:
/Users/xxx/go/bin
gopls version
golang.org/x/tools/gopls v0.7.5
golang.org/x/tools/[email protected] h1:8Az52YwcFXTWPvrRomns1C0N+zlgTyyPKWvRazO9GG8=
-- copy from https://github.com/ray-x/go.nvim#integrate-with-nvim-lsp-installer
local path = require 'nvim-lsp-installer.path'
local install_root_dir = path.concat { vim.fn.stdpath 'data', 'lsp_servers' }
require('go').setup {
gopls_cmd = { install_root_dir .. '/go/gopls' },
filstruct = 'gopls',
dap_debug = true,
dap_debug_gui = true,
}
-- lsp-installer setup
...
elseif server.name == "gopls" then
-- require'go.lsp'
local go_lsp_opts = require'go.lsp'.config() -- config() return the go.nvim gopls setup
go_lsp_opts = vim.tbl_deep_extend("force", go_lsp_opts, opts)
server:setup(go_lsp_opts)
...
git log --oneline
f599a5e (HEAD -> master, origin/master, origin/HEAD) gopls cmd fallback
ce29866 lsp installer path setup for version check
180e44a (grafted) handle nil
from go.nvim.
I pushed another version to fix this issue.
I am not a lsp-installer user. If you still seeing issues, please add a minimum vimrc for me to reproduce. Thanks!
from go.nvim.
Related Issues (20)
- Is there an equivalent of `:GoErrCheck` in ray-x/go.nvim like in fatih/vim-go? HOT 4
- JSON style log output from failing test breaks :GoTestFile HOT 7
- Lint error that cannot be ignored and disabled HOT 3
- Remove or Change the toggle gc annotation details HOT 7
- Equivalent of GoImplements from Fatih/vim-go? HOT 3
- how to use goimports-reviser instead of goimports HOT 2
- GoAddTag doesn't work HOT 5
- "zero config for you debug adapter" is not true HOT 1
- Question: For lazy.nvim configuration, why is it recommended to load on event `CmdlineEnter`?
- Have a minimal version with just compiler options
- max_line_len doesn't work in some condition HOT 1
- Inlay hints disappear after saving HOT 8
- autoformat on save deletes stuff (with LunarVim) HOT 2
- Is there any way to mark the unused functions
- go.nvim code conflicts with latest nvim-treesitter code HOT 2
- feature request: :GoBuild respect autowrite
- GoModTidy has effect only run in a buffer with go.mod HOT 1
- Crash with latest treesitter HOT 3
- TMPL file not supported? HOT 7
- `GoTestFunc` is broken on fish shell after updating to latest version
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go.nvim.