Skip to content

lsp-eldoc-enable-hover hides flymake errors #631

Open
@stevemolitor

Description

@stevemolitor

Thank you for the bug report

  • I am using the latest version of lsp-mode related packages.
  • I checked FAQ and Troubleshooting sections
  • You may also try reproduce the issue using clean environment using the following command
emacs -q -l lsp-start-plain.el

where lsp-start-plain.el can be downloaded here.
Alternatively, it will be great if you can reproduce the issue using lsp-docker which provides the minimal configurations for lsp-mode and ships with most of the language servers.

Bug description

I am using lsp with the default emacs flymake, using emacs 28.

With lsp-eldoc-enable-hover turned on, I can't see flymake errors in the echo area. The error at point message flashes by briefly, but then is overridden by the symbol info. When there is an error I would rather see that than the symbol info. Showing both would be fine too.

I prefer seeing both symbol and error info in the echo area, not in lsp-ui overlays as I find that distracting.

Steps to reproduce

(use-package lsp-mode
   :custom (lsp-eldoc-enable-hover t))

Make sure you do not have company-mode installed. In say typescript, type this in an lsp buffer:

const x: string = 'hi';

You should see a red squigly under the x. Put your cursor on the 'x'.

I want to see the error message:

'x' is declared but its value is never read.

But I see the symbol type:

const x: string

Showing both would be great too, but I need to at least see the error, when there is an error, and see the symbol info when no error.

Here's a pic of what I see:

Expected behavior

I want to see the error message:

'x' is declared but its value is never read.

For example, here's what I see with lsp-eldoc-enable-hover off - I'd like to see this with it on, when there is an error at point:

Or, showing the symbol and the error message would work fine too:

'x' is declared but its value is never read.
const x: string

But it's important to at least show the error at point if there is one.

Which Language Server did you use?

ts-ls

OS

MacOS

Error callstack

No response

Anything else?

I tried setting eldoc-documentation-strategy to eldoc-documentation-compose but that didn't work.

I also tried messing with eldoc-documentation-functions in elisp, adding both the flymake and the lsp doc functions to the list, but it seems they take different number of args (one for flymake-eldoc-function, none for lsp-eldoc-function), and eldoc wanted the documentation function to take one arg.

Similarly I tried addings flymake-eldoc-function to lsp-eldoc-hook but same problem in reverse - lsp-mode didn't like that flymake-eldoc-function took one arg. I got a little lost there TBH - it seems flymake and lsp-mode are setting up eldoc in different (incompatible?) ways.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions