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

cmp-spell cannot sort by order at first entry #12

Closed
Jaehaks opened this issue Apr 5, 2024 · 1 comment
Closed

cmp-spell cannot sort by order at first entry #12

Jaehaks opened this issue Apr 5, 2024 · 1 comment

Comments

@Jaehaks
Copy link

Jaehaks commented Apr 5, 2024

I wanted the completion window to be printed in the same order as the vim.fn.spellsuggest() function. like this.

  • input : 'overshot'
  • output of spellsuggest() :
  1. overshoot
  2. Overshot
  3. overshoe
  4. over shot
  5. overshoots

To see this, I changed the sorting order in config of nvim-cmp like

sorting = {
  priority_weight = 2.0,
  comparators = {
    compare.order,
  }
},

but the completion window said the input word first like

1. overshot
2. overshoot
3. Overshot
4. overshoe
5. over shot
6. overshoots

Why does the first one displayed?
my source setting is

-- /////// source of lua
cmp.setup.filetype({'lua'}, {
  sources = {
    {
      name = 'spell', 
      group_index = 1,
      option = {
        keep_all_entries = true, -- it can show more possible list
        enable_in_context = function () -- is_available() does not work, this option make spell completion work only 
          return context.in_treesitter_capture('comment') or context.in_syntax_group('Comment')
        end
      }
    },
  }
})
@f3fora f3fora closed this as completed in 694a4e5 May 7, 2024
@Jaehaks
Copy link
Author

Jaehaks commented May 7, 2024

@f3fora
It is weird that the order is same with suggestion of spellsuggest() when preselect_correct_word = false.
Anyway, It works for me! Thank you for your commit!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant