-
Notifications
You must be signed in to change notification settings - Fork 171
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
Handle unicode uppercase characters in autocomplete #990
Comments
The characters that can begin constants depends on the source encoding. If it's A cheap way to do it is to ask Ripper or YARP. Both will have the encoding object for you. encoding = Ripper.new(source).tap(&:parse).encoding Once you have the encoding, you should make a regexp that is fixed so that encoding: regexp = Regexp.new("[[:upper:]]".encode(encoding), Regexp::FIXEDENCODING) then you can check if it matches the character: begin
regexp.match?(character)
rescue Encoding::CompatibilityError
# If the character can't be represented in that encoding, then
# it can't possibly be uppercase.
false
end |
@nirvdrum would know much more about this |
@paracycle found out the right answer in #1171 (comment). The spec already handles any valid identifier for trigger characters, so we actually don't have to worry about this. Just indexing constants that use unicode characters should be enough. |
This issue is being marked as stale because there was no activity in the last 2 months |
Honestly, this doesn't feel like it's worth the effort and we received no requests for supporting this. |
See #957 (comment) for more context.
We currently only support
"A".."Z"
for completion. Let's understand the efforts and trade offs for supporting any arbitrary uppercase unicode character for completion, since Ruby does allow them to be used in constant names.The text was updated successfully, but these errors were encountered: