Giter Site home page Giter Site logo

lsp-ui feature wishlist about lsp-ui HOT 15 OPEN

emacs-lsp avatar emacs-lsp commented on August 23, 2024
lsp-ui feature wishlist

from lsp-ui.

Comments (15)

sebastiencs avatar sebastiencs commented on August 23, 2024 2

@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)

from lsp-ui.

TatriX avatar TatriX commented on August 23, 2024 2

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.

from lsp-ui.

sebastiencs avatar sebastiencs commented on August 23, 2024 2

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

from lsp-ui.

TatriX avatar TatriX commented on August 23, 2024 1

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

from lsp-ui.

topisani avatar topisani commented on August 23, 2024

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

from lsp-ui.

topisani avatar topisani commented on August 23, 2024

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

from lsp-ui.

jaelsasser avatar jaelsasser commented on August 23, 2024

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

from lsp-ui.

fuxialexander avatar fuxialexander commented on August 23, 2024

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))

from lsp-ui.

sebastiencs avatar sebastiencs commented on August 23, 2024

@fuxialexander Can you test the commit a723db1 ?

from lsp-ui.

fuxialexander avatar fuxialexander commented on August 23, 2024

@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)

from lsp-ui.

Dickby avatar Dickby commented on August 23, 2024

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.

from lsp-ui.

gagbo avatar gagbo commented on August 23, 2024

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

from lsp-ui.

yyoncho avatar yyoncho commented on August 23, 2024

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

from lsp-ui.

gagbo avatar gagbo commented on August 23, 2024

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

from lsp-ui.

ilyaguy avatar ilyaguy commented on August 23, 2024

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.

from lsp-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.