0

I'm using emacs 27 compiled from git sources and company for code completion.
I tried to set-up ac-php with company and php-mode, but when company tries tp perform auto-complete, I get the following error :

Company: An error occurred in auto-begin
Company: backend (company-ac-php-backend company-dabbrev-code) error "Wrong type argument: hash-table-p, nil" with args (candidates $this->)

Here is my conf for php-mode (the same as advised on ac-php Github):

(use-package php-mode
    :ensure t
    :init

    (require 'company-php)
    (add-to-list 'semantic-symref-filepattern-alist  '(php-mode "*.php" "*.tpl"))

    ;; Enable ElDoc support (optional)
    (ac-php-core-eldoc-setup)

    (set (make-local-variable 'company-backends)
      '((company-ac-php-backend company-dabbrev-code)
         company-capf company-files))

     ;; Jump to definition (optional)
     (define-key php-mode-map (kbd "M-]")
      'ac-php-find-symbol-at-point)

     ;; Return back (optional)
     (define-key php-mode-map (kbd "M-[")
      'ac-php-location-stack-back)
   )

What did I do wrong?

3
  • Unless someone has a quick and helpful answer, maybe set debug-on-error to t, to get a backtrace, and show that. Commented Nov 25, 2019 at 14:24
  • You should put your php setup to php-mode-hook using add-hook, as the README suggests, since the php backend in company-backends only makes sense inside a php file. Commented Nov 25, 2019 at 14:29
  • Thanks, it worked =) Commented Nov 25, 2019 at 14:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.