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

Insert local import when completing workspace symbol. #578

Merged
merged 2 commits into from Mar 20, 2019

Conversation

olafurpg
Copy link
Member

Previously, Metals inserted a fully qualified name at the completion
position. With this commit, we now insert a local import in the nearest
enclosing block. Down the road, we can add a code action to "Move import
to global scope" to clean up local imports inserted by Metals.

Other improvements in this commit:

  • we render the package name in the completion item label so that it's
    more visible what you are importing.
  • we no longer use insert text, which is a deprected LSP feature and
    has unclear semantics between editors. Instead, we only use textEdit.

Previously, Metals inserted a fully qualified name at the completion
position. With this commit, we now insert a local import in the nearest
enclosing block. Down the road, we can add a code action to "Move import
to global scope" to clean up local imports inserted by Metals.

Other improvements in this commit:

- we render the package name in the completion item label so that it's
  more visible what you are importing.
- we no longer use insert text, which is a deprected LSP feature and
  has unclear semantics between editors. Instead, we only use `textEdit`.
@olafurpg olafurpg merged commit c9b4d83 into scalameta:master Mar 20, 2019
@olafurpg olafurpg deleted the workspace-import branch March 20, 2019 09:29
@olafurpg olafurpg added this to the Metals v0.5 - Mercury milestone Apr 12, 2019
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.

None yet

1 participant