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

Different menu columns in cmdline #820

Open
Gelio opened this issue Dec 29, 2024 · 3 comments
Open

Different menu columns in cmdline #820

Gelio opened this issue Dec 29, 2024 · 3 comments
Labels
cmdline Related to the command line feature New feature or request

Comments

@Gelio
Copy link

Gelio commented Dec 29, 2024

Feature Description

I would love to be able to customize completion.menu.draw.columns based on the context, so that there are no unnecessary kind_icon and kind columns in cmdline:

image

I tried setting completion.menu.draw.columns to a function accepting ctx (like other config options do), but this one didn't work. The code only expects a table, not a function.

@Gelio Gelio added the feature New feature or request label Dec 29, 2024
@Saghen Saghen added the cmdline Related to the command line label Dec 29, 2024
@AbubakrBardien
Copy link

Hi, I'm in the same situation. But I thought using a function would work as long as I'm returning a table, right? Or maybe I wrote it wrong.

I tried doing this:

completion = {
	menu = {
		draw = {
			-- columns = { { "kind_icon", "label", "source_name", gap = 1 } },
			-- columns = { { "label", gap = 1 } },
			columns = function()
				if vim.api.nvim_get_mode().mode == "c" then
					return { { "label", gap = 1 } }
				else
					return { { "kind_icon", "label", "source_name", gap = 1 } }
				end
			end,
		},
	},
},

@Gelio
Copy link
Author

Gelio commented Dec 30, 2024

Yes, I had something like this in mind. If only columns could be a function.

@gennaro-tedesco
Copy link

gennaro-tedesco commented Dec 30, 2024

Notice I asked a similar question in the discussion section here. My idea was to use the context

menu.draw.components = {
  kind = {
    text = function(ctx)
	return ctx.mode == "cmdline" and "" or ctx.kind
    end,
  },
}

and return an empty string when in cmdline, however it seems that ctx.mode == "cmdline" always results to false (as if the specific context isn't seen as parameter).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmdline Related to the command line feature New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants