Skip to content

Avoid slow symbol completion when completion target is an empty symbol - #534

Merged
ima1zumi merged 1 commit into
ruby:masterfrom
tompng:drop_empty_symbol_completion
Mar 3, 2023
Merged

ima1zumi merged 1 commit into
ruby:masterfrom
tompng:drop_empty_symbol_completion

Conversation

@tompng

@tompng tompng commented Mar 2, 2023 •

Copy link
Copy Markdown
Member

I changed not to complete symbols when you just type :. You need one more character to start symbol completion.

If you type :, all symbols was shown in the completion dialog and it was slow.
It's because of the completion candidates size.

% ruby -e "p Symbol.all_symbols.size"
3737
% rails c
Loading development environment (Rails 7.0.4.2)
irb(main):001:0> Symbol.all_symbols.size
=> 28738

Also, the top completion candidates are non-alphabet symbols. I think it's hard to find a symbol what you want by pressing [tab] in this situation. I always type one more character before looking the completion candidate for symbol.

% ruby -e "p Symbol.all_symbols.take(20)"
[:!, :"\"", :"#", :"$", :%, :&, :"'", :"(", :")", :*, :+, :",", :-, :".", :/, :":", :";", :<, :"=", :>]

Changed the regexp /^(:[^:.]*)$/ → /^(:[^:.]+)$/.
It still matches :a but does not match to : anymore.

@ima1zumi ima1zumi added the bug Something isn't working label Mar 3, 2023

@ima1zumi ima1zumi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@ima1zumi
ima1zumi merged commit 35697f3 into ruby:master Mar 3, 2023
@tompng
tompng deleted the drop_empty_symbol_completion branch March 9, 2023 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants