-
-
Couldn't load subscription status.
- Fork 40
feat: module attributes #215
Conversation
|
tested in VSCode module_attributes.mp4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lib/next_ls/runtime/sidecar.ex
Outdated
| |> Enum.filter(&match?({:attribute, _, _, _}, &1)) | ||
| |> Enum.reject(fn {_, "@" <> name, _, _} -> | ||
| Map.has_key?(Module.reserved_attributes(), String.to_atom(name)) | ||
| end) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For optimum efficiency, i'd combine these so its operated in a single pass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, agree. Will fix that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be helpful to extra a module for single use AST functions, to get them out of this sidecar process, as it's just meant to be a sidecar/proxy.
You can then unit test them if you'd like (I don't think it's necessary for this PR, but as we discover more complicated edge cases, would be useful)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, that's good idea. I extracted it. I'm not happy about module design but I think it could be refactored later with more usecases.
I'm not sure about naming so if you like call it differently I don't mind
c2db6c9 to
d9042f3
Compare
resolves #86
Parses AST to collect module attribute definitions. Also parses AST to get attribute reference name.