3

I'm using centaur tabs, and when lsp-headerline enables my tabs hides. I want to disable that headerline using lsp-headerline-bradcrumb-mode in a hook

(use-package lsp-mode
  :commands (lsp lsp-deferred)
  :init
  (setq lsp-keymap-prefix "C-c l")
  :config
  (lsp-enable-which-key-integration t)
  :hook
  (lsp-mode . lsp-headerline-breadcrumb-mode)
)

Something like this. But it does not work. also I tryed to set lsp-headerline-breadcrumb-enable to nil in the config of my plugin, but it gives me an error lsp-headerline-breadcrumb-enable is not defined

EDIT: Other possible fix to this issue is find a way to keep visible and functional my tabs if it not possible to hide the bradcrumb.

Note: In the breadcrumb after the file name it says *invalid* enter image description here

  • 1
    Setting `(setq lsp-headerline-breadcrumb-enable nil)` after `lsp-mode` has been loaded should work. Please check whether your installation is correct. – Swarnendu Biswas May 23 '21 at 16:48
  • As Lorem Ipsum says it looks like a bug, mi installation is right, is a fresh install – Paolo Donato Navarro May 24 '21 at 17:20
  • It's a shame that an answer was given to this *duplicate question*, and no answers were provided to the question this one duplicates. Unfortunately, duplicate-closing is limited to questions with no upvoted answers etc. Things would be much better if both those posing questions and those answering them checked first for an existing duplicate. In this case, the question title is almost exactly the same: https://emacs.stackexchange.com/q/63000/105 (*"How to remove LSP ?"*). Searching for tag `[header-line]` showed it immediately. – Drew Jan 14 '23 at 21:31

3 Answers3

1

There appears to be a bug in lsp-mode which causes lsp-headerline-breadcrumb-enable to not work as expected.

I believe the following workaround should result in the desired behavior (no breadcrumb):

(add-hook 'lsp-mode-hook #'lsp-headerline-breadcrumb-mode)

This will call lsp-headerline-breadcrumb-mode each time lsp mode is enabled. Because of the breadcrumb bug, I believe breadcrumbs are enabled by default (regardless of lsp-headerline-breadcrumbe-enable's value). Calling breadcrumb mode should therefore disable breadcrumbs. There are many other lsp hooks to use if this one isn't ideal.

Lorem Ipsum
  • 4,327
  • 2
  • 14
  • 35
  • It look like it is working when I first open a file, but, after the LSP server is loaded the bradcrumb is enabled again, how can I hook the ``lsp-headerline-breadcrumb-enable`` to that event? – Paolo Donato Navarro May 24 '21 at 17:24
  • I'm experiencing similar behavior. There are several other hooks that lsp provides. I'm not sure which one is the one we need. Check `C-h v lsp--hook TAB` to see a listing of all the available hooks. I'll have to experiment more later. – Lorem Ipsum May 24 '21 at 17:29
  • 1
    I checked ``lsp-after-initialize-hook`` and it is what I need, I tested it opening treemacs after the language server loads, but for some reason ``lsp-headerline-bradcrumb-mode`` does nothing. Other possible fix to my problem is show the breadcrumb and my tabs. – Paolo Donato Navarro May 24 '21 at 17:45
1

I removed lsp-mode package and reinstaled, after that I can use (setq lsp-headerline-breadcrumb-enable nil) and everything works fine now, thanks to Lorem Ipsum for the help.

(use-package lsp-mode
  :commands (lsp lsp-deferred)
  :init
  (setq lsp-keymap-prefix "C-c l")
  :config
  (setq lsp-headerline-breadcrumb-enable nil)
  (lsp-enable-which-key-integration t)
  ;;(lsp-mode . pao/lsp-mode-setup))
)

  • 1
    Absolutely! Looks like you got some help from the main source (https://github.com/emacs-lsp/lsp-mode/issues/2525). Thanks for your efforts! – Lorem Ipsum Jun 11 '21 at 18:11
0

This seemed to work for me. I don't use use-package and the other lsp-mode-hook answer wasn't working.

(add-hook 'lsp-mode-hook
  (lambda()
    ;;; other stuff...
    (setq lsp-headerline-breadcrumb-enable nil)))
Chris
  • 143
  • 5