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

Completion does not filter (and is very slow) #52

Closed
tam5 opened this issue Aug 27, 2018 · 6 comments
Closed

Completion does not filter (and is very slow) #52

tam5 opened this issue Aug 27, 2018 · 6 comments

Comments

@tam5
Copy link

tam5 commented Aug 27, 2018

Completions do not filter down based on what I type. (for php at least)

It would also seem that they are extremely slow, which I only mention here in case it might be the same issue.

Here is what I am talking about:

lag

My config:

(use-package company
  :ensure t
  :config
  (setq company-dabbrev-downcase nil)
  (setq company-idle-delay 0)
  (setq company-minimum-prefix-length 1)
  (setq company-tooltip-align-annotations t)
  (add-to-list 'company-backends '(company-capf company-dabbrev))
  (add-hook 'after-init-hook 'global-company-mode))

(use-package lsp-mode
  :ensure t
  :config
  (setq lsp-response-timeout 25))

(use-package lsp-ui
  :ensure t
  :after lsp-mode
  :config
  (add-hook 'lsp-mode-hook 'lsp-ui-mode))

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

(use-package php-mode :ensure t)

(use-package lsp-php
  :after (php-mode lsp-mode)
  :ensure t
  :config
  (setq lsp-php-server-install-dir "~/.emacs.d/packages/lsp")
  (add-hook 'php-mode-hook #'lsp-php-enable))

Is there something I am missing?

@tigersoldier
Copy link
Owner

When trying to complete, can you run M-x company-diag <RET> and paste the result here?

In the config, I suggest:

  • Don't use company-capf unless you need it for other languages.
  • Make sure company-lsp-async is t (should be the default value).
  • Try different values of company-lsp-cache-candidates. Possible values are t, 'auto, and nil

@tam5
Copy link
Author

tam5 commented Aug 31, 2018

@tigersoldier thanks for your response.

By switching company-lsp-cache-candidates from auto to t, i was able to get the filter to work properly almost all of the time, and this works great.

The only issue I have now, is that it seems to take a very long time (3+ seconds) for the completion results to appear. I am fairly certain the php language server itself is not causing the slowness, so is there another setting i might try to achieve better performance?

Here is a paste of company-diag:


Emacs 26.1 (x86_64-apple-darwin17.5.0) of 2018-07-13 on Aris-MBP.nyc.rr.com
Company 0.9.6

company-backends: (company-lsp
 (company-capf company-dabbrev))

Used backend: company-lsp
Major mode: php-mode
Prefix: ("" . t)

Completions: none(error fetching)

There is a message saying error fetching, and the list of completions here is empty. However, the list was populated before i hit M-x. Maybe that is important.

@tigersoldier
Copy link
Owner

I'm not sure what causes the long latency if it's not from php language server. You can try:

  • Updating company-mode and company-lsp to the latest version. The asynchronous performance of company-mode was improved a couple months ago. Also some filtering bug in company-lsp was fixed a while ago.
  • Try enabling synchronous completion if you believe php language server is fast enough. You can do it by setting company-lsp-async to t.
  • Setting company-idle-delay to 0.1 (I don't think this will help though)

@vv111y
Copy link

vv111y commented Sep 6, 2018

I am having similar issue (delay) with python, see #54.

@tam5, how did you rule out the language server?

@tam5
Copy link
Author

tam5 commented Oct 21, 2018

Hi @vv111y, I know it is not the language server itself, because I can use the same language server with a different frontend and it works fine. For example, if you use VSCode, you can use the same language server, and even open up dev tools and see how quickly it does respond.

So, the issue must lie somewhere in translation from the language server and emacs, but I have not yet figured out where that is. I will look into it further and post my findings here.

@tam5
Copy link
Author

tam5 commented Oct 23, 2018

Upon further investigation, it is php-language-server itself that is too slow (2+ seconds for completion requets). I think VsCode might hide this by including other results in the completions.

There is already an issue on the php langauge server side to address this, so I guess that is where further discussion should go.

@tam5 tam5 closed this as completed Oct 23, 2018
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

3 participants