feat: DH-22990: improve clear command behaviour in console input#2709
feat: DH-22990: improve clear command behaviour in console input#2709dsmmcken wants to merge 2 commits into
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2709 +/- ##
==========================================
- Coverage 51.10% 50.86% -0.25%
==========================================
Files 793 794 +1
Lines 45204 45228 +24
Branches 11703 11510 -193
==========================================
- Hits 23103 23003 -100
- Misses 22055 22206 +151
+ Partials 46 19 -27
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@dsmmcken not sure this is the "right" fix. As I commented on the ticket, native Python REPL in Python just sends the command when you press Enter: https://deephaven.atlassian.net/browse/DH-22990?focusedCommentId=73600 |
mofojed
left a comment
There was a problem hiding this comment.
The registered suggestions don't appear.
I really don't like this change. It's unexpected behaviour - if I have a variable named clear_color or cls_name, and then type cls and press "Enter", it will just clear my console instead of picking that variable name (which is different behaviour than before, and different behaviour than if you had typed literally anything else).
As mentioned, I really think we should just take "Enter" to run the current command, "Tab" to take the suggestion, as other Python REPLs do.
OR correctly add the clear and cls as commands in the autosuggestion, so you need to press Enter to get the suggestion, then Enter again to send it.
Note also looked at Chrome console and Firefox Console.
Chrome console just runs the command on Enter. It doesn't autohighlight the first suggestion, and shows tab in it to get the suggestion:

If you press Down on the keyboard, then it highlights it:

Firefox shows the item highlighted, and when you press Enter, it selects that item.

| // Register the special console commands (clear/cls) as completions. Uses the | ||
| // '*' selector so it shares Monaco's low-priority word-based completion group | ||
| // and coexists with it, instead of suppressing word-based suggestions. | ||
| monaco.languages.registerCompletionItemProvider('*', { |
There was a problem hiding this comment.
This doesn't seem to work. I think it just most specific completion provider available, as I just see the regular suggestions. If I comment out the other registration (e.g. in MonacoProviders), I then see these suggestions.
Typing
clear/clsin the console was unreliable — Monaco autocomplete would hijack Enter with a fuzzy match instead of running the command. This makes clearing the console reliable and discoverable.clear/clseven with the suggest widget openclear/clsnow show in autocomplete (without suppressing word-based suggestions).Not tested on mac. Please test.
Not sure how much gets reused in enterprise of this.