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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

local variable autocomplete #1925

Merged
merged 8 commits into from
Mar 21, 2022
Merged

local variable autocomplete #1925

merged 8 commits into from
Mar 21, 2022

Conversation

Pangoraw
Copy link
Collaborator

@Pangoraw Pangoraw commented Feb 16, 2022

This collects all local variables in a new scopestate field along with their "validity" range (range in which they are valid). Can be used for autocompletion of local variable and enhanced linting in #1859 (also potentially renaming of variables). @dralletje, what do you think about this approach ? (lezer-matcher is insane btw 馃く)

autocomplete_locals

@github-actions
Copy link
Contributor

Try this Pull Request!

Open Julia and type:

julia> import Pkg
julia> Pkg.activate(temp=true)
julia> Pkg.add(url="https://github.com/fonsp/Pluto.jl", rev="autocomplete_locals")
julia> using Pluto

@dralletje
Copy link
Collaborator

Nice :)

Anything specific for it to be a draft? Apart from a console.log it looks good to me.

@Pangoraw
Copy link
Collaborator Author

i would like to fix this before merging:

// FIXME: Using definition.to is not quite right here, because the
// name is not valid until the assignment expression is done and will
// currently be autocompleted on the right hand side of its own assignment :'(

@Pangoraw Pangoraw marked this pull request as ready for review March 20, 2022 17:12
@Pangoraw
Copy link
Collaborator Author

Should be good to go!

@fonsp
Copy link
Owner

fonsp commented Mar 21, 2022

Awesome!

I noticed one issue: if I autocomplete s with a local var that starts with s, it selects that one immediately.

My guess is that the real Julia autocomplete is taking too long in this case (lots of options with s), and the autocomplete window pops up with just the sqrt2, which immediately triggers.

Schermopname.2022-03-21.om.14.00.10.mov

@fonsp
Copy link
Owner

fonsp commented Mar 21, 2022

Fixed!

Schermopname.2022-03-21.om.14.07.43.mov

@fonsp fonsp merged commit 7bc699f into main Mar 21, 2022
@fonsp fonsp deleted the autocomplete_locals branch March 21, 2022 13:56
Pangoraw added a commit that referenced this pull request Mar 23, 2022
Co-authored-by: Fons van der Plas <fonsvdplas@gmail.com>
Pangoraw added a commit that referenced this pull request Mar 23, 2022
Co-authored-by: Fons van der Plas <fonsvdplas@gmail.com>
@fonsp
Copy link
Owner

fonsp commented Mar 24, 2022

@dralletje pointed out that this has a big performance impact because it makes raise_scope slower, and that function is already a bottleneck. Since I already merged this, we might need to uncomment some this feature on main while we work on performance :(

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

Successfully merging this pull request may close these issues.

None yet

3 participants