-
Notifications
You must be signed in to change notification settings - Fork 221
Add code actions for unknown modules and structs #891
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
Conversation
8b55ef5
to
83c08e6
Compare
83c08e6
to
85c9526
Compare
@lukaszsamson Could you give me some feedback on that feature?
Sorry this is taking time but work on experimental server has stalled. I'm thinking of removing it. What do you think about migrating this PR back to original server code? There was already a PR adding some code action (now reverted due to many problems in implementation) #718
@lukaszsamson I see. I can definitely move this PR to the original code. However, I think many additional helpers introduced in the experimental server were very useful for working on AST. What about starting with migrating the existing code actions with all that helpers to the original server before introducing this new code action?
Sure, we should salvage the good stuff
I propose another two code actions that can be applied when we get either:
Replacing modules
The first code action proposes replacing an unknown module with its full name. For example:
will be replaced with
if we have module
ElixirLS.LanguageServer.Fixtures.ExampleStruct
available. Similarlycan be replaced with
if
ElixirLS.LanguageServer.Fixtures.ExampleDefaultArgs
is available.Adding an alias
The second code action adds an alias that is required to make the code work. For example:
will be replaced with
and
will be replaced with
Notes
ElixirSense.Core.Metadata.get_position_to_insert_alias/2
function which has two limitations that may affect the usability of the code action:@moduledoc
which may not be a perfect place