-
-
Notifications
You must be signed in to change notification settings - Fork 82
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
Add replacing unknown remote function to code actions #443
Add replacing unknown remote function to code actions #443
Conversation
Thanks for the contribution! I'll look more carefully at this soon but a couple of early points:
|
Also, thank you for writing so many tests! |
Also, looking at all the work you had to do to add another action makes me think we can improve the process by coming up with a simpler API for code actions, possibly pushing the bulk of their logic into remote_control, so that we only need to call a single function in remote_control to get all the relevant code actions. |
Thanks for a quick response!
That makes sense. However, I have an issue with
That should work |
I think you need to do this in the project node (the |
@sheldak The PR has been merged, I think this PR is will now be much simpler to implement and test. |
9c69873
to
63c0557
Compare
@zachallaun @scohen All changes made! |
@sheldak what did you think of the changes? |
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.
Looks pretty good. The lion's share of the file changes here are fixtures for testing in the server
app.
I have some minor comments, but the approach looks solid to me.
apps/remote_control/lib/lexical/remote_control/code_action/handlers/replace_remote_function.ex
Outdated
Show resolved
Hide resolved
apps/remote_control/lib/lexical/remote_control/code_action/handlers/replace_remote_function.ex
Outdated
Show resolved
Hide resolved
apps/remote_control/lib/lexical/remote_control/code_action/handlers/replace_remote_function.ex
Outdated
Show resolved
Hide resolved
apps/remote_control/lib/lexical/remote_control/code_action/handlers/replace_remote_function.ex
Outdated
Show resolved
Hide resolved
apps/remote_control/lib/lexical/remote_control/code_action/handlers/replace_remote_function.ex
Outdated
Show resolved
Hide resolved
apps/remote_control/lib/lexical/remote_control/code_action/handlers/replace_remote_function.ex
Show resolved
Hide resolved
...te_control/test/lexical/remote_control/code_action/handlers/replace_remote_function_test.exs
Show resolved
Hide resolved
apps/server/test/lexical/server/provider/code_action/replace_remote_function_test.exs
Outdated
Show resolved
Hide resolved
It was a big improvement. They made everything more concise and I particularly liked not passing all these arguments through several functions to do only code modification in the remote control. |
Looking at your Pr, I concur. I just wanted to make sure you felt the same. |
apps/remote_control/lib/lexical/remote_control/code_action/handlers/replace_remote_function.ex
Show resolved
Hide resolved
@sheldak looks like you're going to need to rebase. |
Never mind, i'll do this for you. |
I've prepared that PR to propose extending code actions by replacing unknown remote functions (I did a similar thing in that PR for ElixirLS). For example, the following code:
contains an unknown function -
counts/1
. After this change, we would get 2 possible quick fixes:that rewrite our code to:
or
respectively.
In our example, code actions were generated using String.jaro_distance/2 with a threshold of 0.77 to create at most 5 suggestions (similar to did you mean functionality).