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

Question how to not override DAP UI control buttons? #1230

Open
sytranvn opened this issue Apr 19, 2024 · 3 comments
Open

Question how to not override DAP UI control buttons? #1230

sytranvn opened this issue Apr 19, 2024 · 3 comments

Comments

@sytranvn
Copy link

I have this lualine config to display file path

    {
      options = {
        icons_enabled = true,
        theme = 'tokyonight',
        component_separators = '|',
        section_separators = '',
      },
      sections = {
        lualine_y = {
          'progress',
          'location'
        },
      },
      winbar = {
        lualine_x = { { 'filename', path = 1 } },
      },
      inactive_winbar = {
        lualine_x = { { 'filename', path = 1 } },
      }
    }

When I debug, the DAP UI buttons are overridden. When I switch window, I can see it flashes then disappears.

Screen.Recording.2024-04-19.at.18.21.07.mov
@snoweuph
Copy link

snoweuph commented Jun 1, 2024

I got some cod working, that gets them back, but only as text, and not as actuall buttons:

local function get_current_winbar()
	local winbar = vim.api.nvim_eval_statusline(vim.opt.winbar:get(), { use_winbar = true }).str
	winbar = winbar:gsub("^%s+", "")
	winbar = winbar:gsub("+$", "") -- My Lualine Separator
	winbar = winbar:gsub("%s+$", "")
	return winbar
end

local dapui = {}
dapui.sections = {
	lualine_a = {},
}
dapui.filetypes = {
	"dap-repl",
	"dapui_console",
	"dapui_console",
	"dapui_watches",
	"dapui_stacks",
	"dapui_breakpoints",
	"dapui_scopes",
}
dapui.winbar = {
	lualine_a = {
		{
			function()
				local filetype = vim.bo.filetype
				local disabled_filetypes = { "dap-repl" }
				if vim.tbl_contains(disabled_filetypes, filetype) then
					return get_current_winbar()
				else
					return vim.fn.expand("%:t")
				end
			end,
		},
	},
}

image

@snoweuph
Copy link

snoweuph commented Jun 1, 2024

Well, you could allways completely disable lualine fo the repl, by just putting "dap-repl",
in the options.disabled_filetypes

but that would not only disable it for the winbar, but also for the line

image

@snoweuph
Copy link

snoweuph commented Jun 1, 2024

I got it working, PR for extension will come soon:
image
image
image

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