Coder Social home page Coder Social logo

folke / trouble.nvim Goto Github PK

View Code? Open in Web Editor NEW
4.8K 23.0 160.0 774 KB

๐Ÿšฆ A pretty diagnostics, references, telescope results, quickfix and location list to help you solve all the trouble your code is causing.

License: Apache License 2.0

Lua 98.31% Vim Script 1.69%
neovim neovim-plugin neovim-lsp neovim-lua lua

trouble.nvim's Introduction

๐Ÿšฆ Trouble v3 Beta!

โ—Trouble has been rewritten from scratch. If you'd like to try the new version, please refer to the beta docs

image


๐Ÿšฆ Trouble v2

A pretty list for showing diagnostics, references, telescope results, quickfix and location lists to help you solve all the trouble your code is causing.

LSP Trouble Screenshot

โœจ Features

  • pretty list of:
    • Diagnostics
    • LSP references
    • LSP implementations
    • LSP definitions
    • LSP type definitions
    • quickfix list
    • location list
    • Telescope search results
  • automatically updates on new diagnostics
  • toggle diagnostics mode between workspace or document
  • interactive preview in your last accessed window
  • cancel preview or jump to the location
  • configurable actions, signs, highlights,...

โšก๏ธ Requirements

  • Neovim >= 0.7.2
  • Properly configured Neovim LSP client
  • nvim-web-devicons is optional to enable file icons
  • a theme with properly configured highlight groups for Neovim Diagnostics
  • or install ๐ŸŒˆ lsp-colors to automatically create the missing highlight groups
  • a patched font for the default severity and fold icons

๐Ÿ“ฆ Installation

Install the plugin with your preferred package manager:

return {
 "folke/trouble.nvim",
 dependencies = { "nvim-tree/nvim-web-devicons" },
 opts = {
  -- your configuration comes here
  -- or leave it empty to use the default settings
  -- refer to the configuration section below
 },
}

โš™๏ธ Configuration

Setup

Trouble comes with the following defaults:

{
    position = "bottom", -- position of the list can be: bottom, top, left, right
    height = 10, -- height of the trouble list when position is top or bottom
    width = 50, -- width of the list when position is left or right
    icons = true, -- use devicons for filenames
    mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist"
    severity = nil, -- nil (ALL) or vim.diagnostic.severity.ERROR | WARN | INFO | HINT
    fold_open = "๏‘ผ", -- icon used for open folds
    fold_closed = "๏‘ ", -- icon used for closed folds
    group = true, -- group results by file
    padding = true, -- add an extra new line on top of the list
    cycle_results = true, -- cycle item list when reaching beginning or end of list
    action_keys = { -- key mappings for actions in the trouble list
        -- map to {} to remove a mapping, for example:
        -- close = {},
        close = "q", -- close the list
        cancel = "<esc>", -- cancel the preview and get back to your last window / buffer / cursor
        refresh = "r", -- manually refresh
        jump = { "<cr>", "<tab>", "<2-leftmouse>" }, -- jump to the diagnostic or open / close folds
        open_split = { "<c-x>" }, -- open buffer in new split
        open_vsplit = { "<c-v>" }, -- open buffer in new vsplit
        open_tab = { "<c-t>" }, -- open buffer in new tab
        jump_close = {"o"}, -- jump to the diagnostic and close the list
        toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode
        switch_severity = "s", -- switch "diagnostics" severity filter level to HINT / INFO / WARN / ERROR
        toggle_preview = "P", -- toggle auto_preview
        hover = "K", -- opens a small popup with the full multiline message
        preview = "p", -- preview the diagnostic location
        open_code_href = "c", -- if present, open a URI with more information about the diagnostic error
        close_folds = {"zM", "zm"}, -- close all folds
        open_folds = {"zR", "zr"}, -- open all folds
        toggle_fold = {"zA", "za"}, -- toggle fold of current file
        previous = "k", -- previous item
        next = "j" -- next item
        help = "?" -- help menu
    },
    multiline = true, -- render multi-line messages
    indent_lines = true, -- add an indent guide below the fold icons
    win_config = { border = "single" }, -- window configuration for floating windows. See |nvim_open_win()|.
    auto_open = false, -- automatically open the list when you have diagnostics
    auto_close = false, -- automatically close the list when you have no diagnostics
    auto_preview = true, -- automatically preview the location of the diagnostic. <esc> to close preview and go back to last window
    auto_fold = false, -- automatically fold a file trouble list at creation
    auto_jump = {"lsp_definitions"}, -- for the given modes, automatically jump if there is only a single result
    include_declaration = { "lsp_references", "lsp_implementations", "lsp_definitions"  }, -- for the given modes, include the declaration of the current symbol in the results
    signs = {
      -- icons / text used for a diagnostic
      error = "๎ช‡",
      warning = "๎ฉฌ",
      hint = "๎ฉก",
      information = "๏‘‰",
      other = "๎ฉด",
    },
    use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client
}

