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

Make repl autocomplete case-insensitive #41631

Closed
gribnoysup opened this issue Jan 21, 2022 · 4 comments · Fixed by #41632
Closed

Make repl autocomplete case-insensitive #41631

gribnoysup opened this issue Jan 21, 2022 · 4 comments · Fixed by #41632
Labels
feature request Issues that request new features to be added to Node.js. repl Issues and PRs related to the REPL subsystem.

Comments

@gribnoysup
Copy link
Contributor

gribnoysup commented Jan 21, 2022

What is the problem this feature will solve?

Having an autocomplete in the REPL is already a great feature, but currently the autocomplete is case-sensitive, which means that if you are not quite sure about variable names or typing too fast to case your input properly you might miss out on the benefits of having an autocomplete aiding you in your typing.

What is the feature you are proposing to solve the problem?

Make autocomplete case-insensitive.

Specifically I'm suggesting not to make it completely case-insensitive, but follow console behavior in browsers (at least Chrome and FF that I used as reference) that Node.js REPL users might be most familiar with already.

These browsers make autocomplete suggestions ignoring the input case if the first char of the last member in the input that autocomplete is trying to complete is lower-cased, otherwise, if the char is upper-cased, browser will use input casing when filtering autocomplete suggestions.

To illustrate this behavior:

> var xa = '123';
> var Xb = { fooBar: 1, FooBuz: 2 }
> x <tab>
xa Xb
> X <tab>
(autocompletes to `Xb` because it's the only possible option)
> Xb.f <tab>
Xb.FooBuz  Xb.fooBar
> Xb.F <tab>
(autocompletes to `Xb.FooBuz` because it's the only possible option)
> Xb.Foob <tab>
(no autocomplete suggestions because suggestions are preserving case)

I also opened a PR with a possible implementation of this autocomplete change #41632

What alternatives have you considered?

Make autocomplete completely case-insensitive. Totally an option, but in my opinion browser behavior makes sense: if you are using uppercase in your input, this seems like a good indicator that you are very intentional about it and autocomplete suggestions should respect that.

Preserve current behavior. Worth mentioning because changing autocomplete to be case-insensitive while helpful in some cases, might introduce more autocomplete noise and inconvenience in others. For example typing func <tab> will not autocomplete to function anymore because Function will be a matching suggestion

@gribnoysup gribnoysup added the feature request Issues that request new features to be added to Node.js. label Jan 21, 2022
gribnoysup added a commit to gribnoysup/node that referenced this issue Jan 21, 2022
This changes autocomplete suggestion filter to ignore input case
when first character of the last member of the user input is lower-case
allowing for more autosuggest results shown on the screen

Fixes: nodejs#41631
@benjamingr
Copy link
Member

@nodejs/repl

@benjamingr
Copy link
Member

Preserve current behavior. Worth mentioning because changing autocomplete to be case-insensitive while helpful in some cases, might introduce more autocomplete noise and inconvenience in others. For example typing func will not autocomplete to function anymore because Function will be a matching suggestion

For what it's worth Chrome will suggest Function but will autocomplete func to function when you . I'm wondering how many such cases there are and if they can be fixed ad-hoc.

@VoltrexKeyva VoltrexKeyva added the repl Issues and PRs related to the REPL subsystem. label Jan 21, 2022
@gribnoysup
Copy link
Contributor Author

gribnoysup commented Jan 22, 2022

Yep, true that! Even more generally, but feels like worth adding to that: opposed to how Node.js REPL behaves in the case of multiple suggestions browser console will still autocomplete to the first suggetion when you <tab> or <right> for any autocomplete suggestion with multiple suggestions, so cases similar to this function/Function one can be avoided. I think some terminals do a similar thing where tabbing when multiple autocompletes are possible would work as selecting from the list of autocomplete options. Would be great to have something like this in Node.js REPL too, maybe worth having it as a separate feature request?

gribnoysup added a commit to gribnoysup/node that referenced this issue Jan 23, 2022
This changes autocomplete suggestion filter to ignore input case
when first character of the last member of the user input is lower-case
allowing for more autosuggest results shown on the screen

Fixes: nodejs#41631
gribnoysup added a commit to gribnoysup/node that referenced this issue Mar 11, 2022
This changes autocomplete suggestion filter to ignore input case
when first character of the last member of the user input is lower-case
allowing for more autosuggest results shown on the screen

Fixes: nodejs#41631
@targos targos moved this to Pending Triage in Node.js feature requests Apr 4, 2022
@targos targos moved this from Pending Triage to In Progress in Node.js feature requests Apr 4, 2022
gribnoysup added a commit to gribnoysup/node that referenced this issue Jun 5, 2022
This changes autocomplete suggestion filter to ignore input case
when first character of the last member of the user input is lower-case
allowing for more autosuggest results shown on the screen

Fixes: nodejs#41631
gribnoysup added a commit to gribnoysup/node that referenced this issue Jun 5, 2022
This changes autocomplete suggestion filter to ignore input case
when first character of the last member of the user input is lower-case
allowing for more autosuggest results shown on the screen

Fixes: nodejs#41631
gribnoysup added a commit to gribnoysup/node that referenced this issue Jun 5, 2022
This changes autocomplete suggestion filter to ignore input case
when first character of the last member of the user input is lower-case
allowing for more autosuggest results shown on the screen

Fixes: nodejs#41631
gribnoysup added a commit to gribnoysup/node that referenced this issue Jun 5, 2022
This changes autocomplete suggestion filter to ignore input case
allowing for more autosuggest results shown on the screen

Fixes: nodejs#41631
gribnoysup added a commit to gribnoysup/node that referenced this issue Jun 5, 2022
This changes autocomplete suggestion filter to ignore input case
allowing for more autosuggest results shown on the screen

Fixes: nodejs#41631
nodejs-github-bot pushed a commit that referenced this issue Jun 12, 2022
This changes autocomplete suggestion filter to ignore input case
allowing for more autosuggest results shown on the screen

Fixes: #41631

PR-URL: #41632
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
italojs pushed a commit to italojs/node that referenced this issue Jun 12, 2022
This changes autocomplete suggestion filter to ignore input case
allowing for more autosuggest results shown on the screen

Fixes: nodejs#41631

PR-URL: nodejs#41632
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
danielleadams pushed a commit that referenced this issue Jun 13, 2022
This changes autocomplete suggestion filter to ignore input case
allowing for more autosuggest results shown on the screen

Fixes: #41631

PR-URL: #41632
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
danielleadams pushed a commit that referenced this issue Jun 13, 2022
This changes autocomplete suggestion filter to ignore input case
allowing for more autosuggest results shown on the screen

Fixes: #41631

PR-URL: #41632
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
targos pushed a commit that referenced this issue Jul 12, 2022
This changes autocomplete suggestion filter to ignore input case
allowing for more autosuggest results shown on the screen

Fixes: #41631

PR-URL: #41632
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
targos pushed a commit that referenced this issue Jul 31, 2022
This changes autocomplete suggestion filter to ignore input case
allowing for more autosuggest results shown on the screen

Fixes: #41631

PR-URL: #41632
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
guangwong pushed a commit to noslate-project/node that referenced this issue Oct 10, 2022
This changes autocomplete suggestion filter to ignore input case
allowing for more autosuggest results shown on the screen

Fixes: nodejs/node#41631

PR-URL: nodejs/node#41632
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
@nsauk
Copy link

nsauk commented Apr 28, 2024

This made my experience worse. It's common to have something like this in your snippets:

const myVeryImportantThing = new MyVeryImportantThing()

When autocomplete is case-insensitive, you cannot choose the right option from these above:

> my<tab>
MyVeryImportantThing  myVeryImportantThing

@RedYetiDev RedYetiDev moved this from In Progress to Done in Node.js feature requests Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants