The Wayback Machine - https://web.archive.org/web/20231203080914/https://github.com/emacs-lsp/lsp-mode/issues/1702
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

company-minimum-prefix-length isn't taken into account when backspacing #1702

Open
haoyuan80s opened this issue May 19, 2020 · 13 comments · Fixed by #1703
Open

company-minimum-prefix-length isn't taken into account when backspacing #1702

haoyuan80s opened this issue May 19, 2020 · 13 comments · Fixed by #1703

Comments

@haoyuan80s
Copy link

I have (setq company-minimum-prefix-length 1). The company starts after I type one letter, but keep triggering after I delete the letter (it is slow to complete with zero length prefix). Any fix for that?


After typing one letter:
image
After deleting that letter:
image

@haoyuan80s
Copy link
Author

Company without lsp-mode works well.

@haoyuan80s
Copy link
Author

(use-package company-lsp
  :ensure t)
(push 'company-lsp company-backends)

Adding company-lsp fixed the issue but it is no longer supported. Any fix without using company-lsp?

@suzuki11109
Copy link

Seems to happen when I use csharp lsp-mode.
I have (setq company-minimum-prefix-length 2) but it triggers after one character and keep triggering after delete.

Screen Shot 2564-07-14 at 22 13 07

Screen Shot 2564-07-14 at 22 13 13

@kiennq
Copy link
Member

kiennq commented Jul 15, 2021

What's your lsp-mode version? Can you take io trace when this happens?

@yyoncho
Copy link
Member

yyoncho commented Jul 15, 2021

@kiennq FYI it reproduces with lsp-start-plain.el

@kiennq
Copy link
Member

kiennq commented Jul 15, 2021

Does it only happen with csharp language server?

@yyoncho
Copy link
Member

yyoncho commented Jul 15, 2021

@kiennq FYI it reproduces with lsp-start-plain.el

disregard that, I though that I am in another issue.

@suzuki11109
Copy link

@kiennq So far I see this problem only in csharp.
I tried again with lsp-start-plain.el and the behaviour is kind of improved. I think this happen when company-yasnippets is enabled.
After I disable yasnippets, the candidates are more relevant but company-minimum-prefix-length is still not working (company triggered after typing 1 character even though company-minimum-prefix-length is 2).

@kiennq
Copy link
Member

kiennq commented Jul 16, 2021

I found out the problem, csharp language server is sending space as trigger character, that's why the automatic completion is triggered even if you type with 1 character (you or Emacs must have insert spaces before the current symbol).
Since space as trigger character is too invasive, I think we can help a new custom setting/defvar to specify the character that will be omitted from the trigger characters list.
@yyoncho WDYT?

@kiennq kiennq reopened this Jul 16, 2021
@dsdshcym
Copy link

Same with https://github.com/merrickluo/lsp-tailwindcss/
Since tailwindcss language server is using space as trigger char as well, it would trigger completion even with 1 space
and with tons of tailwind css classes to complete, the typing becomes extremely slow

@kiennq
Copy link
Member

kiennq commented Sep 13, 2021

Some thing like this might help

(advice-add #'lsp-completion--looking-back-trigger-characterp
            :filter-args
            (lambda (r) (seq-remove (lambda (it) (equal it " ")) r))
            '((name . --filter-spaces)))

@dmvianna
Copy link

I see that happening in both Scala and Haskell and the workaround does not help.

@sunilw
Copy link

sunilw commented Sep 23, 2023

I think I'm hitting the same behaviour with company and lsp:

Despite 'company-minimum-prefix-length' set to '3', completion happens even with 0 characters.

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

Successfully merging a pull request may close this issue.

7 participants