Skip to content

Fix import statement completions followed by interface declaration - #50350

Merged
Andrew Branch (andrewbranch) merged 4 commits into
microsoft:mainfrom
andrewbranch:bug/48904
Sep 20, 2022
Merged

Fix import statement completions followed by interface declaration#50350
Andrew Branch (andrewbranch) merged 4 commits into
microsoft:mainfrom
andrewbranch:bug/48904

Conversation

@andrewbranch

Copy link
Copy Markdown
Member

Fixes #48904

// includeCompletionsWithSnippetText: true,
// }
// });
// });

Copy link
Copy Markdown
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 😅

Comment thread src/services/completions.ts Outdated
Comment thread src/services/completions.ts
Comment thread src/services/completions.ts Outdated
// 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

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.

Comment thread tests/cases/fourslash/importStatementCompletions2.ts
Comment thread src/services/completions.ts
@andrewbranch
Andrew Branch (andrewbranch) merged commit 938a69a into microsoft:main Sep 20, 2022
@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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