Skip to content

Add properties priority for completion - #32266

Merged
Sheetal Nandi (sheetalkamat) merged 8 commits into
microsoft:masterfrom
fuafa:properties-priorities
Sep 5, 2019
Merged

Add properties priority for completion#32266
Sheetal Nandi (sheetalkamat) merged 8 commits into
microsoft:masterfrom
fuafa:properties-priorities

Conversation

@fuafa

Copy link
Copy Markdown
Contributor

Fixes#29868

Comment threadsrc/services/completions.ts Outdated

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.

Thank you for working on this.

Comment threadsrc/services/completions.ts Outdated
Comment threadsrc/harness/fourslash.ts Outdated
Comment threadsrc/services/completions.ts Outdated
Comment threadsrc/services/completions.ts Outdated
Comment threadsrc/services/completions.ts Outdated
Comment threadsrc/services/completions.ts Outdated
Comment threadsrc/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) {

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.

Short circuit for filteredSymbols .length === 0 is needed.

Comment threadsrc/services/completions.ts Outdated
Comment threadsrc/services/completions.ts Outdated
Comment threadsrc/services/completions.ts Outdated

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

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.

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
Sheetal Nandi (sheetalkamat) dismissed their stale reviewJuly 25, 2019 19:56

approved with last comment to fix

@fuafa

Copy link
Copy Markdown
ContributorAuthor

Comment threadsrc/services/completions.ts Outdated
return contextualMemberSymbols;
}

const membersDeclaredBySpreadAssignment = createMap<boolean>();

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.

This needs to be Map since we don't use actual value.

Copy link
Copy Markdown
ContributorAuthor

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
Copy Markdown
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
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Thanks! Fixed.

Comment threadsrc/services/completions.ts Outdated
}

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

@sheetalkamatSheetal Nandi (sheetalkamat)Aug 19, 2019

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.

Change to Map<true> here too.

@sheetalkamat
Sheetal Nandi (sheetalkamat) merged commit c26c44d into microsoft:masterSep 5, 2019
@fuafa
Zixiang Li (fuafa) deleted the properties-priorities branch September 7, 2019 21:05
@microsoftMicrosoft (microsoft) locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

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

@fuafa@DanielRosenwasser@sheetalkamat