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: Include braces in type import completions #3963

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Frank-III
Copy link
Contributor

close: #3498

continuation of #3516, to support tests with invalid syntax.

I am not sure if I should make it a different function. Please review it 🙏

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.

Looks really good! I've left one note about the API change in the tests. It'll need to not change the API the others use.

I think it would be best to write the code directly for this one case rather than have all the other tests and the macro adapt for this one unique case.

@@ -601,15 +607,15 @@ impl<'a> TestProject<'a> {
pub fn at<T>(
&self,
position: Position,
new_src: Option<&str>,
Copy link
Member

Choose a reason for hiding this comment

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

Remove this please. The other tests should not change, we don't want to have a parameter that every test needs to provide but only this one uses.

@@ -559,6 +559,7 @@ impl<'a> TestProject<'a> {
pub fn positioned_with_io(
&self,
position: Position,
new_src: Option<&str>,
Copy link
Member

Choose a reason for hiding this comment

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

Remove this please. The other tests should not change, we don't want to have a parameter that every test needs to provide but only this one uses.

@lpil lpil marked this pull request as draft December 9, 2024 16:17
@Frank-III
Copy link
Contributor Author

Looks really good! I've left one note about the API change in the tests. It'll need to not change the API the others use.

I think it would be best to write the code directly for this one case rather than have all the other tests and the macro adapt for this one unique case.

I did that in my first attempt, but I thought we might have more tests with src being invalid syntax in the future? If you think no, I would just write the code for this test case

Remove this please. The other tests should not change, we don't want to have a parameter that every test needs to provide but only this one uses.

maybe we could offer two more functions positioned_with_io_with_new_src and at_with_new_src and have positioned_with_io and at calling these two respectively so we won't need to pass this parameter in every test?

@lpil
Copy link
Member

lpil commented Dec 17, 2024

I did that in my first attempt, but I thought we might have more tests with src being invalid syntax in the future?

They would do the same. It must not change the other tests

maybe we could offer two more functions positioned_with_io_with_new_src and at_with_new_src and have positioned_with_io and at calling these two respectively so we won't need to pass this parameter in every test?

I think making helper functions for a single test case is premature, we can wait and see how many of these come up.

@Frank-III Frank-III marked this pull request as ready for review December 17, 2024 17:20
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: autocompleting type imports should add brackets if needed
3 participants