0

I tried to install company and lsp on running on Emacs v28.2 on 5.4.240-1-MANJARO for a handful of languages. Most of the stuff works fine, flycheck, linters,lsp-connection, the popup completion with added documentation. Then i reproduce the config on a other system, but the completion has no more graphic and information in the popup.

working popup and docs

also in other places the graphics are working properly

On other systems there is the popup more visual informative:

expected behaviour from official company site

On both Systems lsp-describe-session points out to ruff and jedi.

The installed related packages are quite similare and load via use-package :

  • all-the-icons-*
  • company
  • company-quickhelp
  • flycheck
  • lsp-jedi
  • lsp-mode
  • lsp-treemacs
  • lsp-ui

can't point out where the problem lays.

EDIT:

The code for downloading company via use-package

(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(add-to-list 'package-archives '("elpa" . "https://elpa.gnu.org/packages/"))
(package-initialize)

(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

(eval-and-compile
  (setq use-package-always-ensure t ; get rid of the :ensure t key
        use-package-expand-minimally t))

(use-package company
  :config
  (global-company-mode t)
  (setq company-idle-delay 0.1)
  (setq company-minimum-prefix-length 2)
  ; (setq company-tooltip-align-annotations t)
  (setq company-tooltip-offset-display 'lines)
  (setq company-tooltip-flip-when-above t)
  (define-key company-active-map (kbd "\C-n") 'company-select-next)
  (define-key company-active-map (kbd "\C-p") 'company-select-previous)
  (define-key company-active-map (kbd "\C-d") 'company-show-doc-buffer)
  (define-key company-active-map (kbd "M-.") 'company-show-location))

EDIT II:

Check list-package and see that company and company-quickhelp are still "available" but not "installed" when check it. But when i check the variable package-selected-packages it is in the list.

list-packages

EDIT III:

updated all the installed packages via list-package, still no progress

EDIT IV:

start with a blank emacs and install all with my init.el and config.org new, still no graphics from company.

EDIT V:

Managed to get correct pop-up completion at other ~prog-mode~ buffers then python i use. the only problem still is the python buffer, where there is no completion at all.

EDIT VI:

I tried to manually do M-x company-capf , and the pop-up-showed up correctly in python-mode. so i think there is an issue with the automatic pop-up. I think the problem lays in the function call in python-mode, which create the popup. Where can i fix this?

xdobx
  • 1
  • 3
  • BTW, there's no need to write `(add-to-list 'package-archives '("elpa" . "https://elpa.gnu.org/packages/"))`. That is equivalent to `"gnu"`. – shynur Apr 19 '23 at 14:05
  • @shynur don't know that, thanks for the hint! – xdobx Apr 19 '23 at 14:48
  • Maybe your Emacs on Manjaro was compiled without SVG support? – Dmitry Apr 20 '23 at 21:44
  • @Dmitry I can open via C-x C-f a generic .svg image, so I assume the support should be given. Also the graphics work in the code (like in image 2) and only don't in the company-pop-up. – xdobx Apr 21 '23 at 12:41
  • Regarding your second screenshot, are you sure it uses ruff and jedi? The picture shows completions for C or C++. Not Python. – Dmitry Apr 21 '23 at 20:46
  • 1
    All in all, you seem to have a bunch of competing packages installed. As a first step, try removing auto-complete, company-jedi, company-lsp, and either company-anaconda or lsp-mode. Anaconda and LSP are different completion systems. – Dmitry Apr 21 '23 at 23:41
  • @Dmitry Thanks for the suggestion. I removed auto-complete, company-jedi and company-lsp and company-anaconda. Unfortuneately there is no completion pop-up at all anymore in python mode. In other prog-modes there is still completion but still no graphics. – xdobx Apr 23 '23 at 14:23
  • Also the second screenshot is from the company-mode readme to show my goal for completion for any prog-mode. – xdobx Apr 23 '23 at 14:34
  • All right. Did you `M-x lsp` before trying completion? – Dmitry Apr 23 '23 at 15:11
  • @Dmitry yes, the lsp servers (ruff and jedi) are connected, but there is no pop-up for completion anymore. – xdobx Apr 25 '23 at 07:11
  • That's odd. At this point it's probably a good idea to use one of lsp-mode's support channels: either Discord, or Discussions/Issues. – Dmitry Apr 25 '23 at 17:52

1 Answers1

0

Seemed to be a conflict with tern-mode. Tern is a stand-alone code-analysis engine for JavaScript. And I used it with its company backend. So i used it with

(add-to-list 'load-path "~/.emacs.d/tern/emacs/")
(autoload 'tern-mode "tern.el" nil t)
(autoload 'company-tern "company-tern.el" nil t)
(add-to-list 'company-backends 'company-tern)
(add-hook 'prog-mode-hook (lambda () (tern-mode t)))

I realized that when i use M-x company-diag and see that the used backend in python-mode was also company-tern. So i just bind the mode to js2-mode and not to prog-mode-hook and have now correct completion in all languages i try.

xdobx
  • 1
  • 3