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

unqualified import completion #3054

Merged
merged 9 commits into from
May 15, 2024
Merged

Conversation

Acepie
Copy link
Contributor

@Acepie Acepie commented Apr 28, 2024

Closes #2892

Checks existing imports in the current module to see what is already imported and then looks through the importing module to find everything else that is importable from that module

Copy link
Member

@lpil lpil left a comment

Choose a reason for hiding this comment

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

Thank you! I've left some comments

compiler-core/src/language_server/engine.rs Outdated Show resolved Hide resolved
compiler-core/src/language_server/engine.rs Outdated Show resolved Hide resolved
compiler-core/src/language_server/engine.rs Outdated Show resolved Hide resolved
@@ -166,6 +166,8 @@

- Go to definition now works for direct type annotations ([Ameen Radwan](https://github.com/Acepie))

- Completions are now provided for values and types for use in unqualified imports ([Ameen Radwan](https://github.com/Acepie))
Copy link
Member

Choose a reason for hiding this comment

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

I think this is a little misleading as it will very rarely work. The cursor position will be outside the import definition at time of last successful compilation so it won't return any completions.

I think we may also have the same text edit bug with vscode

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should work much better now. Didn't realize this was only working well because of auto bracket close before. lmk if this seems good enough now. If not I can change this

Copy link
Member

Choose a reason for hiding this comment

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

I've just given this a try and it feels so nice! Thank you!!

compiler-core/src/language_server/engine.rs Outdated Show resolved Hide resolved
@Acepie
Copy link
Contributor Author

Acepie commented Apr 29, 2024

Ok worked on this a bit and got something that works pretty nicely overall

Screen.Recording.2024-04-29.at.6.47.39.AM.mov

@Acepie Acepie force-pushed the completeUnqualifiedImports branch 3 times, most recently from ed53720 to ec36300 Compare May 10, 2024 01:58
@Acepie Acepie force-pushed the completeUnqualifiedImports branch from ec36300 to ade819a Compare May 15, 2024 13:10
Copy link
Member

@lpil lpil left a comment

Choose a reason for hiding this comment

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

Another fantastic improvement! You're on fire! Thank you

@@ -166,6 +166,8 @@

- Go to definition now works for direct type annotations ([Ameen Radwan](https://github.com/Acepie))

- Completions are now provided for values and types for use in unqualified imports ([Ameen Radwan](https://github.com/Acepie))
Copy link
Member

Choose a reason for hiding this comment

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

I've just given this a try and it feels so nice! Thank you!!

@lpil lpil merged commit 200f0b8 into gleam-lang:main May 15, 2024
12 checks passed
@inoas
Copy link
Contributor

inoas commented May 17, 2024

Thanks - This is awesome!

@Acepie Acepie deleted the completeUnqualifiedImports branch June 2, 2024 22:18
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: autocomplete types and values in import blah.{here}
3 participants