fonsp / Pluto.jl

🎈 Simple reactive notebooks for Julia
https://plutojl.org/
MIT License
5k stars 296 forks source link

Overly eager autocomplete #3008

Closed mihrits closed 4 weeks ago

mihrits commented 2 months ago

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:

https://github.com/user-attachments/assets/0e7f5cba-1467-4678-8c55-891d904f9bb0

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 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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 commented 4 weeks ago

I have disabled most trigger characters in https://github.com/fonsp/Pluto.jl/pull/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 commented 4 weeks ago

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:

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

kellertuer commented 4 weeks ago

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 commented 4 weeks ago

@kellertuer the PR https://github.com/fonsp/Pluto.jl/pull/3055 has not been released yet. Can you pkg> add Pluto#main and edit your comment?

fonsp commented 4 weeks ago

To avoid confusion, I will close this issue which is mostly about the auto commit characters , . ( [ { which have been removed in https://github.com/fonsp/Pluto.jl/pull/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!

kellertuer commented 4 weeks ago

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