Comments (6)
Hi, @jonleopard
I added gopls_cmd
in config
Could you check if the latest version works for you?
from go.nvim.
Seems to be working now! I've added gopls_cmd = {DATA_PATH .. "/lspinstall/go/gopls"}
to my config. When I run lspinfo
it seems that two clients are attached, which confuses me:
It looks like its adding two paths for some reason:
...lspinstall/go/./gopls
...lspinstall/go/gopls
Additionally, when I save the file and it formats, it prompts me for which lsp server to use:
from go.nvim.
Ah, I fixed it! There was something wrong in my config. One last quick question: when I save a buffer, it formats but doesn't import missing packages. Is this default setting or do I need to enable it somehow?
from go.nvim.
If you want both import and format. You can use either Goimport, which is defined as:
vim.cmd([[command! Goimport lua require("go.format").goimport()]])
Or add:
autocmd BufWritePre *.go :silent! lua require('go.format').goimport()
from go.nvim.
Works like a charm, thanks! It seems Lua doesn't have a autocommand support yet. So if anyone reading this wants this autocmd BufWritePre *.go :silent! lua require('go.format').goimport()
to work in lua, you can do so like this:
-- Format on save
vim.api.nvim_exec([[ autocmd BufWritePre *.go :silent! lua require('go.format').gofmt() ]], false)
-- Import on save
vim.api.nvim_exec([[ autocmd BufWritePre *.go :silent! lua require('go.format').goimport() ]], false)
Thanks again for your help!
from go.nvim.
Thanks!
I will put your codes in README.md as well
from go.nvim.
Related Issues (20)
- neovim nightly changed the inlay hint api again.
- [change request] quickfix behavior when running :GoBuild HOT 2
- /usr/share/nvim/runtime/lua/vim/lsp/inlay_hint.lua:375: enable: expected boolean, got table HOT 5
- [Windows] `:checkhealth` does not report true for `GOBIN` and `GOROOT` HOT 1
- inlay_hint.lua:383: enable: expected boolean, got table HOT 2
- vim.lsp.get_active_clients() is deprecated, use vim.lsp.get_clients() instead HOT 2
- Bug: diagnostic api change not work in neovim 0.10. HOT 2
- [null-ls] failed to run generator: ...go/null_ls.lua:201: attempt to index field 'golangci_lint' (a nil value) HOT 6
- Diagnostic update in insert not working HOT 7
- gopls -debug=localhost:8080 HOT 2
- set diagnostic to `false` will be error
- vim shows import error until re-open HOT 2
- How to get highlights and injections to work with go-templates
- New? enable: expected boolean, got number HOT 2
- Provide a way to run alternate command for eg. go and go test HOT 2
- Error from InsertLeave Autocmd, codelens not supported
- 'Buffer file://<filepath> newer than edits.' when importing things on neovim nightly (0.11.0)
- GoRun try install package run HOT 8
- How to avoid conflict with navigator HOT 3
- help finding autocomplete bug: extmark/helper text persists. HOT 3
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.