emacs-lsp / lsp-ui

UI integrations for lsp-mode
https://emacs-lsp.github.io/lsp-ui
GNU General Public License v3.0
1.04k stars 139 forks source link

lsp-ui-doc fails when cursor is at the top of window #519

Closed brotzeit closed 3 years ago

brotzeit commented 3 years ago

I could only reproduce this when the cursor was at a "}" sign which was at the top of the window. Maybe we should just use ignore-errors for this corner case since otherwise it works well, apparently.

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  lsp-ui-doc--mv-at-point(209 40 8 0)
  lsp-ui-doc--move-frame(#<frame  0x5558454c6068>)
  lsp-ui-doc--display(nil #("Receiver<Instant>" 0 17 (markdown-gfm-code (9 27) face (markdown-code-face) font-lock-multiline t)))
  lsp-ui-doc--callback(#<hash-table equal 2/2 0x15561263dbfd> (7919 . 7920) #<buffer channel.rs>)
  #f(compiled-function (hover) #<bytecode 0x56e4df09f44dc21>)(#<hash-table equal 2/2 0x15561263dbfd>)
  apply(#f(compiled-function (hover) #<bytecode 0x56e4df09f44dc21>) #<hash-table equal 2/2 0x15561263dbfd>)
  #f(compiled-function (&rest args) #<bytecode 0x25153383d487328>)(#<hash-table equal 2/2 0x15561263dbfd>)
  #f(compiled-function (result) #<bytecode 0x1294c140f0299451>)(#<hash-table equal 2/2 0x15561263dbfd>)
  #f(compiled-function (result) #<bytecode -0x73e6940c5cbe891>)(#<hash-table equal 2/2 0x15561263dbfd>)
  lsp--parser-on-message(#<hash-table equal 3/3 0x15561256a5a7> #s(lsp--workspace :ewoc nil :server-capabilities #<hash-table equal 21/21 0x1556130981f5> :registered-server-capabilities (#s(lsp--registered-capability :id "workspace/didChangeWatchedFiles" :method "workspace/didChangeWatchedFiles" :options #<hash-table equal 1/1 0x1556123db209>) #s(lsp--registered-capability :id "textDocument/didSave" :method "textDocument/didSave" :options #<hash-table equal 2/2 0x155611563bef>)) :root "/home/fredbert/.cargo/registry/src/github.com-1ecc..." :client #s(lsp--client :language-id nil :add-on? nil :new-connection (:connect #f(compiled-function (filter sentinel name environment-fn) #<bytecode 0xbbabca2dae521b0>) :test\? #f(compiled-function () #<bytecode 0x1c66a3ffbe390ac4>)) :ignore-regexps nil :ignore-messages nil :notification-handlers #<hash-table equal 1/65 0x155611452595> :request-handlers #<hash-table equal 0/65 0x1556120633d5> :response-handlers #<hash-table eql 38/65 0x15561215cacf> :prefix-function nil :uri-handlers #<hash-table equal 0/65 0x15561219e5f1> :action-handlers #<hash-table equal 0/65 0x155612407b2d> :major-modes (rust-mode rustic-mode) :activation-fn nil :priority 1 :server-id rust-analyzer :multi-root nil :initialization-options lsp-rust-analyzer--make-init-options :custom-capabilities ((experimental (snippetTextEdit . t))) :library-folders-fn #f(compiled-function (workspace) #<bytecode 0x622359b74abb1f6>) :before-file-open-fn nil :initialized-fn nil :remote? nil :completion-in-comments? nil :path->uri-fn nil :uri->path-fn nil :environment-fn nil :after-open-fn #f(compiled-function () #<bytecode 0x1e11aafc65cd>) :async-request-handlers #<hash-table equal 0/65 0x1556122fae97> :download-server-fn #f(compiled-function (client callback error-callback update\?) #<bytecode 0x19495094f2977ab3>) :download-in-progress? nil :buffers nil) :host-root nil :proc #<process rust-analyzer<6>> :cmd-proc #<process rust-analyzer<6>> :buffers (#<buffer channel.rs>) :semantic-highlighting-faces nil :semantic-highlighting-modifier-faces nil :extra-client-capabilities nil :status initialized :metadata #<hash-table equal 0/65 0x1556123b61cd> :watches #<hash-table equal 0/65 0x15561143b4f5> :workspace-folders nil :last-id 0 :status-string nil :shutdown-action nil :diagnostics #<hash-table equal 2/65 0x155611411305> :work-done-tokens #<hash-table equal 0/65 0x15561146d903>))
  #f(compiled-function (proc input) #<bytecode 0x1bab16417e70144b>)(#<process rust-analyzer<6>> "Content-Length: 190\15\n\15\n{\"jsonrpc\":\"2.0\",\"id\":3321,...")
brotzeit commented 3 years ago

Now I've seen this issue also in different situations but it seems to be bound positions at the top of a window.

brotzeit commented 3 years ago

Ok it also happens at comments that are not at the top of the window. We need to fix this.

brotzeit commented 3 years ago

Seems to only happen when lsp-ui-doc-position is set to 'at-point.