๐Ÿ’ก if you don't want to use icons or a patched font, you can use the settings below

-- settings without a patched font or icons
{
    icons = false,
    fold_open = "v", -- icon used for open folds
    fold_closed = ">", -- icon used for closed folds
    indent_lines = false, -- add an indent guide below the fold icons
    signs = {
        -- icons / text used for a diagnostic
        error = "error",
        warning = "warn",
        hint = "hint",
        information = "info"
    },
    use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client
}

๐Ÿš€ Usage

Commands

Trouble comes with the following commands:

  • Trouble [mode]: open the list
  • TroubleClose [mode]: close the list
  • TroubleToggle [mode]: toggle the list
  • TroubleRefresh: manually refresh the active list

Modes:

  • document_diagnostics: document diagnostics from the builtin LSP client
  • workspace_diagnostics: workspace diagnostics from the builtin LSP client
  • lsp_references: references of the word under the cursor from the builtin LSP client
  • lsp_definitions: definitions of the word under the cursor from the builtin LSP client
  • lsp_type_definitions: type definitions of the word under the cursor from the builtin LSP client

Example keybindings:

" Vim Script
nnoremap <leader>xx <cmd>TroubleToggle<cr>
nnoremap <leader>xw <cmd>TroubleToggle workspace_diagnostics<cr>
nnoremap <leader>xd <cmd>TroubleToggle document_diagnostics<cr>
nnoremap <leader>xq <cmd>TroubleToggle quickfix<cr>
nnoremap <leader>xl <cmd>TroubleToggle loclist<cr>
nnoremap gR <cmd>TroubleToggle lsp_references<cr>
-- Lua
vim.keymap.set("n", "<leader>xx", function() require("trouble").toggle() end)
vim.keymap.set("n", "<leader>xw", function() require("trouble").toggle("workspace_diagnostics") end)
vim.keymap.set("n", "<leader>xd", function() require("trouble").toggle("document_diagnostics") end)
vim.keymap.set("n", "<leader>xq", function() require("trouble").toggle("quickfix") end)
vim.keymap.set("n", "<leader>xl", function() require("trouble").toggle("loclist") end)
vim.keymap.set("n", "gR", function() require("trouble").toggle("lsp_references") end)

API

You can use the following functions in your keybindings:

-- toggle trouble with optional mode
require("trouble").toggle(mode?)

-- open trouble with optional mode
require("trouble").open(mode?)

-- close trouble
require("trouble").close()

-- jump to the next item, skipping the groups
require("trouble").next({skip_groups = true, jump = true});

-- jump to the previous item, skipping the groups
require("trouble").previous({skip_groups = true, jump = true});

-- jump to the first item, skipping the groups
require("trouble").first({skip_groups = true, jump = true});

-- jump to the last item, skipping the groups
require("trouble").last({skip_groups = true, jump = true});

Telescope

You can easily open any search results in Trouble, by defining a custom action:

local actions = require("telescope.actions")
local trouble = require("trouble.providers.telescope")

local telescope = require("telescope")

telescope.setup {
  defaults = {
    mappings = {
      i = { ["<c-t>"] = trouble.open_with_trouble },
      n = { ["<c-t>"] = trouble.open_with_trouble },
    },
  },
}

When you open telescope, you can now hit <c-t> to open the results in Trouble

๐ŸŽจ Colors

The table below shows all the highlight groups defined for Trouble.

Highlight Group
TroubleCount
TroubleError
TroubleNormal
TroubleTextInformation
TroubleSignWarning
TroubleLocation
TroubleWarning
TroublePreview
TroubleTextError
TroubleSignInformation
TroubleIndent
TroubleSource
TroubleSignHint
TroubleSignOther
TroubleFoldIcon
TroubleTextWarning
TroubleCode
TroubleInformation
TroubleSignError
TroubleFile
TroubleHint
TroubleTextHint
TroubleText

trouble.nvim's People

Contributors

0x7a7a avatar abusch avatar augustocdias avatar bellini666 avatar codesofrishi avatar deecewan avatar eatgrass avatar echasnovski avatar elkowar avatar folke avatar github-actions[bot] avatar hanspinckaers avatar igorassuncao avatar jasonrhansen avatar jgoguen avatar jmbaur avatar jnalley avatar jordelver avatar jrnxf avatar lanej avatar lewis6991 avatar mariasolos avatar mike325 avatar n3wborn avatar prince213 avatar rcarriga avatar runiq avatar saecki avatar yodaembedding avatar zidhuss avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

trouble.nvim's Issues

Can this be made to work with coc-nvim?

From what I can gather from the Readme, it looks like this only works with the neovim LSP client? Any chance this could be expanded to work with coc-nvim (probably other popular LSP clients too?)

I could be totally misunderstanding how this works though...

Is there a way to disable folding?

Folding is causing me some grief - I inadvertently fold/unfold items and then it's difficult to switch back to editing. Is there an easy way to disable folding? It's ok (preferred, actually) to have the errors grouped by filename; I just don't want that list to collapse. Thank you.

Workspace diagnostics only includes open buffers

I can't figure out how to get all workspace diagnostics to show up.

I have lsp_extensions.nvim installed and overridden the publishDiagnostics handler in my config like so:

vim.lsp.handlers['textDocument/publishDiagnostics'] =
    vim.lsp.with(require('lsp_extensions.workspace.diagnostic').handler, {
        underline = false,
        signs = true,
        update_in_insert = false -- delay update
    })

When I run

:lua require('lsp_extensions.workspace.diagnostic').set_qf_list()

the quickfix list contains all diagnostics of files in the workspace. However when I run

:LspTroubleToggle lsp_workspace_diagnostics

it is empty. update: I actually just figured out it only shows diagnostics of currently open buffers.

How can I configure Trouble to pick up all workspace diagnostics?

Focus current line when opening Trouble

If my cursor is on a line with an error when I open Trouble, I'd like trouble to show the errors on that line.

Prerequisite:
Have your cursor on a line that has an error on it. Then run :Trouble

Current behaviour:
Trouble will open, and select the first error in the workspace. Your cursor will jump away from its current position to the file/location of the first error listed in Trouble.

Desired behaviour:
Trouble should recognize that there is an error on the current line, and initially focus that error. If not too difficult, it would be nice if it found the nearest error to the cursor, so if you were next to an error but not on it, Trouble would still jump to that error. But that's not quite as important to me.

is there a way to prevent auto_open from stealing focus?

First off, this is a great plugin. Thank you!

I have auto_open = true in my config. When I open up a file with errors, the trouble window opens... and steals focus from the main editing buffer.

Is there a way to disable that, or return focus to the editor window?

Send results to telescope

Hey,

I know there is a way to send telescope results to trouble.

But is there a way to send trouble results to telescope?

I find It easier to navigate telescope's picker when there are a lot of files in the project.

Thanks!

Ability to ignore certain errors

