Skip to content
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

LSP Auto-import #2088

Merged
merged 1 commit into from
Apr 16, 2022
Merged

Conversation

andreytkachenko
Copy link
Contributor

Fixes #1991 Lsp auto import

@andreytkachenko andreytkachenko changed the title Fixes #1991 LSP Auto-import LSP Auto-import Apr 12, 2022
Copy link
Contributor

@pickfire pickfire left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks. I just roughly tested with an import action but not sure how to invoke the auto import.

@andreytkachenko
Copy link
Contributor Author

Looks good to me. Thanks. I just roughly tested with an import action but not sure how to invoke the auto import.

Just type Dur inside any function and completion list should appears. Choose Duration (use std::time::Duration) struct for instance and you'll notice that:

  • you typing completed to Duration
  • use std::time::Duration; added to imports

@tmke8
Copy link

tmke8 commented Apr 13, 2022

Isn't there already auto-import in helix? It definitely seems to work for me with the pyright LS. But maybe the rust LS doesn't support it?

@andreytkachenko
Copy link
Contributor Author

andreytkachenko commented Apr 13, 2022

Isn't there already auto-import in helix? It definitely seems to work for me with the pyright LS. But maybe the rust LS doesn't support it?

There is implementation for additionalTextEdits. I guess pyright sends additionalTextEdits as response to complete request. But other LSP (such as rust-analyzer) fills additionalTextEdits only after resolve. My PR enables compatibilities and changes precedence order to resolved item then completion item.

@archseer archseer merged commit dc8fef5 into helix-editor:master Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LSP Auto-import suggestions
4 participants