Skip to content

Do not insert parentheses when completing function #412

@cdelledonne

Description

@cdelledonne

Observed behavior

I'm using ccls+LanguageClient as a source for completion items for deoplete for C files in Neovim. Say that we have this C file:

Screenshot from 2019-06-14 18-41-49

If I start typing foo, the completion menu presents me with the options foo_noarg, which is a function that takes no arguments, and foo_witharg, a function that takes one argument.

The "newText" completion string of foo_noarg is "foo_noarg()", with both parentheses inserted

Screenshot from 2019-06-14 18-43-38

The "newText" completion string of foo_witharg is "foo_witharg(", with only the left parenthesis inserted

Screenshot from 2019-06-14 18-42-59

Preferred behavior

Though I understand the rationale for this design choice, I would like to be given the option of not automatically inserting parentheses.

The first reason is that parentheses are not needed when assigning to a function pointer, e.g.:

typedef void (* fp)();
fp foo = foo_noarg;

The second reason is that I use a Vim plugin that, when pressing ), brings the cursor to the next closing parenthesis in the buffer, rather than inserting a parenthesis. This requires that all opening parentheses have a matching closing parenthesis, which, in the case of foo_witharg(, is not true.

The first reason is more generic, the second more personal, but I think it would be great to at least give the user the option to choose whether to auto-insert parentheses or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions