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?

  • Unless someone has a quick and helpful answer, maybe set debug-on-error to t, to get a backtrace, and show that. – Drew Nov 25 '19 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. – xuchunyang Nov 25 '19 at 14:29
  • Thanks, it worked =) – boehm_s Nov 25 '19 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.