-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Add properties priority for completion #32266
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for working on this.
src/services/completions.ts
Outdated
|
||
// Set SortText to MemberDeclaredBySpreadAssignment if it is fulfilled by spread assignment | ||
function setSortTextToMemberDeclaredBySpreadAssignment(membersDeclaredBySpreadAssignment: Symbol[], contextualMemberSymbols: Symbol[]): void { | ||
for (const fulfilledSymbol of membersDeclaredBySpreadAssignment) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Short circuit for filteredSymbols .length === 0
is needed.
src/services/completions.ts
Outdated
@@ -1885,7 +1892,18 @@ namespace ts.Completions { | |||
|
|||
let existingName: __String | undefined; | |||
|
|||
if (isBindingElement(m) && m.propertyName) { | |||
if (isSpreadAssignment(m)) { | |||
const expression = m.expression; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok last one change needed.
Scope out this login into another function that sets the members in map so that it can be shared for object members and jsx attributes
Anything I miss? @DanielRosenwasser @sheetalkamat 🆙 🚀 |
src/services/completions.ts
Outdated
@@ -1866,6 +1871,7 @@ namespace ts.Completions { | |||
return contextualMemberSymbols; | |||
} | |||
|
|||
const membersDeclaredBySpreadAssignment = createMap<boolean>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be Map since we don't use actual value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it is a Map already, and what do you mean we don't use actual value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was on mobile and didnt realise its not showing correctly. Sorry about that. It needs to be Map<true>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Fixed.
src/services/completions.ts
Outdated
} | ||
|
||
// Set SortText to MemberDeclaredBySpreadAssignment if it is fulfilled by spread assignment | ||
function setSortTextToMemberDeclaredBySpreadAssignment(membersDeclaredBySpreadAssignment: Map<boolean>, contextualMemberSymbols: Symbol[]): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to Map<true>
here too.
Fixes #29868