I have a Python project that uses the attrs library. The language server pyright doesn't support attrs and always reports errors when an attrs class is used. Therefore, the list provided in this plugin always contains a known set of things that I simply can't change. Having some kind of filtering possibility to ignore known errors would help very much in this situation.

No Highlighting When Jumping to Diagnostics with auto_preview off

Hi there!

Very cool plugin - happy to see you've borrowed from the telescope diagnostics code (as I see some of my comments in the code base) :) glad you've found it useful!

One thing I noticed when playing around with it with these settings

require("trouble").setup {
  use_lsp_diagnostic_signs = true,
  auto_preview = false,
}

unlike with auto previewing, highlighting (= tree-sitter) does not attach to the buffer when jumping to the diagnostic as can be seen in the video.

lsp_trouble-2021-04-22_20.37.35.mp4

I was able to reproduce this issue with a minimal config that only loads my nvim-treesitter config, my nvim-lsp config and LSP Trouble

From the initial looks of it, in my scenario vim.cmd "e" is skipped? I'm happy to further explore the code base and see if I can submit a PR but probably won't have time before Sunday evening.

Clear telescope search results

After populating the Trouble list with Telescope search results, is it possible to clear them somehow? Otherwise they continue to clutter up the list and there seems to be no way to "resolve" them.

vim.schedule lua callback error

I'm getting this error constantly, lsp trouble work with no problem but it's kinda annoying

Error executing vim.schedule lua callback: /usr/share/nvim/runtime/lua/vim/lsp/diagnostic.lua:1078: Vim(lua):E5108: Error executing lua ...onfig/nvim/plugged/lsp-trouble.nvim/lua/trouble/init.lua:32: attempt to call method 'match' (a nil value)

neovim version: NVIM v0.5.0-dev+1233-g82ac44d01 (I installed it using aur)

Auto open throws nil self error

Hi, thanks for your work on this plugin ๐Ÿš€ , it's very swanky which I'm a big fan of.

I just hit an issue I thought I'd mention. When setting auto open to true I see the following error

executing vim.schedule lua callback: /usr/share/nvim/runtime/lua/vim/lsp/diagnostic.lua:1078: Vim(lua):E5108: Error executing lua .../pack/packer/start/lsp-trouble.nvim
/lua/trouble/view.lua:230: attempt to index local 'self' (a nil value)

LspInfo shows

Configured servers: graphql, lua, diagnosticls, vim
Neovim logs at: /home/akin/.cache/nvim/lsp.log

2 client(s) attached to this buffer: diagnosticls, lua

  Client: diagnosticls (id 1)
  	root:      /home/akin/.dotfiles/.config/nvim/lua/as/plugins
  	filetypes: yaml, json, html, css, markdown, lua, graphql
  	cmd:       /home/akin/.local/share/nvim/lspinstall/diagnosticls/./node_modules/.bin/diagnostic-languageserver --stdio
  	


  Client: lua (id 2)
  	root:      /home/akin/.dotfiles
  	filetypes: lua
  	cmd:       /home/akin/.local/share/nvim/lspinstall/lua/./sumneko-lua-language-server
  	


3 active client(s): 

  Client: diagnosticls (id 1)
  	root:      /home/akin/.dotfiles/.config/nvim/lua/as/plugins
  	filetypes: yaml, json, html, css, markdown, lua, graphql
  	cmd:       /home/akin/.local/share/nvim/lspinstall/diagnosticls/./node_modules/.bin/diagnostic-languageserver --stdio
  	


  Client: lua (id 2)
  	root:      /home/akin/.dotfiles
  	filetypes: lua
  	cmd:       /home/akin/.local/share/nvim/lspinstall/lua/./sumneko-lua-language-server
  	


  Client: diagnosticls (id 3)
  	root:      /home/akin/.dotfiles/.config/nvim/lua/as/globals
  	filetypes: yaml, json, html, css, markdown, lua, graphql
  	cmd:       /home/akin/.local/share/nvim/lspinstall/diagnosticls/./node_modules/.bin/diagnostic-languageserver --stdio
  	


Clients that match the filetype lua:
  
  Config: lua
  	cmd:               /home/akin/.local/share/nvim/lspinstall/lua/./sumneko-lua-language-server
  	cmd is executable: True
  	identified root:   /home/akin/.dotfiles
  	custom handlers:   
  
  Config: diagnosticls
  	cmd:               /home/akin/.local/share/nvim/lspinstall/diagnosticls/./node_modules/.bin/diagnostic-languageserver --stdio
  	cmd is executable: True
  	identified root:   /home/akin/.dotfiles/.config/nvim/lua/as
  	custom handlers:   

Lemme know if you need anymore info.

Configurable diagnostics sorting

I'd like to sort diagnostics by line number. I see that right now diagnostics are sorted by severity here:

provider(win, buf, function(items)
table.sort(items, function(a, b)
if a.severity == b.severity then
return a.lnum < b.lnum
else
return a.severity < b.severity
end
end)
cb(items)
end, options)
end

That's done in an anonymous function. Do you think it would be reasonable to make this function configurable (so I can pass in my custom sorter)?

Directly jump on single results

I find myself "troubled" when I have to interact with trouble when there is only singular implementation or definition. I would prefer if I only jump to the definition or to the implementation instead of having to press <CR> or q to confirm the singular result or quit trouble.

Feature request: possibility of different grouping

Currently, when using with 'trouble.nvim' all found keyword comments are grouped by file. I often find myself wanting to look only at all TODOs. I can do that by unfolding everything and using built-in search, but it is a bit troublesome. Maybe there is a way to incorporate different grouping? So that folds represent different keywords and not files. Maybe a keymapping inside Trouble window?

Or is it better to open this issue in 'trouble.nvim'?

Command I am currently using: TroubleToggle todo.

Errors recognized only after files are visited

Hey, thanks for the really cool plugin.

I noticed that when I open a project and do lsp_workspace_diagnostics search, the list will be empty even if there are errors in the project.

Only after I visit the files with errors in them, will they show up in trouble.

Is this a limitation of nvim's LSP or intended behavior?

Errors from BufEnter/BufWinEnter Autocommands on opening after installing trouble

I'm getting the following errors after installing this plugin. I'm still in the process of learning lua and all the new stuff in 0.5 so apologies if this is user error. I have plenty of other stuff going on in my config but i'm not doing anything explicitly with these autocommands.

Thanks for all the work you've put into this!

Error detected while processing BufWinEnter Autocommands for "*":
E5108: Error executing lua [string ":lua"]:1: attempt to index a boolean value
Error detected while processing BufEnter Autocommands for "*":
E5108: Error executing lua [string ":lua"]:1: attempt to index a boolean value
Error executing vim.schedule lua callback: ...ovim/0.5.0/share/nvim/runtime/lua/vim/lsp/diagnostic.lua:1091: Vim(lua):E5108: Error executing lua [string ":lua"]:1: attempt to index a boolean value

No errors shown in list

I installed lsp-trouble.nvim with Vim-Plug
nvim version: 0.5 nightly
I use your tokyonight colorscheme

I created a file to test the LspTrouble.
Then I used :LspTroubleOpen

Screen Shot 2021-04-29 at 14 59 46

The list is just empty even though, there are errors

Question: Possible to Target the Trouble buffer?

I can't seem to figure out how I target the Trouble buffer, so I can run certain commands automatically from autocmd. Is it possible to create an autocmd that triggers when you open the Trouble buffer?

Make list UI more generically usable

Currently, this is one of the, if not the best UIs for a location-jump list interface. Especially once #15 is implemented, the UX here will be pretty much perfect!

Given that fact, I'd love to use the same UI in other places, too - such as a list references menu, stuff like that.

It would be amazing if it was possible to provide a more generic API for the list UI that can be used from outside of the plugin (such that I could manually implement this as my find-references provider, too), and, optimally, if this would just support these other use-cases out of the box.

Thanks for making an amazing plugin!

[Feature] some external function

How do I move to the next item on trouble but my current buffer is not in trouble? If i use quick fix i can do that.
I want display the total error warning and hint in my custom statusline for filetype. Can you expose some function to get that data.
Thank you.

closing trouble gives focus back to the wrong window

Suppose you have two windows open, and . is current cursor position

|--------------|-------------|
|              | .           |
|              |             |
|      1       |      2      |
|              |             |
|              |             |
|--------------|-------------|

running :Trouble opens the window and gives focus to the window (new . below)

|--------------|-------------|
|              |             |
|              |             |
|      1       |      2      |
|              |             |
|              |             |
|--------------|-------------|
| .                          |
|           trouble          |
|----------------------------|

now, pressing q (default keymap) results in the cursor going back to window 1

|--------------|-------------|
| .            |             |
|              |             |
|      1       |      2      |
|              |             |
|              |             |
|--------------|-------------|

where i feel it should probably go back to it's previous position in window 2

Feature request: Support more actions

Thanks for the cool plugin.

In some case, I want to open the buffer in a new tab or a split window instead of the current window. It would be nice that the plugin has tabe, vsplit and split actions.

Auto open and auto close doesn't work

Hi, thank you for making such an awesome plugin. I notice that the auto_open and auto_close doesn't work.

This is my configuration

local function init(paq)
	paq{'folke/trouble.nvim'}
	require'trouble'.setup{
		position = "left",
		width = 30,
		use_lsp_diagnostic_signs = true,
		indent_lines = false,
		auto_open = true, 
		auto_close = true,
	}
	vim.api.nvim_set_keymap("n", "<C-l>", "<cmd>Trouble lsp_document_diagnostics<cr>",
	{silent = true, noremap = true}
	)
end

return {
	init = init
}

Can't configure signs

I've tried different symbols and plain text. Doesn't seem to make any difference. The action_keys config works.

use {
  'folke/lsp-trouble.nvim',
  requires = {
    'kyazdani42/nvim-web-devicons'
  },
  config = function()
    require( 'trouble' ).setup {
      action_keys = {
        toggle_fold = { '<Space>' }
      },
      signs = {
        error = '๏— ',
        warning = '๏ฑ ',
        hint = '๏ ต ',
        information = '๏š '
      }
    }
  end
}

Option to exclude files / directories

Lsp needs to parse dependent libraries (e.g. vendored modules in go), but any issues reported with the code are most likely not relevant to the Trouble user. It would be nice if files / directories can be excluded based on e.g. a glob pattern.

[Feature request] Add lsp_document_symbols

I like the UI of this plugin and would love to be able to integrate into my LSP environment. One thing I think would work well is adding the ability to show symbols so that one can keep the menu open on one side to reference assignments

Turn a window into the trouble list

Hi. I've spent minimal time with trouble so far, so apologies if this is somewhere I haven't found yet.

