Skip to content

fix(51170): Completing an unimplemented property overwrites rest of line - #51175

Merged
Daniel Rosenwasser (DanielRosenwasser) merged 2 commits into
microsoft:mainfrom
a-tarasyuk:fix/51170
Oct 17, 2022
Merged

fix(51170): Completing an unimplemented property overwrites rest of line#51175
Daniel Rosenwasser (DanielRosenwasser) merged 2 commits into
microsoft:mainfrom
a-tarasyuk:fix/51170

Conversation

@a-tarasyuk

Copy link
Copy Markdown
Contributor

Fixes #51170

Comment thread src/services/completions.ts Outdated
preferences.includeCompletionsWithInsertText &&
completionKind === CompletionKind.MemberLike &&
isClassLikeMemberCompletion(symbol, location)) {
isClassLikeMemberCompletion(symbol, location) && !hasInitializer(location.parent)) {

@DanielRosenwasser Daniel Rosenwasser (DanielRosenwasser) Oct 15, 2022

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.

Seems like you want something more like

location.parent.getChildren().some(child => child.pos > location.end)

I don't know if that's the most-optimal code, but it could be better since you could lose a more-specific type annotation, or trivia. For example:

////interface I {
////    prop: string;
////}
////class C implements I {
////    public pr/**/: "foo" | "bar";
////}

@DanielRosenwasser
Daniel Rosenwasser (DanielRosenwasser) merged commit 7406ee9 into microsoft:main Oct 17, 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

For Milestone Bug PRs that fix a bug with a specific milestone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Completing an unimplemented property overwrites rest of line

4 participants