hrsh7th / cmp-nvim-lsp-signature-help

cmp-nvim-lsp-signature-help
638 stars 26 forks source link

Incorrectly suggests outer parameter name when in objects #31

Open laurelmay opened 1 year ago

laurelmay commented 1 year ago

For a TypeScript function with a signature like:

type Properties = {
  fieldA?: string;
  fieldB?: string;
};

function fn(name: string, props: Properties) {}

When it is called like:

fn("Test", { fieldA: "test",  });

cmp-nvim-lsp-signature-help will suggest props as a completion for items inside of the Properties object.

For example image

This does not happen before the first field in the object is specified, but it will always happen after the last comma within the object until you start typing the name of the next field.

When trying to insert line breaks between each field, this often results in automatically selecting the incorrect suggestion for the parameter name since it's suggested right after the comma.

rj1 commented 1 year ago

i'm experiencing something similar using lsp-signature-help + eslint

video of behavior

https://user-images.githubusercontent.com/83531587/228771551-5c4a860e-536d-456a-97bc-e9d7b806d3db.mp4

in my configuration, i used:

cmp.setup({
  preselect = cmp.PreselectMode.None,
})

now it doesn't autoselect and cause the annoyance, but i'm not sure if that's the ideal solution

markmansur commented 1 year ago

The preselect = None solution does work. But it's very annoying that I now need another keypress when I actually want to autocomplete

nikhcevov commented 1 month ago

Any updates on this? Still has the issue