I want a way to turn an existing (empty) buffer into the trouble list. (Ideally I'd love to also have trouble use part of a buffer that is also being used for other things, but that I assume is more complex).

Does at least the former exist? What I see so far just looks like allowing trouble to do the split itself via LspTroubleOpen/Toggle, but I haven't fully read through the Lua API yet.

And thanks!

Semantic highlight gets messed up when used with ccls + vim-lsp-cxx-highlight

I'm trying to use this plugin on c++ development which uses ccls as the language server and vim-lsp-cxx-highlight as the plugin that does the semantic highlighting.

When I get the all references of some function through TroubleToggle lsp_references it pops up a separate buffer giving the correct occurrences accurately. Also I can hover through the suggestions where it opens up temporary buffers displaying the files. But when I quit the list I could observe all the highlights on the original file which I started with is all messed up

I'm not entirely sure if this is an issue in this plugin or the lsp cxx highlight plugin.

Trouble highlight links aren't updated since rename

Hi @folke,

I've been tweaking the colors for my trouble window, and according to the docs TroubleText is supposed to be a base for a few other text highlight groups. So I tried tweaking trouble text hoping it would affect the colours of the linked groups but it didn't. Inspecting those groups it seems that most of them link to the old highlight groups e.g. TroubleText -> LspTroubleText, I think somewhere along the linking highlight groups aren't being linked correctly?

Sorry that felt rambly so TLDR.
I've set TroubleText to guifg=x guibg=x but this doesn't update the highlights for TroubleErrorText for example. I tried sequencing things a bit differently but didn't see a difference.

Option to auto-close error-list after confirming a jump

I'd love to have the error list automatically close once I jump to one of the errors (i.e. hit enter). Currently, if i want to close it again after jumping, i have to <C-w><C-w>q, which is rather anoying. having a close_on_jump option would be nice, and is the main thing keeping me from using this right now

Jump to next warning or next error

There are next and previous functions, it would be great to have an option to jump a trouble with a specific type. It allows to focus on more severe troubles without distracting to non-significant troubles at the moment.

Cursor position outside buffer (telescope into qfix)

First things first: YOU ARE AWESOME! Ty for your work!

Currently my workflow involves telescoping into quickfix. With trouble ill get lua exceptions, because telescope adds files with position [0, 0] to qfix.

image

After navigating on one entry with preview set to true, nvim fires:

image

Execute commands on each line/file?

Hello! Trouble looks great, the only thing stopping me using it is the ability to execute commands on each file in the list.

My primary usecase is project-wide search and replace, example workflow:

  1. Execute a project-wide search (using e.g. Telescope or fzf)
  2. Open the results in a quickfix window
  3. Use cdo or cfdo to do a find/replace on each file or each result

Is anything like this possible with Trouble, or would you consider it a useful feature? Thanks โœŒ๏ธ

(side note: also open to hearing about other workflows for project wide find/replace!)

Invalid buffer id on opening Trouble

Hi,

I've been getting an intermittent error using trouble for quite a while now when running
Trouble lsp_workspace_diagnostics ever so often the command will fail with the following error

E5108: Error executing lua ...m/site/pack/packer/opt/trouble.nvim/lua/trouble/util.lua:72: Invalid buffer id: 13

This error also seems to take down Telescope's workspace diagnostics once it happens. I can still access the diagnostics using the lsp's set loclist function on LspDiagnosticsChanged. I'm not really sure what is happening exactly since it only happens from time to time.

Looking at the code the process_items function seems to be where it's happening i.e. a bufnr is being passed to nvim_buf_get_name but the number is no longer valid. Seems to have been unloaded, when I check for the buffer number using ls! it is not in the list.

Tbh I'm not sure why/how it has reference to a buffer that has since vanished but I guess a naive fix would be to check the bufnr is valid before using it.

As the logic is borrowed from telescope and it also errors it seems somewhere/somehow in my config or some plugin a buffer is being created which this plugin gets a reference to then being removed but I can't identify what is doing it because by the time this error occurs all traces of this buffer are gone

Highlight group for EndOfBuffer

Hi ๐Ÿ‘‹๐Ÿพ ,

I just started customising my LspTroubleNormal background and noticed that it doesn't include the EndOfBuffer highlight so things looks like this.

image

The first line is the darkened highlight and the bottom is the EndOfBuffer. I think it should default link to LspTroubleNormal so it would be something like.

setlocal winhighlight=Normal:LspTroubleNormal,EndOfBuffer:LspTroubleNormal,SignColumn:LspTroubleNormal

This way a user can change the color of the full window not just part of it.

Diagnostic Icons

Hi, how do i get the diagnostic icons in the gutter?

image

Plug 'kyazdani42/nvim-web-devicons'
Plug 'folke/trouble.nvim'

Multi-line diagnostics

Hey, would you consider supporting multi-line diagnostics? Right now all lines are concatenated and displayed in a single line, while vim.lsp.diagnostic.show_line_diagnostics() displays them correctly.

screenshot-210427-094654

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.