lsp-ui
lsp-ui copied to clipboard
Display peek in child frame
I patch lsp-mode to diplay the peek ui in a childframe:
(defun lsp-ui-peek--peek-display (src1 src2)
(-let* ((win-width (frame-width))
(lsp-ui-peek-list-width (/ (frame-width) 2))
(string (-some--> (-zip-fill "" src1 src2)
(--map (lsp-ui-peek--adjust win-width it) it)
(-map-indexed 'lsp-ui-peek--make-line it)
(-concat it (lsp-ui-peek--make-footer))))
)
(setq lsp-ui-peek--buffer (get-buffer-create " *lsp-peek--buffer*"))
(posframe-show lsp-ui-peek--buffer
:string (mapconcat 'identity string "")
:min-width (frame-width)
:poshandler #'posframe-poshandler-frame-center)))
(defun lsp-ui-peek--peek-destroy ()
(when (bufferp lsp-ui-peek--buffer)
(posframe-delete lsp-ui-peek--buffer))
(setq lsp-ui-peek--buffer nil
lsp-ui-peek--last-xref nil)
(set-window-start (get-buffer-window) lsp-ui-peek--win-start))
(advice-add #'lsp-ui-peek--peek-new :override #'lsp-ui-peek--peek-display)
(advice-add #'lsp-ui-peek--peek-hide :override #'lsp-ui-peek--peek-destroy)
I think the big plus point here is, that the UI can occupy the full frame, instead of just the current window.
If I find the time, I'll make a patch out of it.
I almost never use single window in emacs, so this is what i need. But it does not work :( Are you still using this with current version of lsp-ui? @akermu
@KaratasFurkan , this works for me, do you have de postframe package installed?
@marcelino-m it turns out one of the packages in my config blocks this. I configured it and they both works without conflict now, thanks.
Hi @akermu , I noted that de footer is not displayed and I don't know how to solve this.
Just wanted to say, thanks for this! @akermu
Hi y'all, it doesn't seem to be working for me.
(use-package lsp-ui
:commands lsp-ui-mode
:requires posframe
:config
(defun lsp-ui-peek--peek-display (src1 src2)
(-let* ((win-width (frame-width))
(lsp-ui-peek-list-width (/ (frame-width) 2))
(string (-some--> (-zip-fill "" src1 src2)
(--map (lsp-ui-peek--adjust win-width it) it)
(-map-indexed 'lsp-ui-peek--make-line it)
(-concat it (lsp-ui-peek--make-footer)))))
(setq lsp-ui-peek--buffer (get-buffer-create " *lsp-peek--buffer*"))
(posframe-show lsp-ui-peek--buffer
:string (mapconcat 'identity string "")
:min-width (frame-width)
:poshandler #'posframe-poshandler-frame-center)))
(defun lsp-ui-peek--peek-destroy ()
(when (bufferp lsp-ui-peek--buffer)
(posframe-delete lsp-ui-peek--buffer))
(setq lsp-ui-peek--buffer nil
lsp-ui-peek--last-xref nil)
(set-window-start (get-buffer-window) lsp-ui-peek--win-start))
(advice-add #'lsp-ui-peek--peek-new :override #'lsp-ui-peek--peek-display)
(advice-add #'lsp-ui-peek--peek-hide :override #'lsp-ui-peek--peek-destroy))
Still results in peek being displayed in another buffer. I may be using use-package
incorrectly.
it partially works for me, it shows correctly the buffer, but I can't change/edit/use/quit, any thoughts @akermu ?