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

Code Signature tooltip obscures code and completions #1098

Open
minrk opened this issue Sep 16, 2024 · 5 comments
Open

Code Signature tooltip obscures code and completions #1098

minrk opened this issue Sep 16, 2024 · 5 comments

Comments

@minrk
Copy link

minrk commented Sep 16, 2024

Description

when opening parentheses triggers the signature, the default behavior of lsp appears to be to show an extra tooltip (in addition to default completer), which obscures the code being typed and the completions.

As a result, I have to be constantly hitting escape, every time I open parentheses or type any number of other completion or inspection-triggering keys.

It's unclear to me if this is an lsp problem or a jupyterlab problem, but both of these behaviors seem incorrect:

  • there shouldn't be two tooltips at once
  • tooltips shouldn't ever obscure the cursor

Reproduce

  1. open notebook
  2. type
    import requests
    requests.get(
    
  3. see cursor and completer hidden behind inspection tooltip:
Screen.Recording.2024-09-16.at.13.03.17.mov

Expected behavior

  • Tooltips don't obscure code
  • No more than one tooltip at a time

Context

  • Operating System and version: browser: macOS 14.6.1, server: ubuntu 22.04
  • Browser and version: Safari 17.6
  • JupyterLab version: 4.2.4
  • Language server and version: jupyter-lsp 2.2.5, jupyterlab-lsp 5.1.0
Required: installed server extensions
Config dir: /home/jovyan/.jupyter

Config dir: /srv/conda/envs/notebook/etc/jupyter
dask_labextension enabled
- Validating dask_labextension...
Extension package dask_labextension took 0.2798s to import
A _jupyter_server_extension_points function was not found in dask_labextension. Instead, a _jupyter_server_extension_paths function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
dask_labextension 7.0.0 OK
jupyter_lsp enabled
- Validating jupyter_lsp...
jupyter_lsp 2.2.5 OK
jupyter_server_proxy enabled
- Validating jupyter_server_proxy...
jupyter_server_proxy 4.3.0 OK
jupyter_keepalive enabled
- Validating jupyter_keepalive...
jupyter_keepalive 0.3.0 OK
jupyter_resource_usage enabled
- Validating jupyter_resource_usage...
jupyter_resource_usage 1.1.0 OK
jupyter_server_mathjax enabled
- Validating jupyter_server_mathjax...
jupyter_server_mathjax OK
jupyter_server_terminals enabled
- Validating jupyter_server_terminals...
jupyter_server_terminals 0.5.3 OK
jupyter_server_xarray_leaflet enabled
- Validating jupyter_server_xarray_leaflet...
A _jupyter_server_extension_points function was not found in jupyter_server_xarray_leaflet. Instead, a _jupyter_server_extension_paths function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
jupyter_server_xarray_leaflet 0.2.3 OK
jupyterlab enabled
- Validating jupyterlab...
jupyterlab 4.2.4 OK
jupyterlab_code_formatter enabled
- Validating jupyterlab_code_formatter...
jupyterlab_code_formatter 3.0.2 OK
jupyterlab_git enabled
- Validating jupyterlab_git...
jupyterlab_git 0.50.1 OK
jupyterlab_myst enabled
- Validating jupyterlab_myst...
jupyterlab_myst 2.4.2 OK
nbdime enabled
- Validating nbdime...
nbdime 4.0.1 OK
nbgitpuller enabled
- Validating nbgitpuller...
nbgitpuller 1.2.1 OK
notebook enabled
- Validating notebook...
notebook 7.2.1 OK
notebook_shim enabled
- Validating notebook_shim...
notebook_shim OK
panel.io.jupyter_server_extension enabled
- Validating panel.io.jupyter_server_extension...
Extension package panel.io.jupyter_server_extension took 0.8595s to import
panel.io.jupyter_server_extension OK

Config dir: /usr/local/etc/jupyter

Required: installed lab extensions
JupyterLab v4.2.4
/srv/conda/envs/notebook/share/jupyter/labextensions
        jupyter-matplotlib v0.11.4 enabled OK
        anywidget v0.9.13 enabled OK
        ipytree v0.2.2 enabled OK
        jupyterlab_pygments v0.3.0 enabled OK (python, jupyterlab_pygments)
        jupyterlab_code_formatter v3.0.2 enabled OK (python, jupyterlab_code_formatter)
        jupyter-leaflet v0.19.2 enabled OK
        ipyurl v0.1.2 enabled  X (python, ipyurl)
        jupyterlab-myst v2.4.2 enabled OK (python, jupyterlab_myst)
        nbdime-jupyterlab v3.0.1 enabled OK
        dask-labextension v7.0.0 enabled OK (python, dask_labextension)
        ipyspin v1.0.0 enabled OK
        @jupyterlab/git v0.50.1 enabled OK (python, jupyterlab-git)
        @jupyter-lsp/jupyterlab-lsp v5.1.0 enabled OK (python, jupyterlab-lsp)
        @jupyter-widgets/jupyterlab-manager v5.0.11 enabled OK (python, jupyterlab_widgets)
        @pyviz/jupyterlab_pyviz v3.0.3 enabled OK
        @jupyter-server/resource-usage v1.1.0 enabled OK (python, jupyter-resource-usage)
        @jupyter-notebook/lab-extension v7.2.1 enabled OK
        @jupyterhub/jupyter-server-proxy v4.3.0 enabled OK
        @minrk/jupyter-keepalive v0.3.0 enabled OK

/home/jovyan/.local/share/jupyter/labextensions
jupyter-fs v0.4.1 enabled OK (python, jupyter-fs)

The following extensions may be outdated or specify dependencies that are incompatible with the current version of jupyterlab:
ipyurl

If you are a user, check if an update is available for these packages.
If you are a developer, re-run with --verbose flag for more details.

Disabled extensions:
@jupyterlab/apputils-extension:announcements
@jupyterlab/completer-extension:base-service
@jupyterlab/fileeditor-extension:language-server
@jupyterlab/notebook-extension:language-server

@krassowski
Copy link
Member

there shouldn't be two tooltips at once

I think this should be configurable; I get why this can be annoying. Some other popular editors show even more tooltips as you type.

tooltips shouldn't ever obscure the cursor

agreed! I think this is a regression due to a change in positioning of the tooltip. I guess this happens when at the top of the notebook, but not when you have more space overheads, right?

@krassowski
Copy link
Member

The relevant plugin is called "signature", as a quick fix you can disable it in the settings.

@minrk
Copy link
Author

minrk commented Sep 16, 2024

Thanks! I found the disable as I was writing up the issue. Took me a while, since it doesn't show up in search results for LSP or Language Server.

It appears to always obscure something, but you're right, it does depend on where the cursor is in the frame. In the middle, it almost doesn't obscure it at all (it does overlap the top of the cursor's row a tiny bit):

Screenshot 2024-09-16 at 13 37 38

And at the bottom, it doesn't obscure the code (any more than the middle one, at least), but does completely obscure the completions:

Screenshot 2024-09-16 at 13 37 49

though this is inconsistent, as scrolling up and down results in the tooltips obscuring the cursor no matter where it is:

Screenshot 2024-09-16 at 13 47 08 Screenshot 2024-09-16 at 13 47 19

When placing a tooltip above the cursor, it should probably be offset by at least the width of the tooltip's drop shadow plus a bit.

I get that some folks like to see lots of information so everyone's preferences will differ. But it doesn't seem right that showing two overlapping tooltips will ever be the right thing to do, but if that's going to happen, how on earth does one pick? I saw some screenshots when I was checking if this was already open (that I can't find anymore, of course) where the completion and signature appeared to share a tooltip. That seems like it might help with the layout problem, but I assume there's a good reason it doesn't work that way anymore.

@krassowski
Copy link
Member

completion and signature appeared to share a tooltip

I think you may think about documentation in the completer. You can enable it in settings.

@krassowski
Copy link
Member

But it doesn't seem right that showing two overlapping tooltips will ever be the right thing to do, but if that's going to happen, how on earth does one pick?

Right!

As to which to show - the language server decides whether to show signature or not - not this extension, so the behaviour will differ between servers. Which server are you using?

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

No branches or pull requests

2 participants