Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lsp-ui feature wishlist #1

Open
vibhavp opened this issue Nov 28, 2017 · 15 comments
Open

lsp-ui feature wishlist #1

vibhavp opened this issue Nov 28, 2017 · 15 comments

Comments

@vibhavp
Copy link
Member

vibhavp commented Nov 28, 2017

No description provided.

@topisani
Copy link
Collaborator

The origin issue:
emacs-lsp/lsp-mode#194
A lot of the features were mentioned there

@topisani
Copy link
Collaborator

https://github.com/cpitclaudel/quick-peek
That might be great for some features. Its not really useful for xref stuff, but for smaller peeks, like C macro expansions etc this would be great

@jaelsasser
Copy link

@topisani eventually I’ll get around to integrating cquery with macrostep. Implementation might end up being generic enough to shift it into here.

@TatriX
Copy link

TatriX commented Jan 5, 2018

Allow showing sideline on demand.
It's a cool feature, but can be really noisy. It could be awesome if I could show it for a current line with hotkey.
2018-01-05-204413_941x138_scrot

@sebastiencs
Copy link
Member

@TatriX I have added the function lsp-ui-sideline-toggle-symbols-info

You can do:

;; (require 'lsp-ui)
(define-key lsp-ui-mode-map [f10] 'lsp-ui-sideline-toggle-symbols-info)

@TatriX
Copy link

TatriX commented Jan 5, 2018

Cool, thank you!

Another 2 features I was thinking about: allow customization of the sideline bg color (not sure if it's possible though) and customize delay before showing the sideline. It's the same as with completion: if I know what I'm doing I just type my code and don't see the completion. But if I'm stuck, I can wait half a second and see a completion or sideline.

Of course I'm not sure it will be actually useful.

@sebastiencs
Copy link
Member

@TatriX There is now the face lsp-ui-sideline-global and the variable lsp-ui-sideline-delay

@fuxialexander
Copy link

fuxialexander commented Jan 13, 2018

Similar to vscode, I think we should be able to show lsp-ui-doc at the point
image

(defun lsp-ui-doc--move-frame (frame)
    "Place our FRAME on screen."
    (lsp-ui-doc--resize-buffer)
    (-let* (((_left top right _bottom) (window-edges nil nil nil t))
            (window (frame-root-window frame))
            ((width . height) (window-text-pixel-size window nil nil 10000 10000))
            (width (+ width (* (frame-char-width frame) 2))) ;; margins
            (frame-resize-pixelwise t)
            (x-and-y (company-childframe-compute-pixel-position
                      (- (point) 1)
                      (frame-pixel-width frame)
                      (frame-pixel-height frame))))
      (set-window-margins window 1 1)
      (set-frame-size frame width (min 300 height) t)
      (set-frame-position frame (car x-and-y) (+ (cdr x-and-y) 1))))

(defun company-childframe-compute-pixel-position (pos tooltip-width tooltip-height)
  "Return bottom-left-corner pixel position of POS in WINDOW.
its returned value is like (X . Y)

If TOOLTIP-WIDTH and TOOLTIP-HEIGHT are given, this function will use
two values to adjust its output position, make sure the *tooltip* at
position not disappear by sticking out of the display."
  (let* ((window (selected-window))
         (frame (window-frame window))
         (xmax (frame-pixel-width frame))
         (ymax (frame-pixel-height frame))
         (header-line-height (window-header-line-height window))
         (posn-top-left (posn-at-point pos window))
         (x (+ (car (window-inside-pixel-edges window))
               (or (car (posn-x-y posn-top-left)) 0)))
         (y-top (+ (cadr (window-pixel-edges window))
                   header-line-height
                   (or (cdr (posn-x-y posn-top-left)) 0)))
         (font-height
          (if (= pos 1)
              (default-line-height)
            (aref (font-info
                   (font-at
                    (if (and (= pos (point-max))) (- pos 1) pos)))
                  3)))
         (y-buttom (+ y-top font-height)))
    (cons (max 0 (min x (- xmax (or tooltip-width 0))))
          (max 0 (if (> (+ y-buttom (or tooltip-height 0)) ymax)
                     (- y-top (or tooltip-height 0))
                   y-buttom)))))

The company-childframe function is from https://github.com/tumashu/company-childframe/blob/master/company-childframe.el

Also the recently added line make the doc non-scrollable

(redirect-frame-focus frame (frame-parent frame))

sebastiencs added a commit that referenced this issue Jan 13, 2018
With a new choice with lsp-ui-doc-position: at-point
@sebastiencs
Copy link
Member

@fuxialexander Can you test the commit a723db1 ?

@fuxialexander
Copy link

@sebastiencs Thanks for the effort. The positioning works, but the content is not scrollable. (caused by (redirect-frame-focus frame (frame-parent frame)))

Also since sometimes the doc is quite long, I think when display at-point or even Top/Bottom, wee should be able to specify the maximum height of the doc.

(set-frame-size frame width (min lsp-ui-doc-max-height height) t)

@Dickby
Copy link

Dickby commented Mar 26, 2018

It would be nice to have the function lsp-ui-peek-dwim that uses lsp-ui-peek-find-references if point is on a definition and lsp-ui-peek-find-definitions otherwise.

@gagbo
Copy link

gagbo commented Dec 6, 2018

Has there been any advancement on a way to quickly toggle / resize the lsp-ui-doc frame ? It is really not practical to use for Rust, where the doc is very very long :

screenshot_rust_doc

In this screenshot, the cursor is actually below the frame, so I'd need a quick shortcut to toggle the ui-doc frame if possible

@yyoncho
Copy link
Member

yyoncho commented Dec 6, 2018

@gagbo did you try lsp-ui-doc-max-width?

@gagbo
Copy link

gagbo commented Dec 7, 2018

I did not. Am I supposed to change this value each time there's a WM event related to emacs window then ?

@ilyaguy
Copy link

ilyaguy commented Feb 26, 2020

Show function name in code snippet in lsp-ui-peek mode if function name is above top line of code snippet.
e.g. I have referenced line 143, and function starts at line 125.
Referenced line shows in the middle of ui-peek window, that's fine.
But function name goes much above top of the window.
And it would be nice to have function definition under the top margin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants