codemirror / dev

Development repository for the CodeMirror editor project
https://codemirror.net/
Other
5.94k stars 377 forks source link

Autocompletion popup is not displayed if the start of the completion range is not visible #1422

Closed mtomaschek closed 2 months ago

mtomaschek commented 3 months ago

Describe the issue

If the start of the completion range is not visible, e.g. because of scrolling, the autocompletion popup does not display at all. This seems to be a consequence of how the position for the tooltip is selected (start of the completion range), because tooltips for currently not visible positions are not displayed.

This can be reproduced using the autocompletion demo on the main website: autocomplete-issue As soon as the first character of the completion range goes outside the bounds of the editor, the popup does not appear any more. It does appear while the first character is behind the line numbers, though.

Personally, I would prefer the popup to either always be aligned to the cursor, or to be kept visible as long as a part of the completion range is still visible. As the current behavior seems to be by design, do you think this is something that should be fixed, or something that could be allowed to be adjusted in a future version (e.g. via some configuration option controlling where to place the popup)? Would a pull request for this be welcome?

Browser and platform

Tested in Firefox 128 and Chrome 127, but should be unrelated to the browser

Reproduction link

https://codemirror.net/examples/autocompletion/

marijnh commented 3 months ago

Could you say a bit more about when it would be useful to show a tooltip for a position that's not visible to the user?

marijnh commented 2 months ago

Closing until further information comes in.