Skip to content

Conversation

sabiwara
Copy link
Contributor

@sabiwara sabiwara commented Sep 20, 2024

Related to part 1. of #13818

build_surround(dot, reversed, line, offset)

{{:local_or_var, acc}, offset} when keyword? ->
build_surround({:keyword, acc}, reversed, line, offset)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think keyword should be returned here. It's already used for reserved words do end after else catch rescue fn true false nil

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it, I misunderstood what keyword meant in this context.
keyword_atom / keyword_key?

Copy link
Member

Choose a reason for hiding this comment

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

Macro.inspect_atom uses key. Maybe that's fine? Or we use atom_key or keyword_key.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fine with both.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Either sounds good, I went with :key for the consistency.

Last question: in the case of do:, should it be a :key or a :keyword?
It would be :key with the current PR implementation, but I'm not sure which would make sense from a LSP perspective @lukaszsamson

Copy link
Member

Choose a reason for hiding this comment

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

do: should be :key IMO.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's OK, let's have do: as key and do as keyword.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great, thanks gents will merge as is then 🚀

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just realized: should we call out this "edge case" in the docs?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think it is an edge case, honestly. It is how the grammar behaves everywhere. :) So there is no need imo!

Copy link
Member

@josevalim josevalim left a comment

Choose a reason for hiding this comment

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

Except for the name, LGTM!

@sabiwara sabiwara merged commit fb065b7 into elixir-lang:main Sep 20, 2024
9 checks passed
@sabiwara sabiwara deleted the fragment-keyword branch September 20, 2024 08:53
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