Skip to content

Conversation

@GuillaumeMilan
Copy link
Contributor

@GuillaumeMilan GuillaumeMilan commented Jan 6, 2025

Fixes the behaviour of autocompleting map update with structures described in issue #14149

iex> u = %URI{}
iex> %{u | 

Autocompleting the last line now works properly

@josevalim
Copy link
Member

josevalim commented Jan 6, 2025

Can you please try adding a test as well on iex/autocomplete_test? It would be important to avoid regressions :)

assert {:no, [], []} = expand(~c"%URI{var | path: \"foo\", unkno")
assert {:no, [], []} = expand(~c"%Unknown{var | path: \"foo\", unkno")

eval("var = %URI{}")
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we add a test for an exception struct (e.g. ArgumentError) as well?

Copy link
Member

Choose a reason for hiding this comment

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

@lukaszsamson this is tricky because how do we know which keys to skip? You likely want to skip the meta key in Ecto schemas too and so on. So I'd prefer to provide a general mechanism to control this (perhaps with the type system) instead of special casing __exception__.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure. Either we filter out all underscored fields or let the library decide in some way what is internal. My concern was more if __exception__ needs some special handling the way __struct__ does.

@josevalim josevalim merged commit ef1450d into elixir-lang:main Jan 7, 2025
9 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants