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

Filtering textDocument/hover results #147

Closed
JulienPalard opened this issue Jun 8, 2021 · 3 comments · Fixed by #149
Closed

Filtering textDocument/hover results #147

JulienPalard opened this issue Jun 8, 2021 · 3 comments · Fixed by #149

Comments

@JulienPalard
Copy link

Sometimes I find the hover result usefull (on identifiers, for example), sometimes not, and depending on the zoom level it can become a burden. I often use a big font when I teach, for readability, so I often enconter those hovers:

2021-06-08-113126_1920x1080_scrot

I think it would be nice to be able to configure the verbosity here, and say "OK now I know about classes, don't show this huge tooltip again".

@pappasam
Copy link
Owner

pappasam commented Jun 8, 2021

@JulienPalard hmm, it should be possible to support this. That said, we should discuss the design before I implement.

Probably the simplest way I can think to support this would be to force the hover LSP method to return None for certain Jedi name types. These types are:

    Valid values for type are ``module``, ``class``, ``instance``, ``function``,
    ``param``, ``path``, ``keyword``, ``property`` and ``statement``.

The user could pass, as an InitializationOption, a mapping of name types and values that they might want to return no responses for hover.

For example, one example user configuration could look like this:

{
  "initializationOptions": {
    "hover": {
      "ignoreType": {
        "keyword": ["class"],
        "statement": true
      }
    }
  }
}

In this, all "statements" are ignored, and Python keywords with the name "class" are ignored.

How does this design sound to you?

@JulienPalard
Copy link
Author

How does this design sound to you?

I still never tried to pass initializationOptions, hope it's not too hard using emacs' lsp-mode :D

Looks good to me.

@pappasam
Copy link
Owner

pappasam commented Jun 11, 2021

@JulienPalard for reference, see: https://github.com/pappasam/coc-jedi#jedihoverdisable

Since you're not using Neovim, your initializationOption will look something like this (not sure how you'd configure that off the top of my head, but hopefully the emacs community has you covered!):

{
  "initializationOptions": {
    "hover": {
      "disable": {
        "keyword": {
          "names": ["class"]
        }
      }
    }
  }
}

Alternatively, if you want to disable all keyword hovers:

{
  "initializationOptions": {
    "hover": {
      "disable": {
        "keyword": {
          "all": true
        }
      }
    }
  }
}

Please let me know if you have any questions, and hope you enjoy the new feature!

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

Successfully merging a pull request may close this issue.

2 participants