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

Overly eager autocomplete #3008

Closed
mihrits opened this issue Aug 22, 2024 · 13 comments
Closed

Overly eager autocomplete #3008

mihrits opened this issue Aug 22, 2024 · 13 comments
Labels

Comments

@mihrits
Copy link

mihrits commented Aug 22, 2024

I have noticed that Pluto has started to eagerly autocomplete things that I don't want to autocomplete. It seems that autocompletion is carried out by many different triggers; for example, I have found so far ,, ., (, [, in addition to <Tab>. A recording of this behavior:

Pluto_autocomplete.mov

This is really counterproductive; for example, when trying to write x, y, z, I have to press <Esc> every time before entering a comma.

There is a short discussion on Slack in the #pluto channel with a suggestion that this might stem from PR#2942 (I am using MacOS). This behavior is also mentioned in Discussion#3001. I was encouraged to open an issue, as this was bothering more people.

I would expect the autocomplete to be carried out with explicit <Tab> or when starting to choose autocomplete options with arrow keys and then <Tab> or <Return>.

Information about my setup:

julia> versioninfo()
Julia Version 1.10.4
Commit 48d4fd48430 (2024-06-04 10:41 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 8 × Apple M1 Pro
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
Threads: 1 default, 0 interactive, 1 GC (on 6 virtual cores)
Environment:
  JULIA_EDITOR = nvim

This behavior shows up in [c3e4b0f8] Pluto v0.19.46.

@disberd
Copy link
Contributor

disberd commented Aug 22, 2024

I thought it was more documented but indeed it's not clearly stated in the original PR.

The way to disable this (in a way that persists between Pluto sessions for the same browser and port) is to open your browser developer console and execute the following:
PLUTO_TOGGLE_CM_AUTOCOMPLETE_ON_TYPE() which is a function that toggles whether this behavior is enabled or not.

You can also check your current pluto browser cached options with window.localStorage:
image

That being said, as a comment to the issue at hand I also find the automatic autocomplete especially on , and . to be more frustrating than useful in my case, so I'd rather this be toned down as well (I also discussed this with @Pangoraw at the juliacon hackaton)

@fonsp
Copy link
Owner

fonsp commented Aug 24, 2024

Thanks for the feedback @mihrits !

Could you give some examples of cases where this happened during your normal work? The example x, y, z that you gave is happening because x,y,z are not defined in the empty notebook that you made to demonstrate the issue. But I'm curious when exactly the eager autocompletion is an issue during real use.

@fonsp fonsp added the autocomplete <TAB> label Aug 24, 2024
@fonsp
Copy link
Owner

fonsp commented Aug 24, 2024

For other people who see this issue and want to leave feedback, please record a video and open a new issue! (Instead of replying here) It is helpful for us if different specific autocomplete problems are addressed in different issues.

@mihrits
Copy link
Author

mihrits commented Aug 25, 2024

During normal work, this happens when I define new variables or functions. For example, when I try to define x, y, z = crds. Or another example, when I define a function with a short name. For example, when want to define function f(x) I have to use <esc> before writing the parenthesis. This also happens when listing columns from a DataFrame, because (I think) the column names are not defined and when I have a list of short column names, I have to cancel the autocomplete after every name before adding a comma. For example, select(df, :Ex, :Ey, :Ez).

@aplavin
Copy link
Contributor

aplavin commented Aug 25, 2024

Totally agree, it definitely feels overeager very often. Auto-accepting completions makes blind/muscle memory typing impossible. Thanks for the solution to turn it off!
IMO, a better way would be to show completions automatically, but only accept them on tab.

@kellertuer
Copy link

kellertuer commented Sep 7, 2024

To me it also happens when I load new packages (since those seem to not be defined variables?), or when I want to broadcast Float64.( when typing the . some autocomplete starts and goes bogus.

Also as said before, defining any new variable has become a quite annoying.

I like the more inactive variants, that TAB autocompletes (like VS code does for example) but space does not.

edit: It would be nice to have this disabling somewhere in a menu and maybe even something saved in some preferences. To me the current default is very very very different to what I am used in VS Code and I get annoyed by this roughly every 30 seconds.

@kellertuer
Copy link

I noticed the most annoying auto-complete-trigger by now is . if you have the smallest typo somewhere, usually the . would not open the autocomplete for fields, one would notice the typo, goes back and it is fine.

With the smallest typo, the autocomplete tries to guess anything maybe close to the typo, but usually far far off. That gets me very often and is (for me) super annoying.

@fonsp
Copy link
Owner

fonsp commented Oct 14, 2024

I have disabled most trigger characters in #3055 :)

If you find more issues with autocomplete, please record a video of where you found the issue, and maybe a notebook file. Looking forward to hear more feedback!

@fonsp
Copy link
Owner

fonsp commented Oct 14, 2024

I'm looking forward to hear more feedback! I understand that some functionality has been frustrating, and I hope it didn't cause too much trouble.

Why go through all this trouble? I think that autocomplete-on-type is a really valuable tool for new programmers, as it can help with:

  • discoverability (see what's possible)
  • learning package functionality (we show Live Docs while browsing through autocomplete options)
  • learning that you can use clear variable names (model_refined instead of m2) without having to type more
  • fun! I hope it makes programming feel more exciting

I think Pluto is in a good position to offer good autocomplete because:

  • We only support one language, so we can find what works best for Julia, not something that works fine for all languages
  • We have full backend runtime access: we can use introspection in realtime in the notebook process
  • We have a complete Julia parser in JavaScript: we can do more advanced syntax matching to decide when to autocomplete what

@kellertuer
Copy link

Thanks for reducing this a bit. It looks like is already no longer an autocomplete-trigger This is the most-annoying for me, since in any line defining a new value like

[f, = ...

or defining a function with multiple returns

f, p, q = myfun(x) = ....

This would (still in my version currently) autocomplete to factorial, quote, pairs = myfun(x) = .
When that was even on space, this also hit me defining any variable. Sure, you wanted to test that and I was a test item then, but it was not so productive working in Pluto recently; great that you turn that a bit back.

In general I feel, automatically doing this should be done super careful. I really like Julia 1.11-REPL on this with the grey proposals – but still requiring TAB to take it. But I might be an extreme case on that opinion probably and other might prefer more automation.

@fonsp
Copy link
Owner

fonsp commented Oct 14, 2024

@kellertuer the PR #3055 has not been released yet. Can you pkg> add Pluto#main and edit your comment?

@fonsp
Copy link
Owner

fonsp commented Oct 14, 2024

To avoid confusion, I will close this issue which is mostly about the auto commit characters , . ( [ { which have been removed in #3055. If your problem is about this feature: just wait until Pluto 0.20.0 gets released!

Continued discussion

For more autocomplete feedback, please open a new issue and record a video. Try to be friendly and supportive!

@fonsp fonsp closed this as completed Oct 14, 2024
@kellertuer
Copy link

I can check when I find time for that, sure.

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

No branches or pull requests

5 participants