Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jump vim.lsp.diagnostic.goto_prev and vim.lsp.diagnostic.goto_next #25

Closed
xakep71k opened this issue Nov 24, 2021 · 5 comments
Closed

Comments

@xakep71k
Copy link

Hello!
Thank you very much. I really enjoy your plugin.
Is it possible to implement jump to linter's warning with lua vim.lsp.diagnostic.goto_prev() and lua vim.lsp.diagnostic.goto_next()?
And see count of warning at airline?

@crispgm
Copy link
Owner

crispgm commented Nov 25, 2021

Thanks for your suggestions.

Linters are not vim.lsp.diagnostic, they just pop into qflist. If there is a way to put them together (e.g. A qflist manager plugin), I can do that.

Airline support is a good idea. I will check it later.

@xakep71k
Copy link
Author

xakep71k commented Dec 5, 2021

This https://github.com/nametake/golangci-lint-langserver are vim.lsp.diagnostic so I can jump to linter's warning with lua vim.lsp.diagnostic.goto_prev() and lua vim.lsp.diagnostic.goto_next(). And it has warning on airline panel. It would be so great if users can specify this integration through opts, for example in lint_prompt_style

@crispgm
Copy link
Owner

crispgm commented Dec 6, 2021

This https://github.com/nametake/golangci-lint-langserver are vim.lsp.diagnostic so I can jump to linter's warning with lua vim.lsp.diagnostic.goto_prev() and lua vim.lsp.diagnostic.goto_next(). And it has warning on airline panel. It would be so great if users can specify this integration through opts, for example in lint_prompt_style

They actually implement a language server for golangci-lint. I think this is not possible for nvim-go right now, because we support multiple third-party linters (golangci-lint, golint(revive), staticcheck, and etc.) and we are not able to implement multiple langservers or an integrated langserver.

If you use golangci-lint, I recommend that you might disable nvim-go auto-lint feature, and setup golangci-lint-langserver. This would perfectly fit your use case.

require('go').setup({
      auto_lint = false,
})

@crispgm
Copy link
Owner

crispgm commented Dec 7, 2021

@xakep71k I just added a commit which can implement issues count for various status line plugins. For airline, please add this to your .vimrc or Lua equivalent config:

    function! LintIssuesCount()
        if exists('g:nvim_go#lint_issues_count')
            return g:nvim_go#lint_issues_count
        endif
    endfunction
    call airline#parts#define_function('nvim_go', 'LintIssuesCount')
    call airline#parts#define_condition('nvim_go', '&filetype == "go"')
    let g:airline_section_warning = airline#section#create_right(['nvim_go'])

@crispgm
Copy link
Owner

crispgm commented Dec 7, 2021

And also there are some examples here: https://github.com/crispgm/nvim-go#statusline-count

@crispgm crispgm closed this as completed Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants