-
Notifications
You must be signed in to change notification settings - Fork 196
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
Bump sourceror dependency to v0.12.2 #841
Conversation
0ef38bb
to
81ef758
Compare
81ef758
to
4b120fc
Compare
ElixirSense.string_to_quoted(s, 1, 6, token_metadata: true) | ||
def from(s, opts) when is_binary(s) do | ||
if opts[:include_comments] do | ||
Sourceror.parse_string(s) |
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.
Does sourceror fix errors like ElixirSense does?
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 don't know. I'm not familar with how ElixirSense
fixes errors. Do you have examples or tests that check for this? We could extend those to test Sourceror's behaviour.
test "from\1" do | ||
assert {:ok, | ||
{:def, [do: [line: 1, column: 16], end: [line: 3, column: 3], line: 1, column: 3], | ||
[ | ||
{:foo, [closing: [line: 1, column: 14], line: 1, column: 7], | ||
[{:baz, [line: 1, column: 11], nil}]}, | ||
[do: {:__block__, [], []}] | ||
]}} = | ||
Ast.from(""" | ||
def foo(baz) do | ||
# TODO | ||
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.
these assertions are pretty hard core, and are really testing the calls to elixir sense / sourceror
Perhaps instead, just ensure we're calling the two libs correctly in each case by using Patch
?
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.
The sourceror github page says to expect "frequent breaking changes".
Perhaps we leave the assertion of the returned AST structure -- at least for the Ast.from(_, include_comments: true)
call -- to catch any breaking changes?
I depend on the AST returned by sourceror for the extract function refactoring code I'm writing in a separate branch.
Use Sourceror.parse_string/1 when include_comments: true.
60b5803
to
4895dc1
Compare
Sourceror library introduces problems with Mix.install and conflicts with sourceror versions used by client projects. If we want it we need it vendored like dialyxir and jason |
@lukaszsamson Are you intending to remove When making this PR I found I needed to use # use tag to ensure sourceror/lib_vendored is included
{:sourceror, github: "doorgan/sourceror", tag: "v0.12.2"},
Which client projects have the conflicts? |
Yes. It's not really used anywhere
No idea TBH, but most likely no. A lot of people reported problems with build related to that dependency. Just search for sourceror in issues here/vsdode/forum/slack. And we need a proper vendoring. OTP has no code sandboxing. Whenever a client project has it as a dependency in some other version it will override modules from our dependencies. |
Bump sourceror dependency to v0.12
refactor.extract.function
code action that works with sourceror v0.12.sourceror/lib_vendored
is included and compilation in VSCode works.Pass include_comments option to CodeMod.Ast.from/2
Sourceror.parse_string/1
wheninclude_comments: true
option passed toCodeMod.Ast.from/2
.CodeMod.Ast.from/2
.