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

[FEAT]: Show diagnostics option #110

Open
3 tasks done
adonespitogo opened this issue May 20, 2024 · 0 comments · May be fixed by #111
Open
3 tasks done

[FEAT]: Show diagnostics option #110

adonespitogo opened this issue May 20, 2024 · 0 comments · May be fixed by #111
Labels
enhancement New feature or request

Comments

@adonespitogo
Copy link

Requirements

  • This feature isn't just a vague idea and can have a good practical solution.
  • I'm completely sure that this feature fits into this plugin.
  • I'm willing to implement this through a PR.

Problem

I'm using winbar to work with multiple windows. I want to able to see if a certain file has errors at a glance.

Solution Suggestion

Since we have a show_modified option, I think it's also good to have show_diagnostics option.

Workaround

Using the custom_section to show a text or symbol when there are diagnostics error:

-- winbar plugin
return {
	"utilyre/barbecue.nvim",
	name = "barbecue",
	version = "*",
	dependencies = {
		"SmiteshP/nvim-navic",
		"nvim-tree/nvim-web-devicons", -- optional dependency
	},
	config = function()
		local function has_diagnostics(buf)
			local severties = { "error", "warning" }
			for _, sev in ipairs(severties) do
				local n = #vim.diagnostic.get(buf, { severity = vim.diagnostic.severity[string.upper(sev)] })
				if n > 0 then
					return true
				end
			end
			return false
		end

		require("barbecue").setup({
			custom_section = function(bfnr, _)
				local custom = ""
				if has_diagnostics(bfnr) then
					custom = "" .. custom
				end
				return custom
			end,
		})
	end,
}
@adonespitogo adonespitogo added the enhancement New feature or request label May 20, 2024
@adonespitogo adonespitogo linked a pull request May 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant