tzachar / cmp-tabnine

TabNine plugin for hrsh7th/nvim-cmp
MIT License
286 stars 28 forks source link

Problem with multi-line completion preview not receiving all lines or cutting it off #87

Closed henryoliver closed 1 year ago

henryoliver commented 1 year ago

Something simple to solve, but for some reason, the preview for ML completion is cutting or not receiving more than ten lines. I'm a pro user at Tabnine, and all my configuration seems fine here; my LSP previews go beyond 10 lines:

image

tabnine:setup({
    max_lines = 1000,
    max_num_results = 20,
    sort = true,
    run_on_every_keystroke = true,
    snippet_placeholder = " ",
    show_prediction_strength = true,
})
...
                if entry.source.name == "cmp_tabnine" then
                    local detail = (entry.completion_item.data or {}).detail

                    vim_item.kind = " "

                    if detail and detail:find(".*%%.*") then
                        vim_item.kind = vim_item.kind .. " " .. detail
                    end

                    if (entry.completion_item.data or {}).multiline then
                        vim_item.kind = vim_item.kind .. " " .. "[AI  - ML]"
                    end
                end

...

I appreciate any help you can give here. Thanks!

tzachar commented 1 year ago

I don't think this has something to do with this plugin, as I am not limiting the number of lines in the preview. It might related to the way you set up cmp's documentation window. Anyway, you can map keys to scroll the documentation window. Check cmp's config.

henryoliver commented 1 year ago

thanks @tzachar , all other documentation windows expand and have scroll on it, the only one with this issue is tabnine. But I'll do some research and try to work on my cmp config here. Thanks again!

henryoliver commented 1 year ago

@tzachar , the issue is somewhere here on this return, as you can see the value cuts on a certain threshold:

...
documentation = {
    kind = "markdown",
    value = '```javascript\nconst parseUrl = (url) => {\n    const link = document.createElement("a");\n    link.href = url;\n    return link;\n};\n\nconst test = Object.create(inserter, {\n    name: {\n        value: "test",\n    },\n```'
  },
  ...

https://github.com/tzachar/cmp-tabnine/blob/main/lua/cmp_tabnine/source.lua#L397

Is there a way to put a log on this result to see if Tabnine is actually sending the whole suggestion or just part of it?

tzachar commented 1 year ago

you can use dump().

tzachar commented 1 year ago

Anything on this?