Skip to content

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

Merged
merged 8 commits into from
Sep 5, 2019
Merged

Add properties priority for completion #32266

merged 8 commits into from
Sep 5, 2019

Conversation

fuafa
Copy link
Contributor

@fuafa fuafa commented Jul 5, 2019

Fixes #29868

Copy link
Member

@sheetalkamat sheetalkamat left a 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.


// Set SortText to MemberDeclaredBySpreadAssignment if it is fulfilled by spread assignment
function setSortTextToMemberDeclaredBySpreadAssignment(membersDeclaredBySpreadAssignment: Symbol[], contextualMemberSymbols: Symbol[]): void {
for (const fulfilledSymbol of membersDeclaredBySpreadAssignment) {
Copy link
Member

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.

sheetalkamat
sheetalkamat previously approved these changes Jul 25, 2019
@@ -1885,7 +1892,18 @@ namespace ts.Completions {

let existingName: __String | undefined;

if (isBindingElement(m) && m.propertyName) {
if (isSpreadAssignment(m)) {
const expression = m.expression;
Copy link
Member

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

@sheetalkamat sheetalkamat dismissed their stale review July 25, 2019 19:56

approved with last comment to fix

@fuafa
Copy link
Contributor Author

fuafa commented Aug 13, 2019

Anything I miss? @DanielRosenwasser @sheetalkamat 🆙 🚀

@@ -1866,6 +1871,7 @@ namespace ts.Completions {
return contextualMemberSymbols;
}

const membersDeclaredBySpreadAssignment = createMap<boolean>();
Copy link
Member

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.

Copy link
Contributor Author

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?

Copy link
Member

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>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Fixed.

}

// Set SortText to MemberDeclaredBySpreadAssignment if it is fulfilled by spread assignment
function setSortTextToMemberDeclaredBySpreadAssignment(membersDeclaredBySpreadAssignment: Map<boolean>, contextualMemberSymbols: Symbol[]): void {
Copy link
Member

@sheetalkamat sheetalkamat Aug 19, 2019

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.

@sheetalkamat sheetalkamat merged commit c26c44d into microsoft:master Sep 5, 2019
@fuafa fuafa deleted the properties-priorities branch September 7, 2019 21:05
@timsuchanek timsuchanek mentioned this pull request Sep 11, 2019
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.

Optional and already-fulfilled properties should have lower priorities than required properties
3 participants