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

Fix import statement completions followed by interface declaration #50350

Merged
merged 4 commits into from
Sep 20, 2022

Conversation

andrewbranch
Copy link
Member

Fixes #48904

@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Aug 17, 2022
// includeCompletionsWithSnippetText: true,
// }
// });
// });
Copy link
Member Author

Choose a reason for hiding this comment

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

I guess I had previously commented this out while debugging so I could skip straight to the later tests, then forgot to uncomment. Luckily they were all still passing 😅

src/services/completions.ts Outdated Show resolved Hide resolved
src/services/completions.ts Show resolved Hide resolved
src/services/completions.ts Outdated Show resolved Hide resolved
// line was parsed as the module specifier of a partially-typed import, e.g.
// import Foo|
// interface Blah {}
// This appears to be a multiline-import, and editors can't replace multiple lines.
Copy link
Member

Choose a reason for hiding this comment

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

editors can't replace multiple lines

Is this detail actually relevant to the change? It sounds like even if editors could do that, you would still want to assume that the next line is a separate statement and recover appropriately, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, fair; but it explains why the failure mode is “no completions” rather than “overwriting later declarations.”

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

Basically looks good, but I can't tell if an unclosed import list would behave the same as the two existing test cases.

src/services/completions.ts Show resolved Hide resolved
@andrewbranch andrewbranch merged commit 938a69a into microsoft:main Sep 20, 2022
@andrewbranch andrewbranch deleted the bug/48904 branch September 20, 2022 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

import Suggestions don't work if typed before the interface declaration Typescript
4 participants