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

Support Erlang/OTP 26 new features #11985

Closed
11 tasks done
josevalim opened this issue Jul 13, 2022 · 16 comments
Closed
11 tasks done

Support Erlang/OTP 26 new features #11985

josevalim opened this issue Jul 13, 2022 · 16 comments
Milestone

Comments

@josevalim
Copy link
Member

josevalim commented Jul 13, 2022

To be implemented and backported when Erlang 26 is released:

  • Support custom_options: [sort_maps: true] for sorting maps
  • Make the suite resilient to unordered maps
  • Give the new shell on Windows a try and ensure that ANSI detection works out of the box
  • Ensure history works

To be implemented when Erlang 26 is released:

  • Ensure we properly cache code paths
  • Support concurrent application boot

To be implemented when we require Erlang 26 exclusively:

Please do not send PRs for those, as it will take a while until we can effectively accept them.

@garazdawi
Copy link

If you want to, you may want to check out the new possible return values from edlin_expand:expand/1,2 introduced in erlang/otp#5924.

https://github.com/erlang/otp/blob/master/lib/stdlib/src/edlin_expand.erl#L41-L47

It allows the expand function to return structured data so that you can group completions. In Erlang we use it to make completions like this:

1> h<TAB>
bifs
halt(    hd(
commands
h(          hcb(        help(       history(    ht(
modules
heart:                    http_chunk:               http_request:             
http_response:            http_transport:           http_uri:                 
http_util:                httpc:                    httpc_cookie:             
httpc_handler:            httpc_handler_sup:        httpc_manager:            
httpc_profile_sup:        httpc_request:            httpc_response:           
httpc_sup:                httpd:                    httpd_acceptor:           
httpd_acceptor_sup:       httpd_cgi:                httpd_conf:               
httpd_connection_sup:     httpd_custom:             httpd_custom_api:         
httpd_esi:                httpd_example:            httpd_file:               
httpd_instance_sup:       httpd_log:                httpd_logger:             
httpd_manager:            httpd_misc_sup:           httpd_request:            
httpd_request_handler:    httpd_response:           httpd_script_env:         
httpd_socket:             httpd_sup:                httpd_util:

and like this:

1> ssl:connect(<TAB>
typespecs
ssl:connect(Host, Port, TLSOptions)
ssl:connect(Host, Port, TLSOptions, Timeout)
ssl:host() ::      {0..255, ...}      {0..65535, ...}    
string()
ssl:connect(TCPSocket, TLSOptions)
ssl:connect(TCPSocket, TLSOptions, Timeout)
ssl:socket() ::     {'$inet', ...}      port()

@lukaszsamson
Copy link
Contributor

How about :erlang.nodes/2 added in erlang/otp#6007 and released in OTP 25.1?

@epinault
Copy link

hello, I am finding an issue that maybe is something not yet implemented but in OTP 26 the follow code breaks

Mix.Task.get("phx.new").

I had a mix task that tries to detect if phoenix is installed by detecting the mix task above. All worked till OTP 26. but in OTP 26 it cannot find the code being loaded somehow. Any idea ? We are seeing that a lot with atom (to_existiing_atom failing in our code base and having to force loading the module before so the atom are available)

@josevalim
Copy link
Member Author

Hi @epinault, please use the ElixirForum or do a complete bug report, I don't want to sidetrack the existing issues.

@epinault
Copy link

done #13116 (so if people find this they know where I moved the issue to)

@michallepicki
Copy link
Contributor

👋🏻 Hello! I see one point that requires Erlang 26 is ticked off. Does this mean Elixir 1.18 will require 26, and the remaining points can be worked on now, or was werl just deprecated for long enough?

@josevalim
Copy link
Member Author

The rich shell will require 26 on Windows in the new version because maintaining both, and 27, was not possible.

@josevalim
Copy link
Member Author

We can start tackling the remaining 3 items in this issue. Pull requests are welcome!

@garazdawi
Copy link

I noticed that https://github.com/elixir-lang/elixir/blob/main/lib/iex/lib/iex/server.ex#L363-L364 does not actually parse anything. If you update that to return {more, []} when more characters are needed to complete the expression you should get multiline editing in iex.

@josevalim
Copy link
Member Author

For that feature we need this patch, which means it was postponed to OTP 27 integration. :)

@josevalim
Copy link
Member Author

@garazdawi there is one task left, which is to deal with groups in IEx autocompletion. How do you declare these groups in Erlang/OTP? Should perhaps we make the group some sort of official metadata in EEP 48?

@garazdawi
Copy link

garazdawi commented Dec 11, 2024

Right now all the logic is inside edlin_expand. I'm not sure what categories you have in mind that would be placed in EEP-48?

We have:

  • bifs
  • modules
  • functions
  • typespecs
  • variable bindings
  • records
  • keywords
  • types
  • commands
  • user_defined
  • fields
  • matches
  • atoms

and probably some others that I didn't find.

Most of these have very little with the docs to do and more with different contexts within the language, except modules/functions/types of course.

@josevalim
Copy link
Member Author

@garazdawi I see. In Elixir we use groups already to organize things in the ExDoc sidebar:

I was thinking we could expose those same groups in the terminal. This way, Cowboy could for example, do this:

-doc #{group => ~"Request"}.

And then it automatically shows up in autocomplete.

@garazdawi
Copy link

@josevalim We already have something similar it our docs: https://github.com/erlang/otp/blob/OTP-27.2/lib/stdlib/src/string.erl#L254 Though we call it title and use it only for ex_doc groups. I think using the same thing for grouping functions/types in the shell would be a great idea.

@josevalim
Copy link
Member Author

Thank you. I will think about the API and submit a pull request once the pieces have fallen into place. :)

@josevalim
Copy link
Member Author

All done, thanks everyone!

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

No branches or pull requests

5 participants