Skip to content

Omni completion duplicate prefix #58

Open
@rnmmnen

Description

@rnmmnen

When I select an entry from the omni completion menu, the existing prefix is duplicated. I'm using the latest vim-rescript and the suggested omni completion configuration (without coc-vim).

The problem can be demonstrated (once issue #56 has been fixed) by first creating an empty .res file, compiling the project, opening the file in VIM or Neovim and then typing out the following:

Js.Un

Hit <C-x><C-o> in insert mode with the cursor at the end of the line. The only match (Undefined) will be selected as expected. Afterwards the buffer will look like this:

Js.UnUndefined

The plugin most probably shouldn't end up duplicating the common prefix.

It looks like VS Code does the right thing by default and "will replace the word until the cursor with the given label or insertText" in cases like this:

https://code.visualstudio.com/api/references/vscode-api#CompletionItem

This might be a bit problematic to fix client side, because it looks like the plugin must know the correct location when the completion function is first called (when findstart is set to 1). Could the bulk of the logic be moved there so that the second invocation would just return the already-populated list?

Or could the analysis binary be amended to include insertText?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions